Jump to content
  • Advertisement
Sign in to follow this  
coolhelix

Cube Primitive Definition

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, guys, I want to define some 3D primitive nodes for our graphic engine. Cube Node is one of the basis primitive node in our design. I am wondering, besides two vertex position, is there any other attribution I need to concern, such as axis vector, normal vector, etc. Because the cube is in 3D space, only two points is not enough, we must consider its orientation. But I also need to keep the size of the definition as small as possible. What's your opinion? My draft is class CubeNode { public: float mTopLeft[3]; float mBottomRight[3]; float mXAxisVector[3]; //X Axis Orientation float mYAxisVector[3]; //Y Axis Orientation } Thanks!

Share this post


Link to post
Share on other sites
Advertisement

class CubeNode
{
public:
float dimensions[3]; // width, length and depth of the cube
float position[3]; // world space position
float rotation[3]; // rotation on each axis in radians
}

Share this post


Link to post
Share on other sites
you can also use:

Cube
{
VECTOR3 Axis[3] //X,Y,Z normalize axis of the cube
VECTOR3 Origin //Origin of cube in 3D space
float Dimension[3] //Length of the X,Y,Z axis of the cube.
}

Share this post


Link to post
Share on other sites
Quote:
Original post by littlekid
you can also use:

Cube
{
VECTOR3 Axis[3] //X,Y,Z normalize axis of the cube
VECTOR3 Origin //Origin of cube in 3D space
float Dimension[3] //Length of the X,Y,Z axis of the cube.
}


in that case you only need the Up and Right vector for the axis

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!