public static SegmentIntersectionPoint ( Vector3 start1, Vector3 end1, Vector3 start2, Vector3 end2, bool &intersects ) : Vector3 | ||
start1 | Vector3 | |
end1 | Vector3 | |
start2 | Vector3 | |
end2 | Vector3 | |
intersects | bool | |
리턴 | Vector3 |
public bool CheckSegmentIntersects(Int3 start, Int3 end, int gridX, int gridY, out Int3 outPoint, out TriangleMeshNode nearestNode) { List <object> objs = this.rasterizer.GetObjs(gridX, gridY); outPoint = end; nearestNode = null; if (objs == null || objs.Count == 0) { return(false); } Int3[] array = new Int3[3]; bool result = false; long num = 9223372036854775807L; for (int i = 0; i < objs.Count; i++) { TriangleMeshNode triangleMeshNode = objs[i] as TriangleMeshNode; triangleMeshNode.GetPoints(out array[0], out array[1], out array[2]); for (int j = 0; j < 3; j++) { int num2 = j; int num3 = (j + 1) % 3; bool flag = false; Int3 vInt = Polygon.SegmentIntersectionPoint(array[num2], array[num3], start, end, out flag); if (flag) { long num4 = start.XZSqrMagnitude(ref vInt); if (num4 < num) { nearestNode = triangleMeshNode; num = num4; outPoint = vInt; result = true; } } } } return(result); }