Skip to main content
gamedev.net
🔒 Locked

Display OBB

Started by abade Dec 23, 2004 at 2:39 AM 3 replies 550+ views
Original Post
abade
abade
Hi.. Can somebody help me in terms of calculation and code on construction and displaying an OBB. I have read Stefan Gottschalk paper and thesis, emm.. just can understand the theory a little bit. Let say, if I have eigenvector, the centroid of OBB and the half length, what should I do with these values.I try to display the OBB, but then it seems as AABB. If I’m not mistaken, the eigenvectors will determine the OBB directions. Or perhaps I have to rotate this “AABB” to form an OBB. Help me please. Thanks in advance.... [Edited by - abade on December 24, 2004 1:36:36 AM]
Zakwayda
Zakwayda
Haven't done the covariance stuff in a while, so can't help you with that. But, the 8 corners of an OBB are:

C +/- E[0] * A[0] +/- E[1] * A[1] +/- E[2] * A[2]

Where C is the box center, A[] are the three axes, and E[] are the extents along those axes.

Note that this construct is equivalent to transforming the 8 object-space corners by the OBB's transformation matrix.

Does that help?
abade
abade
Quote:
Original post by jyk

Hi jyk
what do mean by "+/-". I really don't understand.

C +/- E[0] * A[0] +/- E[1] * A[1] +/- E[2] * A[2]



abade
abade
Yes..i have calculated the covariance (3x3 matrix) and from this covariance values, then I generate the eigenvalues and eigenvectors. Emm....why I can’t display the correct OBB.
Zakwayda
Zakwayda
Quote:
what do mean by "+/-". I really don't understand.


corner[0] = C + E[0] * A[0] + E[1] * A[1] + E[2] * A[2];corner[1] = C - E[0] * A[0] + E[1] * A[1] + E[2] * A[2];corner[2] = C + E[0] * A[0] - E[1] * A[1] + E[2] * A[2];corner[3] = C + E[0] * A[0] + E[1] * A[1] - E[2] * A[2];corner[4] = C - E[0] * A[0] - E[1] * A[1] - E[2] * A[2];corner[5] = C + E[0] * A[0] - E[1] * A[1] - E[2] * A[2];corner[6] = C - E[0] * A[0] + E[1] * A[1] - E[2] * A[2];corner[7] = C - E[0] * A[0] - E[1] * A[1] + E[2] * A[2];

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.