TheSwamp

Code Red => .NET => Topic started by: gswang on June 14, 2014, 07:41:09 AM

Title: How to calculate the nearest distance between two Solid3d objects?
Post by: gswang on June 14, 2014, 07:41:09 AM
How to calculate the nearest distance between two Solid3d objects?
Title: Re: How to calculate the nearest distance between two Solid3d objects?
Post by: MickD on June 15, 2014, 06:24:10 PM
The brute force way would be to get all vertices from all faces/edges from the Brep model and get a vector from each one from one solid and get the scalar length to a vertex of the other solid.

A shorter way would be to get the 2 bounding box faces that face each other then get the vertices that lie on each face and then get the scalar as above, it will at least reduce the iterations a great deal.

If you're really adventurous you could build BSP trees or a similar structure and use those for comparison, any way you cut it it's not a trivial exercise, that may give you some direction to get started though and we can help from there.
Title: Re: How to calculate the nearest distance between two Solid3d objects?
Post by: gswang on June 18, 2014, 03:24:38 AM
Thank your, MickD!
Title: Re: How to calculate the nearest distance between two Solid3d objects?
Post by: MickD on June 18, 2014, 03:43:19 AM
no problem, let us know how you go.
Title: Re: How to calculate the nearest distance between two Solid3d objects?
Post by: gswang on July 12, 2014, 08:40:28 AM
 Need explanation is: I was doing the calculation of 3D pipeline, the original data is the axis of space I two lines,
 first, obtains closest points between two axes by GetClosestPointTo method, result is P0, P1,
 then, create two Solid3d, then get all Face 3D object's surface obtained by Brep,
 finally, get the surface's closest point to P0, P1 by ClosestPointTo method, result is  Pa, Pb,
 then the distance pa to pb is the nearest distance between two Solid3d.
Title: Re: How to calculate the nearest distance between two Solid3d objects?
Post by: MickD on July 12, 2014, 07:42:37 PM
good job!