Monday, February 09, 2009

2D Area of a TIN Triangle

This post is a snippet of code that calculates the 2D area of a TIN Triangle. This is helpful to know if you want to calculate Elevation ranges for a TIN surface.

dOT is an array of TIN Triangle points for the entire surface using the OutputTriangles Property for an AECTINSurface.

For i = 0 to Ubound(dOT) Step 9

dArea = dArea + 0.5 * Abs(dOT(i)*dOT(i+7)-dOT(i)*dOT(i+4)+dOT(i+3)*dOT(i+1)-dOT(i+3)*dOT(i+7)+dOT(i+6)*dOT(i+4)-dOT(i+6)*dOT(i+1))


This is just part of the area calculations needed. You would also need to calculate the area of the triangle if it is split by an elevation range or ranges.

No comments:


Blog Widget by LinkWithin