• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

# Geometric question: Tetrahedron and Cylinder

This topic is 6400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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)

##### Share on other sites
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

##### Share on other sites
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:

##### Share on other sites
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.

THANK YOU!!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 12
• 15
• 11
• 12
• ### Forum Statistics

• Total Topics
634152
• Total Posts
3015843
×