Geometric question: Tetrahedron and Cylinder
Hi!
I would like to know how can I obtain the coordinates of the vertices of a tetrahedron if I only have its center coordinates and the distance from the center to a vertex (the alignment could be with a face aligned with the X plane).
And the same for a cylinder, given the center, the length and the radius.
Maybe there are some links were I can find this??
Thank you, thank you! :o)
The glu library has functions for shapes like these. gluSphere() and gluCylinder should help you in making these shapes, sorry I can''t be more specific as I have never used these functions, but check out NeHe''s tutorials on using them.
FatalXC
FatalXC
July 16, 2001 05:08 PM
A tetrahedron has 4 vertices equally spaced from the origin:
( 1, 1, 1 )
( 1, -1, -1 )
( -1, 1, -1 )
( -1, -1, 1 )
Want a unit sphere? Just normalize them. Not sure how to
align a side to a major axis. Probably have to rotate
those points a bit.
A cylinder is just two 2D circles attached together.
Use the equation to get a point on a circle:
x = r * sin(angle_rads);
y = r * cos(angle_rads);
( 1, 1, 1 )
( 1, -1, -1 )
( -1, 1, -1 )
( -1, -1, 1 )
Want a unit sphere? Just normalize them. Not sure how to
align a side to a major axis. Probably have to rotate
those points a bit.
A cylinder is just two 2D circles attached together.
Use the equation to get a point on a circle:
x = r * sin(angle_rads);
y = r * cos(angle_rads);
A tetrahedron can be thought of as a low detail cone. (a cone being a tapered cylinder). For a regular tetrahedron (all points equidistant from the center) your points would be:
1: 0,sin(90),0
2: sin(0),sin(-30),cos(0)
3: sin(120),sin(-30),cos(120)
4: sin(240),sin(-30),cos(240)
multiply all these values by the radius you''re looking for.
As a generalized cone, you could say the height is (1+sin(30))*radius. The number of sections to draw is 3. I think there''s a cone drawing scheme in glu.
1: 0,sin(90),0
2: sin(0),sin(-30),cos(0)
3: sin(120),sin(-30),cos(120)
4: sin(240),sin(-30),cos(240)
multiply all these values by the radius you''re looking for.
As a generalized cone, you could say the height is (1+sin(30))*radius. The number of sections to draw is 3. I think there''s a cone drawing scheme in glu.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement