banner ad
Tuesday, January 23, 2007
3D sphere v1

Got a sphere to rotate around in 3D sphere. The theorem of the bucky ball turned out to be too complex to implement.  The miniml approach came from the wikipedia sphere definition.  


I implemented this equation by creating the following for loop for the initialisation of the points.  angleIncrement is set by setting the number of points on the sphere. You will also notice that I changes the x,y,z property equations to match the above equation.

	
for(var i=-Math.PI;i<=Math.PI;i+=angleIncriment ){
for(var j=0;j<=Math.PI;j+=angleIncriment){
// create clip
var clip = make3DModel(i,j);
// set render
clip.onEnterFrame = renderRotate;
}
}

// 3D xyz positions
clip.x = centerX + Math.cos(i) * Math.cos(j)*focalLength;
clip.y = centerY + Math.cos(i) * Math.sin(j)*focalLength;
clip._z = clip.z = centerY + Math.sin(i)*focalLength;


»comments

Rostislav Siryk said...

This thing is pretty CPU-cost one.

BTW, man, I like your experiments!


Paul+Ortchanian said...

hi Rotislave,

Actually I have an AS3 version coming up that is better on CPU drain. If you want this to be lioghter on your CPU you can decrease the number of clips from 1000 to 100.


cslam said...

I like your site. V good.

Pardon me, i notice one of the pole of the sphere is a little weird.


Name
URL
Email
*email address is not published
Remember Me
Comments

CAPTCHA






banner ad