Continuing on with the calculating of area... lets look at triangles.
There are tons of ways to get the area of a triangle so.....
Here is a link to wikipedia's section on Triangles .
I went with Heron's Formula, simply because I had all the edge/side lengths worked out already. Here is what my scene looks like...
*click to make bigger* |
I drew a linear curve with three points for my triangle.
The black value(area=√( s(s-a)(s-b)(s-c) )) is the area of the triangle, the orange value(cos C = (a^2 + b^2 - c^2)/2ab) is the corner angle of Point_02_Null. The light green value(s = (a+b+c)/2) is half the length of the perimeter of the triangle.
Lets go look at all this in ICE.
To start I made a little cluster to null constraint so I could move the triangle points around freely. I named them Point_01_Null, Point_02_Null and Point_03_Null. *something to keep in mind is that one of your points will be numbered 0, and be on 0,0,0. I just moved mine off the origin. In the wikipedia they go into a whole section on this.*
To start I made a little cluster to null constraint so I could move the triangle points around freely. I named them Point_01_Null, Point_02_Null and Point_03_Null. *something to keep in mind is that one of your points will be numbered 0, and be on 0,0,0. I just moved mine off the origin. In the wikipedia they go into a whole section on this.*
Here's what that constraint looked like in ICE.
Then I worked out the length and center of the three sides.
Side A, B and C letters where stuck too the curve by a standard Softimage constrain between two points.
Using a linear blend between the two nulls was the fastest why to get the center point on the curves
Using the distance between node, I got all three sides lengths and then added them together to get the perimeter of the whole triangle.
Here's what the inside of the compound "length of C" looks like....
Next I tested the side lengths with the curve length to see if the perimeters matched up.
Now I could work out the angles of the triangle using the law of cosin:
cos C = (a^2 + b^2 - c^2)/2ab
Here's what the ICE tree looks like...
*note I had the to use ArcCos to get the right answer*
Last I worked out the Area of my triangle using Herons Formula.
This formula has two parts to it, the first being:
(s = (a+b+c)/2 which gets half of the perimeter, and then
area=√( s(s-a)(s-b)(s-c) ) which uses the value s to work out the area.
Here's what those two sums look like....
Taking the ready made side lengths(A, B and C) and subtract the value s from them. Multiply those answers with the value s. Then all thats left is to get the square root of that and you have the area of the triangle.
END :D
No comments:
Post a Comment