# 3D math troubles

### #1 1101

1101

GMC Member

• New Member
• 460 posts

Posted 17 February 2011 - 03:15 AM

So I have two boxes (in 3D) and I need to find a vector that is made up of two points, one on each box, such that the distance between the points is the minimal distance between the boxes. The boxes can be anywhere in 3D space, of any length,width, or height, and can be rotated in any which way. Obviously depending on how the boxes are oriented there may be more than one set of points that satisfy the minimal distance requirement. However there should still only be one (not counting the one in the opposite direction) vector between them. Does anyone even have an idea of how to find this vector? In fact could anyone figure this out using only rectangles in 2D?
• 0

### #2 paul23

paul23

GMC Member

• Global Moderators
• 3368 posts
• Version:GM8

Posted 17 February 2011 - 09:10 AM

So I have two boxes (in 3D) and I need to find a vector that is made up of two points, one on each box, such that the distance between the points is the minimal distance between the boxes. The boxes can be anywhere in 3D space, of any length,width, or height, and can be rotated in any which way. Obviously depending on how the boxes are oriented there may be more than one set of points that satisfy the minimal distance requirement. However there should still only be one (not counting the one in the opposite direction) vector between them. Does anyone even have an idea of how to find this vector? In fact could anyone figure this out using only rectangles in 2D?

As you indicated I'd first study this in a 2 dimensional environment. (There are countless papers about this subject, a good search term would be "minimum distance between polygons" or "distance orientated bounding boxes")

However a very simple approach would be to use the fact boxes are simply 6 planes. - The distance between planes in R3 is easily figured out with basic vector math.

Edited by paul23, 17 February 2011 - 09:14 AM.

• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users