Created
March 16, 2015 21:47
-
-
Save PsichiX/40648639bc154f546201 to your computer and use it in GitHub Desktop.
testPointInBox3d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool testPointInBox3d(Vector3d point, Matrix boxTransformWorld, Vector3d boxDimension, Vector3d boxOrigin) | |
{ | |
Matrix worldToLocalTransform = boxTransformWorld.inverse(); | |
Vector3d localPoint = worldToLocalTransform.transform(point); | |
return localPoint.x >= -boxOrigin.x && localPoint.x <= boxDimension.x - boxOrigin.x && | |
localPoint.y >= -boxOrigin.y && localPoint.y <= boxDimension.y - boxOrigin.y && | |
localPoint.z >= -boxOrigin.z && localPoint.z <= boxDimension.z - boxOrigin.z; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment