Created
August 13, 2020 06:30
-
-
Save chuongmep/46fbecf448c09dfa05bd0773f1cca8f8 to your computer and use it in GitHub Desktop.
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
/// <summary> | |
/// Return an arbitrary point on a planar planarFace, | |
/// namely the midpoint of the first mesh triangle. | |
/// </summary> | |
/// <returns name="point"></returns> | |
public static XYZ PointOnFace(PlanarFace planarFace) | |
{ | |
XYZ point = new XYZ(0, 0, 0); | |
Mesh mesh = planarFace.Triangulate(); | |
for (int i = 0; i < mesh.NumTriangles;) | |
{ | |
MeshTriangle triangle = mesh.get_Triangle(i); | |
point += triangle.get_Vertex(0); | |
point += triangle.get_Vertex(1); | |
point += triangle.get_Vertex(2); | |
point *= 0.3333333333333333; | |
break; | |
} | |
return point; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment