Computex 3D box coordinates from min() and max() points

Started by
6 comments, last by clb 8 years, 9 months ago

Hello, I have a 3D box in space and I know two points, more specifically its minimum and maximum coordinates. Those points are basically the 3D box diagonal. There is a practical way to calculate the remaining 6 points? Thanks

Advertisement

Must be late where you live. :)

Given the min and max coords, form every combination of min.x with min/max.y and min/max.z; all combos of max.x with min/max.y and min/max.z.

I.e.,

All combinations using min.x

min.x, min.y, min.z

min.x, max.y, min.z

min.x, min.y, max.z

min.x, max.y, max.z

All combinations using max.x

max.x, min.y, min.z

max.x, max.y, min.z

max.x, min.y, max.z

max.x, max.y, max.z

Forms coords for all 8 corners of the cube.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Thanks for the answer Buckeye, this would be correct if the box has no transformations of any kind, but say for example it is rotated in 3D space: in that case the calculations above won't suffice.

Why is an AABB's min and max rotated? If they are, then they may not be the min/max anymore. Usually I do what Buckeye said before rotation, and then apply the rotation to all points on the AABB.


this would be correct if the box has no transformations of any kind, but say for example it is rotated in 3D space: in that case the calculations above won't suffice.

That's correct. I answered the question you asked.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

how can we know anything about the shape of the box then?


if the box is a cube :) i figure, find the midpoint of your known points, then easily produce the other corners by swapping coordinates. but it's late here :)

neither a follower nor a leader behttp://www.xoxos.net

Like said above, if you have an oriented box in 3D space, i.e. one where the edges don't line up with the coordinate axes, then if you only know two corners (diagonally opposite or not), there is still not enough information to compute the complete box. Not even when the box is a cube (all side lengths the same).

If you do have a rotation matrix or a quaternion representing the orientation of the box, in addition to knowing two corner coordinates that are diagonally opposite, then you can compute other six corners of the oriented box. One way to do this is to compute the three world axis directions of the box from the rotation matrix (the columns or rows of the matrix, depending on your math conventions), and then project the two corner points to each of these directions in turn, and taking the extents.

This topic is closed to new replies.

Advertisement