Understanding Line Intersections and Reflections in Collision Detection

  • Context: Undergrad 
  • Thread starter Thread starter sundar0206
  • Start date Start date
  • Tags Tags
    Lines
Click For Summary

Discussion Overview

The discussion revolves around a collision detection algorithm involving the intersection of a moving point's vector with a line. Participants explore mathematical concepts related to line equations, reflections, and normals, while addressing various questions about the underlying geometry and calculus involved in these processes.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant seeks assistance in determining where a moving point's vector intersects with a line and how to reflect the vector upon intersection.
  • Another participant suggests that to find intersections, one can solve the equations of the moving point and the line simultaneously, providing an example with specific equations.
  • There is a discussion on finding the angle of intersection by calculating the gradients of the tangent and the line, using calculus.
  • Participants discuss the relationship between the line equations in the forms AX + BY + C = 0 and y = mx + c, particularly in terms of their gradients.
  • One participant explains how to find a line perpendicular to another by using the relationship that the product of their gradients must equal -1.
  • Another participant expresses gratitude for the explanations but seeks further clarification on the relationship between line equations and their normals.
  • A later reply reiterates that the gradients of a line and its normal multiply to -1, providing a formula for the normal line's equation.

Areas of Agreement / Disagreement

Participants generally agree on the mathematical relationships between lines, their normals, and the methods for finding intersections. However, there remains some uncertainty regarding the specifics of these relationships and the application of the concepts, as indicated by requests for further clarification.

Contextual Notes

Some participants express confusion regarding the relationship between line equations and normals, indicating potential gaps in understanding or assumptions that are not fully articulated. The discussion includes various mathematical steps that may depend on specific definitions or contexts that are not resolved.

sundar0206
Messages
9
Reaction score
0
I have been coming across a very very basic mathematics problem and still can't get my head around it. Should admit not the best to really talk maths to but I need the following

I am doing a collision detection algorithm..

For this I have a point that moves .I got the position of the point. But then here is the problem.

How do i really find where the vector in which the point moves intersect with a line...

If It intersects I need to reflect the vector..

Would be really nice to help me out in this issue..

Also can someone explain to me how the equation of the line AX+BY+C = 0 y=mx+c and the normals related ...

Also how does one fine a line perpendicular to another..

Well too many question and very unordered. Sorry about that . Jus typed all the questions on my mind

Regards
 
Mathematics news on Phys.org
sundar0206 said:
For this I have a point that moves .I got the position of the point. But then here is the problem.

How do i really find where the vector in which the point moves intersect with a line...

If It intersects I need to reflect the vector..
I haven't studied vectors in great detail, so I'm finding it hard to understand exactly what you're saying here, however, I will give it a shot and hopefully it'll be along the lines (no pun intended) of what you're looking for.

If a point is moving along a plane, defined by some function y=f(x), it will intersect the line ax+by+c=0 if and only if there are real solutions for x (and thus y also) that satisfies both functions.

e.g. particle moves along [itex]y=x^2[/itex], to find if it intersects [itex]3x-y-2=0[/itex] simply solve these simultaneously. i.e. substitute [itex]y=x^2[/itex] into the line equation.

Hence,
[tex]3x-(x^2)-2=0[/tex]
[tex]x^2-3x+2=0[/tex]
[tex](x-2)(x-1)=0[/tex]
[tex]x=1,2[/tex]

So the intersections are at x=1 and x=2. Finding the y-value, sub these x-values back into one of the functions. So, [itex]y=1^2,2^2[/itex] Therefore the points of intersection are (1,1) and (2,4).

To find the angle at which the particle traveling along [itex]y=x^2[/itex] 'collided' with the line, find the gradient of the tangent at the point of collision and the gradient of the line by the use of calculus.

Lets just take the point (1,1).
[tex]y=x^2[/tex]
[tex]dy/dx=2x[/tex]
At x=1, [itex]dy/dx=2[/itex]

So the gradient is 2 while the gradient of the line is... [itex]y=3x-2[/itex] comparing to y=mx+b where m is the gradient, hence, 3.

Now use the formula [tex]tan(\theta) =\frac{tan(m_1)-tan(m_2)}{1-tan(m_1)tan(m_2)}[/tex]

where m1 and m2 are the graidents and [itex]\theta[/itex] is the angle of intersection.

The reflection of the vector would just be [itex]180^o-\theta[/itex]



Also can someone explain to me how the equation of the line AX+BY+C = 0 y=mx+c and the normals related ...
If you re-arrange and solve [itex]ax+by+c=0[/itex] for y...
[tex]by=-ax-c[/tex]

[tex]y=-\frac{a}{b}x-\frac{c}{b}[/itex]<br /> <br /> so as you can see, the gradient of [itex]y=mx+k[/itex] is m, while the gradient of [itex]ax+by+c=0[/itex] is [tex]-\frac{a}{b}[/tex]<br /> <br /> <blockquote data-attributes="" data-quote="" data-source="" class="bbCodeBlock bbCodeBlock--expandable bbCodeBlock--quote js-expandWatch"> <div class="bbCodeBlock-content"> <div class="bbCodeBlock-expandContent js-expandContent "> Also how does one fine a line perpendicular to another.. </div> </div> </blockquote>First find the gradient of one line by calculus or, better yet, doing it the way just above. Then use the formula [itex](m_1)(m_2)=-1[/itex]<br /> Basically, for 2 lines to be perpendicular, their gradients must multiply to give -1.<br /> <br /> For the general line above, <br /> [tex]ax+by+c=0[/tex]<br /> <br /> [tex]y=-\frac{a}{b}x-\frac{c}{b}[/tex]<br /> <br /> The gradient for the normal of this line must be [tex]m_1=\frac{-1}{m_2}[/tex]<br /> <br /> So, [tex]\frac{-1}{-\frac{a}{b}}=\frac{b}{a}[/tex]<br /> <br /> Hence, [tex]y=\frac{b}{a}x-\frac{c}{b}[/tex][/tex]
 
Thanks for that post . I really appreciate the time you have taken to reply to my quesiton...

I understand how ax+by+c and y=mx+c are related. But then How is this related to the normals of the line..Is this somethin I have missed or not understoond
 
Hmm...

The only actual relationship one can give between any line and its normal is that their gradients multiply to -1

So if you have a line [itex]y=mx+k_1[/itex] the normal would be [itex]y=\frac{-1}{m}x+k_2[/itex]

I'm not sure what else there is to say. If you're still unsatisfied, please, try and elaborate your problem a little further and I'm sure you'll get more help :smile:
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
6K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K