View Full Version : point from angle and length
Thorn444 11-04-2009, 08:36 PM Hi
I try find way how i can find point in Point2 space if i got angle and length. I got for example point a = [0,0] b=[1,0] and i want find where is it c [?,?]. I got also angle which is 45 degree and distance from a to c is 1 . In general i need function which count on which position is c :) Thanks for any help.
|
|
denisT
11-04-2009, 09:56 PM
http://www.cgafaq.info/wiki/2D_Point_Rotation
and it'll be good for you to check http://forums.cgsociety.org/showthread.php?f=98&t=295257
on this forum...
Thorn444
11-05-2009, 08:35 AM
Hi thanks DenisT for your help but i already read all threads in this forum and of course that one which you linked me was first but which i have checked i really didn't find answear to my question or i am just not so good in math . But that your first link to wiki page looks like what i am looking for. So just for sure my function will be counted from :
x' = x cos - y sin
y' = y cos - x cos
so once again when i have a = [0,0] b = [1,0] c = [?,?] angle between a and c is 45 degree and distance is 1 how will be look that final function with these numbers :)? Thanks
Neuro69
11-05-2009, 11:05 AM
Not entirely sure what you are doing, but:
len=10 --length to new point
rot=eulerangles 0 0 45 --angle to rotate
new_vector=[len,0,0] --a vector of the required length, along the positive x-axis
new_point=new_vector*(rot as quat) --new point
Thorn444
11-05-2009, 12:23 PM
Hi
Yea that's. This is what i am looking for . It's looks so easy now when i can see final result but i spent two days find way how i can find that point. Thanks mate.
Neuro69
11-05-2009, 12:52 PM
Possibly more elegant:
len=10
the_angle=45
new_point=[cos the_angle, sin the_angle, 0]*len
no rotation, just sin/cos.
CGTalk Moderation
11-05-2009, 12:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.