# Cube Primitive Definition

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

## 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 on other sites
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 on other sites
It's elegant indeed!
Thank you very much! :)

##### 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 on other sites
Quote:
 Original post by littlekidyou 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

• ### What is your GameDev Story?

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

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634087
• Total Posts
3015445
×