# Normal of circle intersection point

This topic is 2376 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I am creating a simple hockey game and I am trying to figure out how to handle puck collisions with the boards. It is pretty easy with the short and long sides since each one have only one normal but I have problems with the rounded corners, each will have lots of normals.I don't know how to calculate the normal of the intersection point between the puck and the corner. How does one usually go about doing this? I appreciate any help. I do 2d line intersection tests for the short and long sides and it works well, is it possible to do something similar between a line and a circle? And then from the intersection point calculate the normal in that point?

##### Share on other sites
Say the line segment is (x1,y1)-(x2,y2) then it can be represented parametrically as
x(t) = x1*t + (1-t)*x2
y(t) = y1*t + (1-t)*y2
each corner is the arc of a circle, let the corner circle we want to test be
(x - cx)^2 + (y - cy)^2 = r^2
where the circle has center (cx,cy) and radius r.
Plug x(t) and y(t) into the circle's equation and solve for t. Since it's quadratic you'll get two answers. Any solution where 0 <= t <= 1 is an intersection of the line segment and the circle. Use additional logic to determine if the intersection occurs in the arc of the circle that is the corner of the board.
x(t) and y(t) for a valid sloution is the point of intersection, call it (x0,y0). The normal of the circle you want then is (x0,y0)-(cx,cy) i.e. the puck should reflect relative to this line. Edited by jwezorek

Thanks a lot!

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633298
• Total Posts
3011249
• ### Who's Online (See full list)

There are no registered users currently online

×