View Full Version: More geometry talk...

lassie >>Discussions >>More geometry talk...


<< Prev | Next >>

bigmac- 01-18-2008
More geometry talk...
Well, all that talk of geometry in the Lassie thread is all well and good and my logic is sound; however I've got one equation that isn't factoring out. I can't get the Rule of Sine to prove. And I don't just mean in some complicated script that might have other errors; I can't get the postulate to prove, PERIOD. I swear I must be crazy. The Sine Rule of geometry states that a/sinA = b/sinB = c/sinC, right? So lets set up a dirt simple scenario involving a right triangle with 90, 45, and 45 degree angles. Given the Sine Rule, all of the final values below should come out to be the same... However, they're not. Does anyone have enough math background to spot something I may be doing wrong? Students, this is your chance to prove that your parents aren't throwing money away on your education :D Thanks! // POINTS of triangle var pa:Point = new Point(0, 0); var pb:Point = new Point(0, 100); var pc:Point = new Point(100, 0); // SIDES of triangle var a:Number = Point.distance(pb, pc); // 141.4214 var b:Number = Point.distance(pa, pc); // 100 var c:Number = Point.distance(pa, pb); // 100 // ANGLES of triangle var aa:Number = 90; var ab:Number = 45; var ac:Number = 45; // RULE OF SINE trace(a/Math.sin(aa)); // 158.1900268707236 trace(b/Math.sin(ab)); // 117.5221363135749 trace(c/Math.sin(ac)); // 117.5221363135749

bigmac- 01-18-2008

ARG. I'm stupid. My co-worker pointed out that the sine inputs needed to be in angle radians, not degrees. I knew that, but never took it into account. So... here's the error: // ANGLES of triangle var aa:Number = Math.PI / 2; var ab:Number = Math.PI / 4; var ac:Number = Math.PI / 4; // RULE OF SINE trace(a/Math.sin(aa)); // 141.4213562373095 trace(b/Math.sin(ab)); // 141.4213562373095 trace(c/Math.sin(ac)); // 141.4213562373095

fatbuoy1- 01-18-2008

You know, if they started pointing out that this stuff was relevant to making GAMES, and gave us problems based on that, I reckon I would've found maths more interesting in school.

Shofixti- 01-18-2008

... This thread has my brain hurting.

NigeC- 01-18-2008

Ignorance is bliss mate :lol: I second what your saying fatbuoy1.. even if they mentioned its uses in sport, ie snooker, billards etc Goes back to the twiddling wires and makes a swan

SeanCyrusTowel- 01-19-2008

I was going to say that maybe it's all set in radians and not degrees..... but it seems it's supposed to be the reverse of what I thought it should be :-)

bigmac- 01-20-2008

You know, if they started pointing out that this stuff was relevant to making GAMES, and gave us problems based on that, I reckon I would've found maths more interesting in school. Yes indeed... It was Flash games that got me back into geometry and made me wish I'd paid better attention in school. It's amazing how interesting this stuff is once you have a practical use for it. I always just skated by in high school math, and it wasn't that I was bad with math, it's just that I wasn't interested in meaningless numbers. The first round of the Lassie walkable area script hooked me. I wrote it in Director lingo and was amazed by how math and geometry could be applied in programming... also the power of AI logic. Here, let me find it... Ah yes. From "A Beginner's Guide To Pathfinding Algorithms": http://ai-depot.com/Tutorial/PathFinding.html - Assume S is start and G is goal - create a list P - add the start node S, to P giving it one element - Until first path of P ends with G, or P is empty --- extract the first path from P --- extend first path one step to all neighbors creating X new paths --- reject all paths with loops ------ for all paths that end at a node that has already been reached, keep only the shor-*test*-('"). --- add each remaining new path to P - Sort all paths by total underestimate, shor-*test*-('") first. - If G found -> success. Else -> failure. And that right there is the entire Lassie walkable area system (in a nut shell)

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.