Created
September 19, 2020 06:03
Star
You must be signed in to star a gist
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
XYZ ProjectPointOntoPlane( | |
XYZ point, | |
XYZ planeNormal ) | |
{ | |
double a = planeNormal.X; | |
double b = planeNormal.Y; | |
double c = planeNormal.Z; | |
double dx = ( b * b + c * c ) * point.X - ( a * b ) * point.Y - ( a * c ) * point.Z; | |
double dy = -( b * a ) * point.X + ( a * a + c * c ) * point.Y - ( b * c ) * point.Z; | |
double dz = -( c * a ) * point.X - ( c * b ) * point.Y + ( a * a + b * b ) * point.Z; | |
return new XYZ( dx, dy, dz ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment