Sign in to follow this  
coolhelix

Cube Primitive Definition

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this