如何围绕一组物体旋转相机? (不使用 3d 引擎)
因此,我使用类似 (flash 10.1 CS5) 的代码在 3d 中创建点云:
import flash.display.Bitmap;
import flash.display.BitmapData;
var bmd:BitmapData = new BitmapData(400, 400, true, 0xFFCCCCCC);
var xn:Number;
var yn:Number;
var zn:Number;
var norm:Number;
var c1:Number;
var c2:Number;
var c3:Number;
var c4:Number;
var counter:int;
var color:uint
while (counter < 100000)
{
xn = Math.random() * 600 - 200;
yn = Math.random() * 600 - 200;
zn = Math.random() * 600 - 200;
norm = Math.sqrt(xn * xn + yn * yn + zn * zn);
c1 = (1 - norm / 200) * 255;
c2 = (1 - norm / 250) * 255;
c3 = Math.abs(xn) / norm * 255;
c4 = Math.abs(yn) / norm * 255;
color = (c1 << 24 | c2 << 16 | c3 << 8 | c4);
counter++;
var pointGraphicData = new BitmapData(1,1,true,color)
var pointGraphic:Bitmap = new Bitmap(pointGraphicData);
pointGraphic.x = xn;
pointGraphic.y = yn;
pointGraphic.z = zn;
addChild(pointGraphic);
}
如何移动和旋转以球体形式观察屏幕的相机
围绕创建的框?
So I create a point cloud, in 3d with code like (flash 10.1 CS5):
import flash.display.Bitmap;
import flash.display.BitmapData;
var bmd:BitmapData = new BitmapData(400, 400, true, 0xFFCCCCCC);
var xn:Number;
var yn:Number;
var zn:Number;
var norm:Number;
var c1:Number;
var c2:Number;
var c3:Number;
var c4:Number;
var counter:int;
var color:uint
while (counter < 100000)
{
xn = Math.random() * 600 - 200;
yn = Math.random() * 600 - 200;
zn = Math.random() * 600 - 200;
norm = Math.sqrt(xn * xn + yn * yn + zn * zn);
c1 = (1 - norm / 200) * 255;
c2 = (1 - norm / 250) * 255;
c3 = Math.abs(xn) / norm * 255;
c4 = Math.abs(yn) / norm * 255;
color = (c1 << 24 | c2 << 16 | c3 << 8 | c4);
counter++;
var pointGraphicData = new BitmapData(1,1,true,color)
var pointGraphic:Bitmap = new Bitmap(pointGraphicData);
pointGraphic.x = xn;
pointGraphic.y = yn;
pointGraphic.z = zn;
addChild(pointGraphic);
}
How to move and rotate camera that looks onto the screen in sphere like path
around created box?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此链接有一个关于如何在球体表面上创建螺旋的 JavaScript 示例:
http://lines-about-to-be- generated.blogspot.com/2009/06/image-spiral-sphere.html
There's a javascript example of how to create a spiral on a sphere surface at this link:
http://lines-about-to-be-generated.blogspot.com/2009/06/image-spiral-sphere.html
您想要一个阿基米德螺旋。你应该能够通过谷歌找到大量的方程。
您需要:
You want an Archimedian Spiral. You should be able to find tons of equations via google.
You'll want to: