Professional Documents
Culture Documents
6/28/09 7:01 PM
http://www.cardfaq.org/faq/maths.html
Page 1 of 8
6/28/09 7:01 PM
He was an easy reference. Another reference was my 15 year old Algebra II text book that I still kept around. Generally, I find text books fairly useless as they are designed to have a teacher supplement them, and seem to make it difficult to find important information quickly by the student (like the formulas for exams, perhaps...). But I persevered, and managed to figure it out. It was just like riding a bicycle, except I kept falling off the damn thing. Now, my handy reference that I keep nearby is, of all things, "Cliffs Quick Review - Trigonometry". Cliff notes for math. GREAT book. They also do Physics, and Geometry, and all sorts of things. Ask your favorite bookseller for details. We'll deal with a generic, 3D triangle that is not parallel with either plane that you've been able to draw. (The techniques work everywhere, of course, but if you just drew it...well...anyway). If the shape you are dealing with is NOT a triangle, then you need to break it up into triangles. If the shape is some kind of conic section (like the Enterprise Hull, but, say just a piece), then you are free to run away screaming into the night, as I'm not dealing with that here. Or, you can choose to make it into a whole bunch of triangles. But, while that may solve the problem, running away into the night is much more satisfying. Step 1: Determine the lengths of the sides of the triangles. This is easy. Pythagoreans Theorem conveniently expands from two dimensions into three dimensions. I would imagine it would even work for four dimensions, however this isn't TIME-MACHINE-L, so we'll stop there. Given two 3D points (x1, y1, z1) and (x2, y2, z2), you can find the length of the line by:
length = sqr((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2)
where sqr() is the square root. Try this at home boys and girls, it works just ducky. We will call the lengths of the triangle A,B, and C. Also, we will assume that A represents the longest of the three lines. We will also call the angles OPPOSITE the lines a,b, and c respectively.
|\ C |b\ A | \ |a_c\ B
Pardon the art, but I wanted to get the idea of opposite angles clear. Step 2: Solve for 'a'. This is a nice step, because it solves for the largest angle of the triangle, and it is unambiguous. It will reveal immediately whether the triangle is an acute ('a' less than 90 deg.), right ('a' equals 90 deg.), or obtuse ('a' greater than 90 deg.). To do do this, we will use what is known as "The law of Cosines". The LoC states:
A^2 = B^2 + C^2 - 2BC cos a
Where, as said earlier, A, B, and C are the lengths of the sides of the triangle, and 'a' is the angle opposite 'A'. This relationship holds for all of the angles, not just 'a', but I won't list those. So, going to the year before Algebra II and using Algebra I, we solve for 'cos a':
B^2 + C^2 - A^2 cos a = ----------------2BC
Once we know the cosine of 'a', we can use the what is known as the arccosine, or acos, or cos^-1. Essentially, this is the function that when given a cosine will return the number of degrees that created the cosine. Filling in the variables, and using the arccosine, we now know what the angle 'a' is for the triangle. One down, two to go. Step 2: Solve for 'b' Here, we go to the brother of the LoC into the "Law of Sines". The LoS is represented like this:
sin a sin b sin c ----- = ----- = ----A B C A B C or ----- = ----- = ----sin a sin b sin c
Basically, the ratio of the triangle leg and the sin of the opposite angle is the same for all of the legs in a triangle. Whoever thought this stuff up was pretty durn crafty. So, we will use this capability to solve for 'b'.
B sin a sin b = ------A
http://www.cardfaq.org/faq/maths.html Page 2 of 8
6/28/09 7:01 PM
Again, we will use the arcsin to find the actual angle for 'b'. Step 3: Solve for 'c'. This one is easy. We already know 'a' and 'b'. We also know that all triangles have 180 degrees in them. Therefore:
180 = a + b + c
So:
c = 180 - (a + b)
Voila'! QED even! Now, to jumpstart your heart after dealing with all of that, a few points. 1. Perhaps asking Bob about how to do it using a compass and a ruler would be a better technique :-). 2. If you have a programmable calculator, this math is real easy to do! You don't even have to know much about programming the calculator, as most are really very good at memorizing keystrokes so that you can repeat them over and over, which is what you'd like to do. IMHO, getting this done is your best bet as calculators are disgustingly handy things to have compared to a computer. 3. Finally, here are some formulas for a real simple spreadsheet that you can try. It should work with any spreadsheet program you've got, they're all pretty similiar for such simple math. I'm going to assume you know how to enter a forumala into a spreadsheet cell. We'll use nine cells.
A1 = A (as above - you'll enter these. This is your triangle) A2 = B " A3 = C " B1 = ACOS((A2^2+A3^2-A1^2)/(2*A2*A3)) B2 = ASIN(A2*SIN(B1)/A1) B3 = 3.14159-(B1+B2) C1 = B1*180/3.14159 C2 = B2*180/3.14159 C3 = B3*180/3.14159
After you've entered the final side of your triangle, you should have the degrees of the angles in the C column. Remember, these are the opposite angles. For whatever historical reason, scientists and engineers like to deal with Radians, rather than Degrees, so most computer trig functions work with Radians instead of Degrees. The B column is your answer in Radians, but none of my protractors measure these, just Degrees. So, the C column converts from Radians to Degrees for us automagically. Unless you are careful, you may have a similiar problem with your calculator. Many calculators have "modes" that tell it whether to work in Degrees or Radians, so you'll have to check your calculator manual on how to verify these modes. As a simple test, your spreadhsheet should look something like this:
| A | B | C | +-----+-----------+-----------+ 1 | 5 | 1.570796 | 90.00008 | 2 | 4 | 0.927295 | 53.13015 | 3 | 3 | 0.643498 | 36.86978 |
Basically this says that in your everyday 3-4-5 right triangle, this is your solution. Make it a point to round your degrees, its only paper you know. Sorry all for the length, but I wanted to go into detail about how the problem is solved, as knowing how to solve the problem is usually more valuable than the solution itself. Also, it would not surprise me that there is a more efficent way (there has to be in fact) of just taking the 3D Plane (a triangle in this case, but generally any 3D plane) and running the plane through a transformation that rotates it onto a plane parallel with one of the axes. The trick is figuring out which angles to rotate the plane by. This is what a programmatic solution would do, and it would work for any polygon, rather than just triangles. But, it also involves mutliplying matrices together and other ugly things. from Todd Spencer <lildog@inreach.com>: O.k. the first sentence got me! are these points,(x1, y1, z1) and (x2, y2, z2), the visual length or the actual length? hopefully not actual because that is what we are trying to find. How do I arrive at these measurements? from Will Hartung <vfr750@netcom.com>: Oh, for wish of a greasy table, hot chocolate with whipped cream, a dim flickering yellow candle, and a paper napkin with a pen. You'd get it in a nano-second with such advanced tools. Computers have been designed this way. Instead, we're stuck with e-mail. :-)
!_______ !|\ /| | | \ / | Z | X | | | / \ |
http://www.cardfaq.org/faq/maths.html
| Y |
2 ^ / \
Page 3 of 8
6/28/09 7:01 PM
Assume that everything is square on these...umm..drawings. On the top view we have shown the X and Z axes, while on the side view we have the X and Y axes. Let's derive the three points for the front panel (face) of the pyramid. (Numbered on the side view). Point 1 is easy: x:0, y:0, z:0. Point 2 is tougher: From the X-Z chart we see that X marks the spot at x:2 and z:2 From the X-Y chart we see, well, the same thing - x:2 and y:2 (It should be obvious in this case, the X coordinate has to be the same, otherwise it wouldn't be the same point.) Point 3 is x:4, y:0, z:0. See, while the line segments and angles cannot accurately be measured from the drawing, the end-points CAN be measured, as they are not distorted. So, the final coordinates for the front face are:
0,0,0 2,2,2 4,0,0
The first leg is the same as the second leg, in this case. Let's find the third (pts 3 to 1):
sqr((4-0)^2 + (0-0)^2 + (0-0)^2) = sqr(4^2) = 4
Of course, we could have measured the base, but at least the math still works (always encouraging). So, your triangle has sides of 3.46, 3.46, 4. Plugged into the spreadsheet, and you get the angles: 54.6, 54.6 and 70.6. Fudge for rounding to 55, 55, and 70 (notice that it's not 55,55,71 as the degrees have to add up to 180). There is a lot of symetry in models, so take advantage of it. No need to calculate the same numbers twice. Plus, once you know the length of a leg, you can use it for the shared panels, etc. The hot tip is to draw your views, then start filling in the blanks for the angles and lengths. Take advantage of parts that are the same on both sides of a model, but perhaps flipped over. from Todd Spencer <lildog@inreach.com>: One point... once you get the length of a sides you don't need the angles because there is only one way the sides will fit together with the given lengths. Right? from Will Hartung <vfr750@netcom.com>: Well, yes and know. Obviously a triangle defined by SSS (side, side, side) is defined and unique. Whereas there are an infinite number of triangles expressed as AAA. But, that's geometry. You're trying to actually draw these things out. If I wanted to draw an SSS triangle, I'd be hard pressed to get it right the first time with just a pencil and ruler. You really need to know SAS to draw an accurate triangle with a ruler and a protractor, and get it right the first time. [Editor's note: actually, with a straightedge and compass or dividers, it's pretty easy to draw the SSS triangle, and this is probably more accurate than trying to do it with a protractor.] Once you've got those first two legs drawn, the third is a simple closure of the triangle. But you knew that.
http://www.cardfaq.org/faq/maths.html
Page 4 of 8
6/28/09 7:01 PM
Singly curved means that the surface can be mapped to a plane without stretching or compressing. A property of singly curved surfaces is that the intersection of the surface and the tangent plane at any point is a line. The curve which is normal to all of these lines is called the 'line of stretchout' or 'arc of stretchout', a concept which is easy to explain with diagrams and a few examples, but is otherwise very difficult to describe. It's the line or curve on which the surface will 'unroll'. Examples of singly curved surfaces are cylinders and cones. Doubly curved means that the surface cannot be mapped to a plane without stretching or compressing. The canonical example is a sphere--you can't press an orange peel flat without tearing it (this is also why Greenland looks so big on many maps.) A property of doubly curved surfaces is that the intersection of the surface and the tangent plane at any point is a point. Paper models necessarily approximate doubly-curved surfaces as sets of singly-curved ones. For the Enterprise saucer, the prototype is probably doubly curved, but it's closely approximated by a set of singly curved surfaces. As I recall, it's a disk, with frustrums of cones set on top and bottom, and a little hemisphere on top. The hemisphere is challenging, but the rest is straightforward. Some vocabulary: A frustrum of a cone is a cone with the pointy bit chopped off. An annulus is a disk with the center cut out (like a washer.) Now for the equations. I'll assume you can handle a right circular cylinder alright. To form a right circular cone of height h and base diameter D, you need a flat piece shaped like a pie serving. The radius of the 'pie' is
!R = sqrt[ h^2 + (D/2)^2 ]
To form a frustrum of a right circular cone, you need a shape like a pie piece with the tip removed. For a frustrum of height h, with the top diameter d and the base diameter D, you need a section of an annulus with the outer diameter
!R = D * sqrt[ h^2/(D-d)^2 + 1/4 ]
Things get more complicated for other shapes. Right circular cylinders with one face canted are fairly straightforward, but non-circular cylinders or frustrums with canted faces involve more than just trigonometry. Also, any of this is hard to explain without pictures (I'm afraid that what's above may already be unclear without diagrams.) Spheres and domes are also complicated, because they are doubly curved shapes and must be approximated by singly curved surfaces. from Timothy A. Good <timgood@snip.net>: Frustum of cone (a.k.a. lampshade) is ((r/s) * 360) where r=3D radius of the base, s=3D true slant height of the cone (length of the sloping sides from base to where they intersect if it was a true pointy cone). Result is the included angle of the flat drawing. My mom did a lot of lampshades using this formula, tracing out designs of flowers and leaves etc. doing partial cuts and curling sections for a neat effect.
Spheres
There are at least two methods for approximating spheres, the zone method and the gore method. Here's an illustration of both (the illustration is from Basic Engineering Drawing, Turner Buck, and Ackert, The Ronald Press, New York, NY, 1950 and was provided by Kell Black <blackk@apsu01.apsu.edu>.) from Bob Bell <bobbell@portal.connect.ab.ca>: When I make domes I cheat. The first method I use is to find a similar dome in another kit then scan it into my Coreldraw programme and reduce or enlarge it to the size I want. The second "cheat" (for a clear dome such as a bubble gun turret on the Lancaster bomber) I found that clear plastic chocolate moulds, available in craft stores, come in all szes and shapes, some of which make perfect domes. To actually design a dome, which I have to do for some of my locomotives, I make it in three parts. The bottom is a cylinder, the second is a truncated cone, and the third is a flat circle. from Emil Zarkov <modelart@tusk.icn.bg>: Whatever the paper modeler does, he must approximate the double concave surfaces with surfaces that are capable of being formed without elastic deformation, i.e. flat or with single concavity. There are at least four ways to represent the sphere. 1. If you chose flat surfaces for approximation, you may start from tetrahedron, cube, octahedron, etc. and increasing the number of flat polygons, you may achieve something that approximates a sphere very well. Remember the mirror balls in the discotheques. If you use single concave surfaces you have at least 3 other choices. For two of them there is an explanation from Mr. Kell Black: 2. The zone method. 3. The gore method.
http://www.cardfaq.org/faq/maths.html Page 5 of 8
6/28/09 7:01 PM
These two methods are the most popular in the card modeling, because of the easy calculation of the theoretical shapes of the segments. Now is my turn. 4. You can make a spheroidal surface, using only one spiral segment. Please realize what happens when you peel an apple. You have spheroidal surface at the beginning and you transform it to flat surface when you finish. Now imagine that you bend the peel into its initial shape. Thus you can make not only the sphere, but also the whole spacecraft from one very, very long part. Terrible, but possible. [Editor's note: an example of Dr. Zarkov's single piece sphere design is available from Moshe Lemer's web site.] from Jeff Tupper / Pedagoguery Software Inc <tupper@peda.com>: Geodesic domes can be used to approximate hemispheres; geodesic spheres can be used to approximate spheres. Both can be made from paper (all of the faces or polygons).
Length of arcs
from Robin Day <rday@pangea.ca>: Anyone know of a method to determine the length of a curved line without having/knowing the diameters of the arcs? I would be interested in methods involving geometry formulae, Macromedia FreeHand, or Adobe Illustrator. I know most CAD software allows for measuring almost anything, but I do not have access to this type of software. I would prefer formulae if anyone has some insight.
http://www.cardfaq.org/faq/maths.html
Page 6 of 8
6/28/09 7:01 PM
from robin day <rday@pangea.ca>: FreeHand uses Bezier curves for all of its splines and does give cartesian coordinates for the curve handles. Would you happen to know if this information can be used to resolve the curve? Unfortuantely, I don't know what kind of geometry drives Bezier based curves. from Steve Brown <cardfaq@bellsouth.net>: Now you're getting specific. The Bezier curve is a cubic polynomial
!R(u) = (1-u)^3 R0 + 3u(1-u)^2 R1 + 3u^2(1-u) R2 + u^3 R3
where R0, R1, R2, R3 are the defining points and 0<=u<=1. (It can be generalized to orders other than 3 as the Bernstein-Bezier [sic] curves, and further generalized into something called B-splines, which I've never really tried to study. But the Bezier curve itself has that nice polynomial form. When several Bezier curves are concatenated into a spline, they may enforce additional constraints of continuity of the derivatives at the joining points, which may screw up all that follows.) Note that, although it's written as a bivariate polynomial (in u and 1-u) it's really just a cubic. The squared norm of the incremental length (chord) actually has a nice closed form expression in terms of the vertices of the defining polygon. Let
!P1 = R1 - R0 !P2 = R2 - R1 !P3 = R3 - R2
and
!dR/du = 3(1-u)^2 P1 + 6u(1-u) P2 + 3u^2 P3
http://www.cardfaq.org/faq/maths.html
Page 7 of 8
6/28/09 7:01 PM
where
!A = 3(1-u)^2 !B = 6u(1-u) !C = 3u^2
and this is as far as I've gotten. Note that despite the messy notation, S(u) is just a 4th order polynomial and it may be possible to do a closed form evaluation of the integral. But my bag o' tricks for integration is pretty dusty, and no clever factorizations of S(u) have occurred to me, except for some special cases. That dependence only on the lengths and angles of the defining polygon is really elegant, confirming that the length of the curve is invariant under translation. I always get a kick out of it when a lot of grungy math ends up proving something really self-evident. I confess that if I needed an answer to this tomorrow, I'd implement a numerical solution. I'm pretty sure, but haven't proved, that L is nice and smooth in all the important senses, and a numerical integration should converge nicely. A third order interpolation would probably converge very fast, but Simpson's Rule would probably be fast enough for reasonable precision. Note that I think that there is no choice of R0-R3 for which the Bezier curve is a circular arc. Back to Card Modeling FAQ Copyright 1997-2002 by Steve Brown. Copyright notice
cardfaq@bellsouth.net
http://www.cardfaq.org/faq/maths.html
Page 8 of 8