DaleAT

10-24-2000, 07:22 PM

I have been trying to draw an elipse with opengl...any suggestions? I can figure out spheres and make them translate,scale and rotate but I can't seem to get elipses...any help would be nice. txs

View Full Version : Elipses

DaleAT

10-24-2000, 07:22 PM

I have been trying to draw an elipse with opengl...any suggestions? I can figure out spheres and make them translate,scale and rotate but I can't seem to get elipses...any help would be nice. txs

Mace

10-24-2000, 11:03 PM

Well, if you know how to scale your spheres do this:

1) Define the elipse radius on each axis

(x, y, z)

2) glPushMatrix();

glScaled(radiusX, radiusY, radiusZ)

>>Render sphere with size 1.0<<

glPopMatrix();

1) Define the elipse radius on each axis

(x, y, z)

2) glPushMatrix();

glScaled(radiusX, radiusY, radiusZ)

>>Render sphere with size 1.0<<

glPopMatrix();

SED

10-29-2000, 03:33 AM

This will plot points around the perimeter of an ellipse, given an angle, semi-minor & semi-major axis. I was coding a Solar System simulator & needed it.

#define PI 3.14159265358979323846

#define SQ(x) (x*x)

#define D2R(a) (a*(PI / 180))

GLfloat a, r, x, y, min = 5, maj = 10;

for (a=0; a<360; a++)

{

r = sqrt ((SQ(maj)*SQ(min)) / ((SQ(maj) * SQ(sin(D2R(a)))) + (SQ(min) * SQ(cos(D2R(a))))));

x = r * cos(D2R(a));

y = r * sin(D2R(a));

}

Sean

#define PI 3.14159265358979323846

#define SQ(x) (x*x)

#define D2R(a) (a*(PI / 180))

GLfloat a, r, x, y, min = 5, maj = 10;

for (a=0; a<360; a++)

{

r = sqrt ((SQ(maj)*SQ(min)) / ((SQ(maj) * SQ(sin(D2R(a)))) + (SQ(min) * SQ(cos(D2R(a))))));

x = r * cos(D2R(a));

y = r * sin(D2R(a));

}

Sean

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.