Forum Topic: Geometry brainfart...

(164 views • 4 replies)

This topic is 1 page long.

<< < > >>
None

Johnny

Reply To Post Reply & Quote

Posted at: 4/28/09 10:19 PM

Johnny DARK LEVEL 21

Sign-Up: 04/17/04

Posts: 4,355

Getting a random point, where the point mustreside at some point inside of a circle.

1st 2 steps... no problem.

1) Generate a random angle.
2) Generate a random distance, where the max is the radius of the circle.

Yet, I can't finish the process of getting the X and Y of the new point.
I'm not sure if I have to convert to radians, and apply sin/cos/tan (or inverses).

I feel like a retard.
Thanks!

All sites currently down. Deal with it. <3

BBS Signature

None

El-Presidente

Reply To Post Reply & Quote

Posted at: 4/28/09 10:27 PM

El-Presidente LIGHT LEVEL 27

Sign-Up: 06/02/05

Posts: 5,170

x = distance * Math.cos(radians)
y = distance * Math.sin(radians)

Hypothetically, it doesn't matter if it's in radians or degrees, because it will always be within the domain of sin and cos. And the distance is the radius.

MY E-PENIS IS BIGGER THAN YOURS
8=================================>
...and this is my fag...

BBS Signature

Misunderstood

RobertJ

Reply To Post Reply & Quote

Posted at: 4/28/09 10:58 PM

RobertJ FAB LEVEL 07

Sign-Up: 01/05/09

Posts: 245

I feel like a retard.
Thanks!

YOU feel like retard? I don't even know trigonometry yet. :(

mmm.

BBS Signature

None

DawnOfDusk

Reply To Post Reply & Quote

Posted at: 4/28/09 11:14 PM

DawnOfDusk EVIL LEVEL 14

Sign-Up: 02/22/08

Posts: 1,488

At 4/28/09 10:27 PM, El-Presidente wrote: x = distance * Math.cos(radians)
y = distance * Math.sin(radians)

Hypothetically, it doesn't matter if it's in radians or degrees, because it will always be within the domain of sin and cos. And the distance is the radius.

Another note: Since I'm a mega h8r of radians, I also find myself converting shit from radians to degrees.... it's really just as simple as...

( ValueInRadians * 180 ) / Math.Pi = ValueInDegrees
--and vice versa--
( ValueInDegrees * Math.Pi ) / 180 = ValueInRadians

:: AS2: Main :: AS3: Main :: C++: Main :: I speak German =3

BBS Signature

None

Johnny

Reply To Post Reply & Quote

Posted at: 4/28/09 11:26 PM

Johnny DARK LEVEL 21

Sign-Up: 04/17/04

Posts: 4,355

At 4/28/09 11:14 PM, DawnOfDusk wrote: Another note: Since I'm a mega h8r of radians, I also find myself converting shit from radians to degrees.... it's really just as simple as...

( ValueInRadians * 180 ) / Math.Pi = ValueInDegrees

Yeah, I've done a bunch of work with angular velocity (x+= Math.sin(angle)*speed)... but for the life of me couldn't figure out how to plot a simple point inside a circle.

Thanks Elly-P. Figured it was something simple.

All sites currently down. Deal with it. <3

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 03:17 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!