2
\$\begingroup\$

I created two vectors named bboxmin and bboxmax using the functions vector3 applymin_xyz() and vector3 applymax_xyz().

How do I convert them to 8 vertices,so I can test cull with them?

\$\endgroup\$
  • \$\begingroup\$ It is very unclear what you're asking. What technology do you use? \$\endgroup\$ – Vaillancourt May 29 '15 at 9:35
6
\$\begingroup\$

For an axis-aligned bounding box represented by a minimum and maximum corner, you can extract six pieces of information, xMin, yMin, zMin, xMax, yMax, zMax.

Given those, you can construct your eight vertices as all combinations of the min and max values for each component:

{ xMin, yMin, zMin },
{ xMin, yMin, zMax },
{ xMin, yMax, zMin },
{ xMin, yMax, zMax },
{ xMax, yMin, zMin },
{ xMax, yMin, zMax },
{ xMax, yMax, zMin },
{ xMax, yMax, zMax },

Of course, normally you would not do this conversion to a polyhedron, but instead work with separating axes or possibly the plane equations. You may want to consult Christer Ericson's Real-Time Collision Detection book and the table of intersection methods from Real-Time Rendering.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.