Hi guys,

i need to create a boxvisual3d around a mesh, rotate it and test how many points of the mesh are inside the box.
How i can do (the function 'contains' doesn't work with a boxvisual like rect3d and rect3d cannot be rotated )?
As you have already found out, you can use Rect3D.Contains only on axis aligned 3D rectangles.

If you have a rotated rectangle, then the easiest way to check if a 3D point is in that rectangle to first transform the 3D position with inversed rotation matrix - after that you can do a simple Rect3D.Contains check on the original rectangle.

To transform with inversed rotation matrix you can use the following code (assuming boxVisual3D is an instance of BoxVisual3D):
Andrej Benedik

Forum Jump:

Users browsing this thread:
1 Guest(s)