Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Created June 13, 2020 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/cec06820d1098caa0a0d3e674db48863 to your computer and use it in GitHub Desktop.
Save chuongmep/cec06820d1098caa0a0d3e674db48863 to your computer and use it in GitHub Desktop.
double TriangleArea( MeshTriangle triangle )
{
XYZ a = triangle.get_Vertex( 0 );
XYZ b = triangle.get_Vertex( 1 );
XYZ c = triangle.get_Vertex( 2 );
Line l = Line.CreateBound( a, b );
double h = l.Project( c ).Distance;
double area = 0.5 * l.Length * h;
return area;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment