vertices for rotation

Started by
9 comments, last by MannyMoe 5 years, 9 months ago

I am trying to write a program to rotate an octagon cube. I have the front

and back faces completed. I can't seem to figure out the vertices for the

right and top faces. Can someone please help me?

Thanks for your time! Here are the front vertices:

(-0.5, -1.0, 1.0)

(0.5, -1.0, 1.0)

(1.0, -0.5, 1.0)

(1.0, 0.5, 1.0)

(0.5, 1.0, 1.0)

(-0,5, 1.0, 1.0)

(-1.0, 0.5, 1.0)

(-1.0, -0.5, 1.0)

 

Advertisement

Well first off I'm not sure what an octagon cube is. An octagon is a 2D polygon and a cube is a 3D solid. What you have looks like an octagon as all the Z coordinates are 1.  However it's not a regular octagon.  If you want a regular octagon you have to do something like this:

https://en.wikipedia.org/wiki/Octagon#/media/File:Octagon_in_square.svg

There is also an octahedron which is a 3D 8 sided solid and looks like this:

https://en.wikipedia.org/wiki/Octahedron#/media/File:Octahedron.jpg

Perhaps you are tying to do some sort of extruded octagon.

16 minutes ago, fleabay said:

I'm pretty sure he meant polygon cube.

Well ..... if you follow his vertexes they form an octagon, so I'm not sure what he meant and in any case a polygon is 2D also, while a cube is 3D.

Thanks for all the help. Very interesting video. What I want to do is

instead of a cube with 4 sides per face, I want to do a cube with each face

having 8 sides. I would then texture each face and fill in the corners

with color. How to apply the vertices for the right side and top is giving

me the problem. In other words how do I arrange the vertices to make

the octagon on the right side and top so I can rotate the cube and it look

like it should. Hope I am being clear in what I have said. Thanks for any

help.

You mean a truncated cube?

https://en.wikipedia.org/wiki/Truncated_cube#/media/File:Truncatedhexahedron.jpg

 

Hey, that looks exactly what I am trying to do! I didn't know

what it was called but it looks like what I need. Is there any

information available for this? Thanks!!!!!!!!!!!!!

I just looked on Wikipedia..... In any case you already have one side, so you just need six of those at different orientations. If you want real regular octagons though you should use the formula for the edges from the picture I posted in my first post.  I'm not an expert on OpenGL but I imagine if you are doing this from raw OpenGL you will have to generate a vertex list with each vertex in it, and an index list that defines the triangles which build your truncated cube.  Are you already familiar with OpenGL? If not I would watch the whole video fleabay posted.

Yes, I am quite familiar with Opengl and Allegro 5. I have already written

many programs to render some geometric shapes. This one just seems

to be impossible for me to figure out. I guess I am getting too old. I will

keep trying to figure this out. Thanks for your time. Have a great day!

This topic is closed to new replies.

Advertisement