Last active
December 5, 2015 14:30
-
-
Save hiroakioishi/7d9857acfe632fa76323 to your computer and use it in GitHub Desktop.
3次元座標上の線分と平面の交点座標を求める
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
Vector3 calcIntersectionLineSegmentAndPlane (Vector3 a, Vector3 b, Vector3 v0, Vector3 v1, Vector3 v2) { | |
float distAP = calcDistancePointAndPlane (a, v0, v1, v2); | |
float distBP = calcDistancePointAndPlane (b, v0, v1, v2); | |
float t = distAP / (distAP + distBP); | |
return (b - a) * t + a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment