Jump to content
  • Advertisement


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



This topic is 6118 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

I got this code for computing a Oriented Bounding Box from www.magic-software.com. Can someone explain to me whats happening and how to use this function.
void Box2::ComputeVertices (Vector2 akVertex[4]) const
    Vector2 akEAxis[2] =

    akVertex[0] = m_kCenter - akEAxis[0] - akEAxis[1];
    akVertex[1] = m_kCenter + akEAxis[0] - akEAxis[1];
    akVertex[2] = m_kCenter + akEAxis[0] + akEAxis[1];
    akVertex[3] = m_kCenter - akEAxis[0] + akEAxis[1];
The code is called MgcBox2.cpp under 2d core.

Share this post

Link to post
Share on other sites
Not that i''m a good c++ programmer, but to me it looks like the code takes for vertices and makes a box out of them.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Ok i''ll try... It was two years since i last touched c++ though.

You give the function an array of four vertices "Vector2 akVertex[4]", then the function takes these vertices and arranges them a set distance from the objects (Box2) center.

You MUST pass an array to the function.

Share this post

Link to post
Share on other sites

  • 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!