Jump to content

  • Log In with Google      Sign In   
  • Create Account

simple geomenty question...


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 jasonf   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 April 2000 - 09:03 AM

Don''t know why I can''t find this info on the web but... Give the center of a circle (x1,y1) and a source point (x2,y2) on the perimeter of the circle and a degree of separation which we will call (deg) between our source and target (x3,y3) which would also be on the perimitier of the circle - how do we find (x3,y3) if the other points are known. eg center of the circle is 0,0 first point or source is 10,10 (which would put it upper right) the deg of separation would be 22degrees what is x3,y3? anyone know of any good basic geometry primers on the net?

Sponsor:

#2 jasonf   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 April 2000 - 10:01 AM

I sent a mail to a professor of geometry and he suggested I use complex numbers to achieve my goal.

eg. c1=x1+iy1 etc.

Then rotation by deg units around the origin can be accomplished by multiplying by the complex number (cos deg + i sin deg).

so, to find c3 (Re(c3)=x3 Im(c3)=iy3)


c3=c1+(c2-c1)*(cos deg + i sin deg)


any idea how to implement complex numbers in c and then change them back to real numbers?


#3 hmarthinsen   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 April 2000 - 10:09 AM

Here''s what to do:

Theta is the angle of choice

alpha = inverse tan((y2-y1)/(x2-x1)) + theta

radius = square root((x2-x1)^2 + (y2-y1)^2)

x3 = cos(alpha) * radius + x1
y3 = sin(alpha) * radius + y1

#4 jasonf   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 April 2000 - 11:18 AM

Can anyone help me pull this off in c? The only part i cant work out is the inverse tan. do i need a new math lib?



#5 risingdragon3   Members   -  Reputation: 382

Like
Likes
Like

Posted 30 April 2000 - 11:29 AM

I''m sure that inverse sin/cos/tan is asin/acos/atan
they take the deg. in radians, so you''ll have to convert to radians before using it.
Hope that helps.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS