Re: [Flashcoders] flash.geom.Point Problem.

2006-11-13 Thread Ray Chuan

That means you were stupid before having that girlfriend. =p

On 11/13/06, Arse @ Snepo <[EMAIL PROTECTED]> wrote:

Having a girlfriend who knows flash makes you clever by default. :)

just sayin.

a

jim wrote:
> Thanks man, my girlfriend just pointed the same thing to me, you are both
> clever & I am stupid.
>
> Jim
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rákos Attila
> Sent: 12 November 2006 21:32
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] flash.geom.Point Problem.
>
>
> j> As you can see the first value is correct, the rest have weird values.
> Can
> j> anyone explain this to me?
>
> This is because of the precision errors of floating-point arithmetic.
> Try to round the results:
>
> import flash.geom.Point;
>
> var angles: Array = [0, 90, 180, 270, 360];
>
> for (var i = 0; i < angles.length; i++) {
> var p: Point = Point.polar(10, (angles[i] * (Math.PI/180)));
> trace("x: " + Math.round(p.x) + ", y: " + Math.round(p.y));
> }
>
>   Attila
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
> ___
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
>


--
*Anthony Eden*: Inventor at Snepo <http://www.snepo.com/>
contact | [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> | 0411 5622 02

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





--
Cheers,
Ray Chuan
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] flash.geom.Point Problem.

2006-11-12 Thread Arse @ Snepo

Having a girlfriend who knows flash makes you clever by default. :)

just sayin.

a

jim wrote:

Thanks man, my girlfriend just pointed the same thing to me, you are both
clever & I am stupid.

Jim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rákos Attila
Sent: 12 November 2006 21:32
To: Flashcoders mailing list
Subject: Re: [Flashcoders] flash.geom.Point Problem.


j> As you can see the first value is correct, the rest have weird values.
Can
j> anyone explain this to me?

This is because of the precision errors of floating-point arithmetic.
Try to round the results:

import flash.geom.Point;

var angles: Array = [0, 90, 180, 270, 360];

for (var i = 0; i < angles.length; i++) {
var p: Point = Point.polar(10, (angles[i] * (Math.PI/180)));
trace("x: " + Math.round(p.x) + ", y: " + Math.round(p.y));
}

  Attila

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

  



--
*Anthony Eden*: Inventor at Snepo <http://www.snepo.com/>
contact | [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> | 0411 5622 02

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] flash.geom.Point Problem.

2006-11-12 Thread jim
Thanks man, my girlfriend just pointed the same thing to me, you are both
clever & I am stupid.

Jim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rákos Attila
Sent: 12 November 2006 21:32
To: Flashcoders mailing list
Subject: Re: [Flashcoders] flash.geom.Point Problem.


j> As you can see the first value is correct, the rest have weird values.
Can
j> anyone explain this to me?

This is because of the precision errors of floating-point arithmetic.
Try to round the results:

import flash.geom.Point;

var angles: Array = [0, 90, 180, 270, 360];

for (var i = 0; i < angles.length; i++) {
var p: Point = Point.polar(10, (angles[i] * (Math.PI/180)));
trace("x: " + Math.round(p.x) + ", y: " + Math.round(p.y));
}

  Attila

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] flash.geom.Point Problem.

2006-11-12 Thread R�kos Attila

j> As you can see the first value is correct, the rest have weird values. Can
j> anyone explain this to me?

This is because of the precision errors of floating-point arithmetic.
Try to round the results:

import flash.geom.Point;

var angles: Array = [0, 90, 180, 270, 360];

for (var i = 0; i < angles.length; i++) {
var p: Point = Point.polar(10, (angles[i] * (Math.PI/180)));
trace("x: " + Math.round(p.x) + ", y: " + Math.round(p.y));
}

  Attila

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] flash.geom.Point Problem.

2006-11-12 Thread jim
Just a quick additional note, I looked up how to comvert the co-ords myself
and found the formula

X= R*cos(Theta)
Y= R*sin(Theta)

On this website about converting co-ords
http://www.delphiforfun.org/Programs/Math_Topics/polar-cartesian.htm .

The thing is this formula gives exactly the same un expected results. Any
help on this would be greatly appreciated.

Jim

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jim
Sent: 12 November 2006 21:15
To: 'Flashcoders mailing list'
Subject: [Flashcoders] flash.geom.Point Problem.

Hello all, 

Im using the Point class to convert polar co-ordinates to Cartesian
co-ordinates (i.e. an angle & length to an x & y co-ordinate). The built in
function Point.polar(len:Number, angle:Number) should do exactly this but I
am getting some weird values returned.

This code takes the angles 0, 90, 180, 270 & 360 with a length of 10 for
each and converts to an x & y.

[[code snippet]]
import flash.geom.Point;

trace(Point.polar(10, (0 * (Math.PI/180;
trace(Point.polar(10, (90 * (Math.PI/180;
trace(Point.polar(10, (180 * (Math.PI/180;
trace(Point.polar(10, (270 * (Math.PI/180;
trace(Point.polar(10, (360 * (Math.PI/180;

This is the output:

(x=10, y=0)
(x=6.12303176911189e-16, y=10)
(x=-10, y=1.22460635382238e-15)
(x=-1.83690953073357e-15, y=-10)
(x=10, y=-2.44921270764475e-15)

As you can see the first value is correct, the rest have weird values. Can
anyone explain this to me?

Jim

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] flash.geom.Point Problem.

2006-11-12 Thread jim
Hello all, 

Im using the Point class to convert polar co-ordinates to Cartesian
co-ordinates (i.e. an angle & length to an x & y co-ordinate). The built in
function Point.polar(len:Number, angle:Number) should do exactly this but I
am getting some weird values returned.

This code takes the angles 0, 90, 180, 270 & 360 with a length of 10 for
each and converts to an x & y.

[[code snippet]]
import flash.geom.Point;

trace(Point.polar(10, (0 * (Math.PI/180;
trace(Point.polar(10, (90 * (Math.PI/180;
trace(Point.polar(10, (180 * (Math.PI/180;
trace(Point.polar(10, (270 * (Math.PI/180;
trace(Point.polar(10, (360 * (Math.PI/180;

This is the output:

(x=10, y=0)
(x=6.12303176911189e-16, y=10)
(x=-10, y=1.22460635382238e-15)
(x=-1.83690953073357e-15, y=-10)
(x=10, y=-2.44921270764475e-15)

As you can see the first value is correct, the rest have weird values. Can
anyone explain this to me?

Jim

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com