2D reflecting a point off a circle

Nibbie
Posts: 1
Joined: 2010.11
Post: #1
I need a function to reflect off a circle at the point of impact.

Here's the basic way I want it to work:
Code:
void reflect(float AngleBetweenCircleAndPoint, float *PointMovementAngle)
{
  //calculate stuffs here
  PointMovementAngle=TheEndResult;
  return;
}
I can also use the x and y position of both the point of the circle and point as well as their speeds. Anyone?
Thanks.
Quote this message in a reply
Moderator
Posts: 437
Joined: 2002.09
Post: #2
Basic idea is to think of a line CP from the center of the circle to the point of impact P. Then compute the angle that the inbound ray makes with that line at P. Then reflect that angle around the line CP.

Sorry, I don't have code handy but this has come up on the forums before, so you should be able to get code for it that way. (Though the code examples I remember were using vector math.)

Measure twice, cut once, curse three or four times.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  When one circle is touching Miglu 5 3,141 Aug 29, 2010 08:31 AM
Last Post: AnotherJake
  Ball Bouncing in a circle strikerjax 6 5,209 Jul 6, 2009 02:39 PM
Last Post: strikerjax