09-14-2021, 01:21 PM
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):
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):
Code:
boxVisual3D.Transform.Inverse.Transform(point3D);
Andrej Benedik

