Re: [Flashcoders] Q:Elementary Trig part 2

2006-10-23 Thread Mark Winterhalder

On 10/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Another way of stating my problem:


Given an initial angle, and a circle with radius r, how do you determine the 
x,y coordinates of the point p1 on the circumference of this circle...assuming 
the circle's center is at 0,0.?


Just use the code I posted in reply to "Elementary Trig" (part 1). It
works for any angle, not just 120 and 240 degrees.

Your "initial angle" needs to be between (the vector) p1 and
something. That something is often (1, 0) -- one unit along the X
axis. So, use that for x1, y1 in the code I posted, and your vector
will be (x2, y2), or put differently, (Math.cos( initialAngle ),
-Math.sin( initialAngle )) if initialAngle is the angle between your
initial point and the X axis.
However, it's only one unit (one pixel) from the center, not the
radius r. You still need to scale it, simply multiply x and y by r.

In short:

x = Math.cos( angle ) * r;
y = -Math.sin( angle ) * r;

HTH,
Mark
___
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] Q:Elementary Trig part 2

2006-10-23 Thread Jayson K Hanes
Ah well.. indeed -- point is still made the same in the end I gather.
Looks like he got what he needed.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Pete Miller
> Sent: Sunday, October 22, 2006 11:52 PM
> To: Flashcoders mailing list
> Subject: RE: [Flashcoders] Q:Elementary Trig part 2
> 
> Check your algebra,
> 
> Since sin(a) = y/r, then y = r sin(a), etc.
> 
> P.
___
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] Q:Elementary Trig part 2

2006-10-22 Thread Pete Miller
Check your algebra,

Since sin(a) = y/r, then y = r sin(a), etc.

P.

>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:flashcoders-
>> [EMAIL PROTECTED] On Behalf Of Jayson K Hanes
>> Sent: Sunday, October 22, 2006 7:42 PM
>> To: Flashcoders mailing list
>> Subject: RE: [Flashcoders] Q:Elementary Trig part 2
>> 
>> Been awhile since I've explained this to anyone.. lets see how this
>> goes!
>> 
>> "SOHCAHTOA" (so-ca-toa)
>> 
>> Sin(a) = opposite/hypotenuse
>> Cos(a) = adjacent/hypotenuse
>> Tan(a) = opposite/adjacent
>> 
>> a = angle in RADIANS *not* degrees.. you'll have to convert degrees
to
>> radians with knowing:
>> 
>> ..there are PI (3.14159..) radians in 180 degrees (a fundamental),
thus:
>> a = A*(PI/180), thus:
>> a = 45*(3.14159/180) = .785 (roughly)
>> 
>> Given r and angle=A degrees converted to a radians, r is the same as
the
>> length of a basic triangles' hypotenuse in this -- we're looking for
x,y
>> .. moving on:
>> 
>> A=45 degrees but converted to a=.785 radians (approx).. we know that:
>> 
>> r=10, and should know that:
>> r=sqrt(x^2+y^2) (per Pythagoras theorem)
>> 
>> so we're going to reverse format the SOH and CAH parts since we know
the
>> length of the hypotenuse and need to find out x and y (the opposite
and
>> adjacent sides' lengths) one at a time based on angle, a in radians:
>> 
>> sin(a)=y/r, and,
>> cos(a)=x/r, which translates to:
>> 
>> y=sin(a)/r, and
>> x=cos(a)/r, however:
>> 
>> y=sin(a)/10, and
>> x=cos(a)/10, thus:
>> 
>> y=sin(.785)/10, and
>> x=cos(.785)/10, thus:
>> 
>> y=0.707/10 = 7.07 (roughly)
>> x=0.707/10 = 7.07 (roughly)
>> 
>> I think that should set you on you on track! Hope that helps :)
>> 
>> -Jayson
>> 
>> > -Original Message-
>> > From: [EMAIL PROTECTED]
[mailto:flashcoders-
>> > [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
>> > Sent: Sunday, October 22, 2006 3:11 PM
>> > To: flashcoders@chattyfig.figleaf.com
>> > Subject: [Flashcoders] Q:Elementary Trig part 2
>> >
>> > Another way of stating my problem:
>> >
>> >
>> > Given an initial angle, and a circle with radius r, how do you
>> determine
>> > the x,y coordinates of the point p1 on the circumference of this
>> > circle...assuming the circle's center is at 0,0.?
>> >
>> >
>> >
>> > [e] jbach at bitstream.ca
>> > [c] 416.668.0034
>> > [w] www.bitstream.ca
>> ___
>> 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] Q:Elementary Trig part 2

2006-10-22 Thread Jayson K Hanes
Been awhile since I've explained this to anyone.. lets see how this
goes!

"SOHCAHTOA" (so-ca-toa)

Sin(a) = opposite/hypotenuse
Cos(a) = adjacent/hypotenuse
Tan(a) = opposite/adjacent

a = angle in RADIANS *not* degrees.. you'll have to convert degrees to
radians with knowing:

..there are PI (3.14159..) radians in 180 degrees (a fundamental), thus:
a = A*(PI/180), thus:
a = 45*(3.14159/180) = .785 (roughly)

Given r and angle=A degrees converted to a radians, r is the same as the
length of a basic triangles' hypotenuse in this -- we're looking for x,y
.. moving on:

A=45 degrees but converted to a=.785 radians (approx).. we know that: 

r=10, and should know that: 
r=sqrt(x^2+y^2) (per Pythagoras theorem)

so we're going to reverse format the SOH and CAH parts since we know the
length of the hypotenuse and need to find out x and y (the opposite and
adjacent sides' lengths) one at a time based on angle, a in radians:

sin(a)=y/r, and,
cos(a)=x/r, which translates to:

y=sin(a)/r, and
x=cos(a)/r, however:

y=sin(a)/10, and
x=cos(a)/10, thus:

y=sin(.785)/10, and
x=cos(.785)/10, thus:

y=0.707/10 = 7.07 (roughly)
x=0.707/10 = 7.07 (roughly)

I think that should set you on you on track! Hope that helps :)

-Jayson

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Sent: Sunday, October 22, 2006 3:11 PM
> To: flashcoders@chattyfig.figleaf.com
> Subject: [Flashcoders] Q:Elementary Trig part 2
> 
> Another way of stating my problem:
> 
> 
> Given an initial angle, and a circle with radius r, how do you
determine
> the x,y coordinates of the point p1 on the circumference of this
> circle...assuming the circle's center is at 0,0.?
> 
> 
> 
> [e] jbach at bitstream.ca
> [c] 416.668.0034
> [w] www.bitstream.ca
___
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