AB4D Forum
bovisual3d - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: bovisual3d (/showthread.php?tid=4283)



bovisual3d - kreativasas - 09-07-2021

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 )?


RE: bovisual3d - abenedik - 09-14-2021

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):
Code:
boxVisual3D.Transform.Inverse.Transform(point3D);