kamiyasi
Member
Here's the code that I've got so far that's giving me an incorrect shape.
I'm trying to get the x, y, and z coordinates relating to a sphere's vertices (in this case with axis and height divisions of 20) So far, this chode-like shape is the closest I've gotten. Any advice? Thanks!
Code:
var i, j, xpos, ypos, zpos, divisions, radius, raddist;
divisions = 20;
radius = 500;
for ( i=0; i < divisions; i++ ) //rows
{
for ( j=0; j < divisions; j++ ) //columns
{
raddist = lerp( 0, 1, ( j*(360/divisions) ) / 360 );
xpos = lengthdir_x( radius * raddist, (i * (360 / divisions)) );
ypos = lengthdir_y( radius * raddist, (i * (360 / divisions)) );
zpos = -dsin( j * (360 / divisions ) ) * radius;
d3d_draw_ellipsoid(xpos-10, ypos-10, zpos-10, xpos+10, ypos+10, zpos+10, tex2, 1, 1, 24);
}
}
I'm trying to get the x, y, and z coordinates relating to a sphere's vertices (in this case with axis and height divisions of 20) So far, this chode-like shape is the closest I've gotten. Any advice? Thanks!