Showing posts with label area. Show all posts
Showing posts with label area. Show all posts

Friday, December 6, 2013

Volume of a Tetrahedon

In this article I give a rough outline of a derivation of the volume formula for a tetrahedron, given its four vertices.

Any set of three points in 3D are co-planar. If they are not co-linear, then they uniquely define a plane. They also uniquely define a triangle. With polygons of more than three sides/vertices, you need to specify which edges are drawn and which are not.  In a program, you might imply the edges according to the ordering of the points, but the order then is a means of indicating which edges to draw. You could not simply draw all of the possible edges and get a polygon, generally. But with a triangle, you take every pairing of points and draw an edge between them.

If you add a fourth point which is not in the same plane, you now have a tetrahedron (tretra = four)—a four sided polyhedron which is uniquely defined by four points. As in the case of the triangle, you draw an edge between every pairing of points. The number of combinations of 2 points is    
and so there are 6 edges.
A tetrahedron is a special case of a slanted pyramid. The same volume formula applies, namely,
                                                          
In order to use the formula, we must pick a face to serve as the base.  We choose the face with vertices P1, P2, and P3, in the above illustration. (It doesn't matter which ones as long as you're consistent.)  We need to calculate the area of the base and find the height of the pyramid. The height is the distance from P4 to the plane defined by the base points (the measure is taken perpendicular to the plane).

First we find the area. A well known formula for finding the area of a triangle given the length of two sides, say a and b, and the included angle, say θ,  is      
(With some minor trig you can figure this out, but if you just want to see it proved, see Area of Triangles Without Right Angles [1].) The cross-product comes in handy here since
where v and u are vectors and θ is the included angle. Thus, the area is
To find the distance from P4 to the base plane, we first find the plane. The equation of a plane can be expressed in terms of a normal vector and any point on the plane. The normal vector for our plane is
and the equation of the plane is
(This is a 3D analogue to the point-slope form of the equation of a line, albeit, it also resembles the general form.)

The height from the plane to P4 is the component of the vector (P4 – P1) which is in the direction of the normal vector, namely ([2], p. 679),

This leads to the volume formula
Sources:
  1. Math is Fun, Area of Triangles Without Right Angleshttp://www.mathsisfun.com/algebra/trig-area-triangle-without-right-angle.html
  2. Stewart, J., Calculus: Early Transcendentals, 3rd Ed., Brooks/Cole Publishing Company, 1995

Saturday, December 31, 2011

Field Measurement of Quadrilaterals Using Only a Tape Measure

Trapezoids
A common nonrectangular area that needs to me measured in the field is a trapezoid. Sometimes shapes are approximated by a trapezoid, if a rectangle is not considered a reasonable approximation or not easily visualized. The well-known formula for the area of a trapezoid is

                        clip_image002

where b1 and b2 are the lengths of the two parallel sides and h is the distance between them (measured perpendicularly to the parallel sides, of course). It is noteworthy that the (b1+b2)/2 can be interpreted as the average of the lengths of the parallel sides. This is the length of a line referred to as the median of the trapezoid. In the field, it is often more convenient/faster to measure the median and the height (h, also called the altitude) than to measure both bases and the height. If the location of the median can be “eye-balled” with sufficient precision for the purposes being met, this may increase productivity by decreasing the number of measurements needed. For more information on the trapezoid and the median, see a description here.
General Case Quadrilateral
There are (at least) two approaches to measuring the area quadrilaterals when nothing is known about the internal angles or “parallelness” of nonadjacent lines. The following diagram displays both methods.

We can determine the area of this shape by making 5 measurements and produce an exact picture, or by taking 3 measurements and getting an approximate area. Both are “area by triangles” methods.
Area by Triangles – Heron Method
If we measure the sides AB, BC, CD, DA, and one of the diagonals (either AC or BD), we can use Heron’s theorem to determine the area of the triangles on either side of the chosen diagonal. We can use the law of cosines and law of sines to determine the angles. Alternatively, a basic AutoCAD drawing using temporary construction-line circles would allow you to determine these results without manual calculations. This would give us a full description of the area. This method also generalizes well to an arbitrary number of sides (but requiring a lot of measurements--don't use this method).
Area by Triangles – By Altitude
On the other hand, we could measure the length of a diagonal (say, AC), leave the measuring tape in place (or replace with a string line) and use a second tape measure to measure from the other vertices (B and D) to the diagonal. As long as the accuracy/precision of the result desired is not too high, we can “eye-ball” perpendicular to the diagonal to get the heights of the triangles to an acceptable accuracy. The area calculation is obvious from there. This method involves fewer measurements, minimal extra equipment, and is quicker to calculate, which may make it more efficient for a quadrilateral. It does not generalize to an n-sided figure as easily as the previous method, but could be done with additional string lines used simultaneously.

Sunday, November 6, 2011

3D Analogue to the Trapezoid (part 2): Truncated Pyramid

Since I wrote the post entitled 3D Analogue to the Trapezoid, I have learned that people already have something in mind when they type in terms to this effect. They are interested in a truncated pyramid. In the aforementioned post, I described a shape, namely, an irregular triangular prism, that was analogous to a trapezoid in terms of its volume formula (the proof is located here). Now, we look at a shape that is analogous to a trapezoid in terms of its appearance, but has an only loosely analogous volume formula.


The first observation we might make is that pyramids are really not very different from cones from a volume perspective. The simple volume formula for both is given by

                                 clip_image004

where B is the area of the base and h is the height of the cone. This is true regardless of the shape of the base. The only requirement is that the same shape must continue all the way to the peak. In more technical language, the cross-section of the pyramid at distance b below the peak must be similar to the base and the corresponding linear dimensions must be in the ratio b:h. So, given a dimension of length d in the base, the corresponding dimension in the cross-section at b below the peak must have length d(b/h). This is part of the definition of a pyramid. At this point, a well-known, fancy theorem may be in order.

Theorem. Let A and B be similar (2-dimensional) shapes. Then,
Corresponding linear dimensions have a ratio of a:b if and only if the areas of A and B (or corresponding subareas) are in the ratio a2:b2.

In theorem form, this might seem like it’s from outer space, but notice how simply that works out with squares and circles. For example, if one square has a side of a and another of side b, then their areas are a2 and b2, respectively. The converse is obviously true as well, and it is the converse we will need.

Suppose we take the area of the top surface to be B1 and the area of the bottom surface to be B2. Also, take a to be the height of the part of the pyramid that has been removed and h to be the height of the truncated pyramid. Here’s a front orthographic view of the pyramid with the cut off part added back to the top:
                                     
                                   clip_image006

Our theorem then tells us that

                                         clip_image008

If we solve for a, we get

                                          clip_image010

The volume of our truncated pyramid is simply the volume of the full pyramid minus the volume of the part that has been cut off (truncated off):

                                         clip_image012
                                        clip_image014
                                        clip_image016
                                        
                                            clip_image020

It is noteworthy that we could have calculated a without calculating the areas B1 or B2. But we would need to know the ratio between a pair of corresponding sides, say d1 and d2 (see diagram below).

                                           
We would calculate a according to

                                                    clip_image024
which gives

                                                     clip_image026

Our volume formula will look a little nicer:

                                 clip_image028
                                    clip_image030
                                    clip_image032
                                    clip_image034
                                    clip_image036
                                    clip_image038
                                
                     
Letting r = d2/d1, we get


                             


The first volume formula makes somewhat of an analogy with the area formula of a trapezoid: We are taking the average (arithmetic mean) of
  1. the bottom base area,
  2. the top base area, and
  3. the geometric mean of the top and bottom areas
and multiplying by the perpendicular distance between the top and bottom areas. I must say, that’s a closer analogy than I expected before I wrote this article.

Monday, June 6, 2011

3D Analogue to the Trapezoid (part 1)

The other day I derived a volume formula that had exactly the result that you would expect if you were to take a guess at it - I didn't even think about it until after I had derived it.

A trapezoid is a quadrilateral (four sided figure) with (at least) one pair of parallel sides.  (If it has two pairs of parallel sides it is a parallelogram, though technically it is still also a trapezoid.)
 

The area, A, of a trapezoid is given by, A = 1/2(b1 + b2)h, where b1 and b2 are the parallel sides and h is the distance measured perpendicularly between the two parallel sides.  You can think of the formula in words as, “the area of a trapezoid is equal to the average of the lengths of the parallel sides multiplied by the perpendicular distance between them.”

Below is a shape that is similar in some respects, but it’s three dimensional.  Instead of two parallel lines, there are three parallel lines with lengths a, b, and c.  At the base of this solid shape is a triangle.  (It’s not important that the lines all come to a common base – the volume formula I came up with will work anyways.)  What is significant about the triangle B is that it is formed by lines which are all perpendicular to the vertical lines (a, b, c).  I don’t know what this shape is called; let’s call it an irregular triangular prism.

The volume, V, of the above shape is given by V = 1/3(a+b+c)B, where B is the area of the triangle formed by a plane perpendicular to the three parallel sides and a, b, and c are the lengths of the parallel sides.  You can think of this formula in words as, “the volume of an irregular triangular prism is equal to the average of the lengths of the three parallel sides multiplied by the perpendicular cross-sectional area.”

(See proof.  Or, see a different analogous shape in part 2.)

Sorta makes you wonder it there’s a four dimensional analogue…

Area of a Triangle Given Coordinates

There are at least 6 methods to determine the area of a triangle given the coordinates of the vertices.  Some of the methods apply to triangles only, and some are more generic.  We’ll find two clear winners for this problem (that are nearly the same), but also notice, that if we were given different information (such as lengths of sides instead of coordinates of vertices) it would change the winner.  I am focusing here on 2D coordinates.  Here's a picture of our triangle:

Heron’s Formula

Heron’s formula uses the lengths a, b, and c of the sides to determine the area of the triangle:


where



To use this formula, we must determine the lengths of the sides.  We use the Pythagorean theorem to do so:


 
 

This whole calculation involves 4 square roots, 9 multiplications, 1 division by 2, and 14 addition/subtractions.  This method is very expensive compared with the other methods.  However, if we were given the lengths of the sides and not the coordinates of the vertices, it would be less expensive than the alternative.  The alternative would require the use of trigonometric functions (law of cosines and law of sines) in order to determine the height to use the formula A = bh/2.  Trig functions are way more expensive (time-wise) than square roots.

Note that this method could be extended to work given 3D coordinates, since the Pythagorean theorem extends to 3D coordinates.  It would be a bit more expensive in 3D.

Coordinates Method

This method can be used with any polygon – it need not be a regular polygon (all sides and interior angles equal) or a triangle.  The only requirement is that none of the sides intersect.  The method is performed as follows:

clip_image002[10] clip_image004[6]
clip_image006[6] clip_image008 clip_image010 clip_image012
clip_image014 clip_image016 clip_image018 clip_image020
clip_image022 clip_image002[11] clip_image004[7] clip_image024



This method requires 6 multiplications, 1 division by 2, and 5 addition/subtractions – easily outperforming Heron’s formula when we’re given the coordinates.

Double Meridian Distance (DMD)

This is another generic method that applies in the same circumstances as the coordinates method.  It is always more efficient than using the method of coordinates.  In a spreadsheet is would look like this:

A B C D E F
1 x-coord y-coord delta y delta x DMD 2*A
2 Ax Ay =B3-B2 =A3-A2 =D2 =E2*C2
3 Bx By =B4-B3 =A4-A3 =E2+D2+D3 =E3*C3
4 Cy Cy =B5-B4 =A5-A4 =E3+D3+D4 =E4*C4
5 Ax Ay
6 =sum(F2:F4)/2

This method requires 3 multiplications, 1 division by 2, and 12 addition/subtractions.  Although we have way more addition subtraction, we have half the number of multiplications.  Since multiplication and division are way more expensive than addition and subtraction, this method is computationally superior to the method of coordinates.

The Usual Method (sorta)

You`re probably wondering why I haven`t just taken half the base times the height.  Okay wise guy, where`s the base?  How about the height?  Can we calculate them?  Yes, but are you sure you know how much work you’re in for?  You say, isn’t the area just


No, it’s not that simple.  The base must be the length of one of the sides.  The height must be measured perpendicularly from the chosen base to the vertex which is not on the base.  But we can find the area using this method if we follow it through to the bitter end.  Let’s do it.

First, we calculate the length of the base, which we will choose as side b above:


 
Now, we need to calculate the height, h, between point B and line AC (side b).  This will be nontrivial and slightly painful. 

We determine the equation of the line through A and C using the point-slope form:







We re-express this result as


where


 
 

At this point we use a formula for the distance between a point and a line that uses the equation of the line as expressed above:


Finally, we get to say “Area = bh/2,” and I hope you are satisfied!  We needed 2 square roots, 9 multiplication/divisions, and 11 addition/subtractions.  This method gives you the right answer, but there’s got to be a better way!

A Better Way

Let’s redraw our triangle with a fancy rectangular border:
Okay, it’s not that fancy, but it’s useful!  First, let’s calculate L, R, λ, and ρ. 



We can calculate the area of our triangle now:







I’ve skipped showing all of the simple expansion and simplification steps above because I’m getting tired of all that typing.  But here’s the vital statistics: 2 multiplications, 1 division by 2, and 5 addition/subtractions.

Cross Product Method

This method not only works in 3D, it requires 3D – sorta.  We’ll apply it to the 2D case here – we just augment our coordinates with zeros for the z-coordinates.  It goes like this:


 
 

The final score for this method is 2 multiplications, 1 division by 2, and 5 addition subtractions.  This method is the clear winner since it is tied with the previous method in 2D but is easily applied to 3D with an increase in cost.

Method Comparison Table
method square roots multiplication/division division by 2 addition/
subtraction
Heron’s Formula 4 9 1 14
Coordinates Method 0 6 1 5
DMDs 0 3 1 12
“Usual” Method 2 9 1 11
A Better Way 0 2 1 5
Cross Product 0 2 1 5

* Note:  I've put division by 2 in a separate category because division and multiplication by 2 can be implemented more efficiently on the computer than general case multiplication and division.