RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-15 Thread Merrill, Jason
>>> I'd stick to using Heron's rule -- there is no reason why >>it shouldn't >>> work given correct inputs, and it is less expensive computationally. Yeah, but then by switching, I'd be insulting the other Mathematician dude who invented divide by 4 equation, just for the sake of pleasing Heron.

RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-15 Thread Danny Kodicek
> I'd stick to using Heron's rule -- there is no reason why it > shouldn't work given correct inputs, and it is less expensive > computationally. Without doing the maths, I suspect that eliminating the sin/cos from the two formulas will probably produce Heron's formula in any case. Danny ___

Re: RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Jordan Snyder
nal Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: 14 décembre 2006 14:06 To: Flashcoders mailing list Subject: RE: [Flashcoders] Area of a triangle using perimiter values only Thanks - all, yes Jake saw it first and others chimed in with the same thought,

RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Alain Rousseau
06 To: Flashcoders mailing list Subject: RE: [Flashcoders] Area of a triangle using perimiter values only Thanks - all, yes Jake saw it first and others chimed in with the same thought, my numbers did not compute because they did not make a triangle. I have it working now. The formula is fine, and

RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Merrill, Jason
Thanks - all, yes Jake saw it first and others chimed in with the same thought, my numbers did not compute because they did not make a triangle. I have it working now. The formula is fine, and this function works for me as long as the values come from a true triangle: public static fun

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread T. Michael Keesey
On 12/14/06, T. Michael Keesey <[EMAIL PROTECTED]> wrote: Heron's formula looks pretty simple: Actually, this does return "NaN" for some numbers, but it's pretty simple to realize why. For example, it returns "NaN" if you input side lengths of 1, 2, 4. Why? Well, you try building a triangle wit

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread T. Michael Keesey
Heron's formula looks pretty simple: function triangleArea(a:Number, b:Number, c:Number):Number { // Check that all arguments are positive and finite. if (!(a > 0) || !(b > 0) || !(c > 0) || !isFinite(a) || !isFinite(b) || !isFinite(c)) { throw new Error("Invalid argument(s) for tria

Re: Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Jordan Snyder
Jason, It must be true that your inputs are incorrect, BUT to answer your question about distributive methods - I was just thinking about condensing that formula. If you did that(and they do it in the next step on the MathWorld link) then you have to multiply every term in parens by every other

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Iv
Hello Jason, public function getTriangleArea (a:Number, b:Number, c:Number):Number { var p:Number = (a+b+c)/2; return Math.sqrt(p*(p-a)*(p-b)*(p-c)); } -- Ivan Dembicki __ [EMAIL PROTECTED] | http://www.artlebedev.ru | http:/

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Nex Ninek
I'd stick to using Heron's rule -- there is no reason why it shouldn't work given correct inputs, and it is less expensive computationally. On 12/14/06, Danny Kodicek <[EMAIL PROTECTED]> wrote: > I'm trying to figure the area of a triangle in Actionscript > using the perimeter values only, not

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Nex Ninek
Negative result of ((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)) is not possible if a,b, and c are lengths of a triangle's sides. The first term will always be obviously positive, and so will the other three terms -- they are simply the sum of the lengths of two sides less the third side, and you can't hav

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Jake Prime
Hi Jason If the number is coming out negative the most likely reason is that the numbers you are supplying do not make a triangle. (e.g. two sides are length 1 each and the third is 2 or more). I've tested your code and it does produce positive numbers for all valid triangles I've tried. Jake O

RE: Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Pete Miller
ailing list >> Subject: Re: Re: [Flashcoders] Area of a triangle using perimiter values >> only >> >> I recind half of what I said after actually thinking about it, but >> maybe it's a different perspective ;) >> >> >> On 12/14/06, Jordan Snyde

Re: Re: Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Jordan Snyder
ALL RIGHT I'm a silly billy. I used your code and it works just fine. Maybe the problem isn't in this function. I'm using Flash 8/AS2. Cheers On 12/14/06, Jordan Snyder <[EMAIL PROTECTED]> wrote: I recind half of what I said after actually thinking about it, but maybe it's a different persp

RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Merrill, Jason
ss >>-Original Message- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On Behalf >>Of Jordan Snyder >>Sent: Thursday, December 14, 2006 11:27 AM >>To: Flashcoders mailing list >>Subject: Re: [Flashcoders] Area of a triangle usi

RE: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Danny Kodicek
> I'm trying to figure the area of a triangle in Actionscript > using the perimeter values only, not the traditional simple formula: > > area = (height/2)*base Try: area = 1/2 * a * b * sin(C), where C is the angle between the two sides a and b. You can calculate C using the cosine rule: c

Re: Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Jordan Snyder
I recind half of what I said after actually thinking about it, but maybe it's a different perspective ;) On 12/14/06, Jordan Snyder <[EMAIL PROTECTED]> wrote: To dodge your question, couldn't you just use the simple distance forumula to determine the base even when it's not horizontal? I dont'

Re: [Flashcoders] Area of a triangle using perimiter values only

2006-12-14 Thread Jordan Snyder
To dodge your question, couldn't you just use the simple distance forumula to determine the base even when it's not horizontal? I dont' know much about your application or if you'll have the points where the triangle's points lie, but that's just an idea. Oh, but I just thought of something from