3d 点生成
我想生成一个具有 x、y、z 坐标的 3D 点立方体,这些点的间距相等。我用 Perl 编写了以下程序,但是当我想象时,看起来缺少一些要点。
for($x=0;$x<28;$x+=1.4){
for($y=0;$y<28;$y+=1.4){
for($z=0;$z<28;$z+=1.4){
@arr_grid[$g]=$x." ".$y." ".$z."\n";
$g++;
}
}
}
$c=scalar @arr_grid;
for($l=0;$l<$c;$l++){
print "HETATM O @arr_grid[$l]\n";
}
或者向我推荐任何涉及空间 3D 点和计算的书籍或网站。提前致谢。
I would like to generate a cube of 3D points with x,y,z coordinates, which are spaced equally. I wrote the following program in Perl, but when I visualise, it looks some points are missing.
for($x=0;$x<28;$x+=1.4){
for($y=0;$y<28;$y+=1.4){
for($z=0;$z<28;$z+=1.4){
@arr_grid[$g]=$x." ".$y." ".$z."\n";
$g++;
}
}
}
$c=scalar @arr_grid;
for($l=0;$l<$c;$l++){
print "HETATM O @arr_grid[$l]\n";
}
or suggest me any books or sites which deals with 3D points in space and calculations. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能有兴趣看到一些看起来更像 Perl 程序员如何编写的东西。
但是,正如 Nick 所说,这似乎不是 Perl 的问题。
You might be interested in seeing something that looks more like how a Perl programmer would write this.
But, like Nick says, it doesn't seem to be a problem with the Perl.