Skip to content

Instantly share code, notes, and snippets.

@hiroakioishi
Last active December 5, 2015 14:30
Show Gist options
  • Save hiroakioishi/7d9857acfe632fa76323 to your computer and use it in GitHub Desktop.
Save hiroakioishi/7d9857acfe632fa76323 to your computer and use it in GitHub Desktop.
3次元座標上の線分と平面の交点座標を求める
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