It can be very helpful to know how to calculate the area of triangles in 3D space. You can use it to calculate the surface area of an object, which in turn you can use to calculate/set mass or density of objects. Primarily, I use area to create distribution attributes for particle emission, such that polygons of varying size emit a spatially consistent amount of particles. For example, in Houdini, if area is assigned as a primitive attribute (you have measured the area of each polygon and stored it) you simply multiply area by emission rate and will get a fairly even distribution of particles emitted from a surface. Of course, Houdini has a built in operator to calculate area, but if you don’t have such an operator in your 3D program, or you are writing your own code, here’s how to do it.
The main tools needed to calculate an area of a triangle in 3D space are covered in my post about distance.
The basic formula using vectors goes something like this:
Given three vector points in space, A, B, and C, the area of the triangle formed by those points is 1/2 the magnitude (see distance) of the cross product (see cross product) of vector AB and AC.
It can be written in mathematical notation like this:
1/2 * |AB x AC|
It can also be explained diagrammatically like so:
So, given three points, A, B, and C, pick one point arbitrarily and calculate two distance vectors between that point and the other two points (distance vectors AB and AC) by doing vector subtraction. Find the cross product between those vectors. The cross product outputs a vector. Now, calculate the magnitude of this vector, and finally divide by 2 (or multiply by 0.5).
Not to be a pest, but I am curious what software you used to generate that algorithm picture. Is it free? I would like to get a free copy of that, if I can, or else a free equivalent.
That was a VEX node diagram from Houdini. I took a screen capture from the free apprentice version, available on sidefx’s website.
You explain it perfectly. I’ve enjoyed all your posts in Mathematics.
You know until now I have never found a tutorial DVD on exactly those vector math basics and how they apply to the field of 3D software.
Houdini has a lot of freedom with its VEX nodes but you really gotta now what you’re doing.
If only I didn’t leave college early – it’s quite a ride trying to gain on all that I missed out on. 😉
I know there are some books that deal with the technical mathematics behind 3D – not sure about any DVD’s myself. All of my info has come from the internet, and then putting examples together to help solidify the information. And then, of course, I am writing it all down here so that I can reference it – and it is explained in a way that is easy for me to comprehend.
It would have been awesome to have had a math teacher break out a 3D app and explain why trigonometry is important. I always found it boring and impossible to comprehend its usefulness until the last few years.