Hi,
I’m working on a Blender exporter utility and need to calculate the area of a triangle. My trig maths is not very strong.
I have played with a number of algorithms but the results are inconsistent. i.e. sometimes they are correct, sometimes close and sometimes way off. I’m using the 2 metre test cube and a UVsphere as test objects. I have another utility that gives me the correct answer but I don’t have the source for tht.
The mesh is converted to triangles as part of the export process and I have a linked list of the triangles to work with.
As part of the problem I need to calculate the length of each side of the triangle. This is easy when a triangle is perpendicular and follows the classic text book examples but these triangles exist in a 3 dimensional world and are seldom perpendicular.
I found this equation that should provide the length of any side of a triangle: Sqrt ((X1-x2)[SUP]2[/SUP] + (Y1-y2)[SUP]2[/SUP] + (Z1 - Z2)[SUP]2[/SUP]).
Can someone confirm this is correct? I am using it but think it may be the cause of my inconsistent results.
Once I have the lengths I can calculate angles, etc leading to the area calculation.
Or, if someone has a simple solution for calculating the area of a (Blender) triangle, I’d be pleased to hear it.
TIA
Paul