Hello

I want to code a sphere with points (not with triangle),

and I'll display them with the fonction API "SetPixelA".

I want to code an algo,if somebody can help me with a tut/source/url.

PS: I'll code it only in Win32, not in DirectX, D3D,OpenGL,...

thx

I want to code a sphere with points (not with triangle),

and I'll display them with the fonction API "SetPixelA".

I want to code an algo,if somebody can help me with a tut/source/url.

PS: I'll code it only in Win32, not in DirectX, D3D,OpenGL,...

thx

Hi

Look into the ObjAsm32 package and search for a project called API_3D_Engine. Here you can find the code for a sphere and other simple geometries.

Regards,

Biterider

Look into the ObjAsm32 package and search for a project called API_3D_Engine. Here you can find the code for a sphere and other simple geometries.

Regards,

Biterider

tomart2005,

loop throught the whole 360 degrees, taking sinus and cosinus of these angles...

multiply these 2 values (sin/cos) by radius, and add sphere centre, and you have the X and Y for your SetPixel

ancev

ps: the much smallers steps you use while looping from 0-360 degrees, the closer the points will appear

loop throught the whole 360 degrees, taking sinus and cosinus of these angles...

multiply these 2 values (sin/cos) by radius, and add sphere centre, and you have the X and Y for your SetPixel

ancev

ps: the much smallers steps you use while looping from 0-360 degrees, the closer the points will appear

hey ancev

you wrote:

loop throught the whole 360 degrees, taking sinus and cosinus of these angles...

multiply these 2 values (sin/cos) by radius, and add sphere centre, and you have the X and Y for your SetPixel

ancev

ps: the much smallers steps you use while looping from 0-360 degrees, the closer the points will appear

----------------------------------------------

Can you give me a formula, coz I don't understand with my bad english, plz

thx

you wrote:

loop throught the whole 360 degrees, taking sinus and cosinus of these angles...

multiply these 2 values (sin/cos) by radius, and add sphere centre, and you have the X and Y for your SetPixel

ancev

ps: the much smallers steps you use while looping from 0-360 degrees, the closer the points will appear

----------------------------------------------

Can you give me a formula, coz I don't understand with my bad english, plz

thx

Here's the pseudocode for drawing a full circle:

for radius = 0 to radius_max

for degree=0 to 359

x = x_center + radius * cos(degree)

y = y_center + radius * sin(degree)

plot ( x, y )

endfor

endfor

But realy... you should be able to find yourself the formula of circle/sphere..

For higher resolution.. you could increment you angle with values smaller than 1, maybe 0.1 or other values.. it depends of the circle radius..

For 3D its more complicated.. depends of a lot of factors: projection/camera etc.

Eugen

for radius = 0 to radius_max

for degree=0 to 359

x = x_center + radius * cos(degree)

y = y_center + radius * sin(degree)

plot ( x, y )

endfor

endfor

But realy... you should be able to find yourself the formula of circle/sphere..

For higher resolution.. you could increment you angle with values smaller than 1, maybe 0.1 or other values.. it depends of the circle radius..

For 3D its more complicated.. depends of a lot of factors: projection/camera etc.

Eugen