Understanding Line Intersections and Reflections in Collision Detection

  • Thread starter Thread starter sundar0206
  • Start date Start date
  • Tags Tags
    Lines
AI Thread Summary
The discussion focuses on the mathematical concepts needed for collision detection involving a moving point and a line. To determine where the vector of the moving point intersects with a line, one can solve the simultaneous equations of the point's trajectory and the line's equation. The reflection of the vector upon intersection can be calculated using the angle of collision derived from the gradients of the two functions. The relationship between the line equations AX + BY + C = 0 and y = mx + c is clarified, particularly how their gradients relate to normals. Understanding that the gradients of perpendicular lines multiply to -1 is essential for finding lines that are perpendicular to one another.
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 y=x^2, to find if it intersects 3x-y-2=0 simply solve these simultaneously. i.e. substitute y=x^2 into the line equation.

Hence,
3x-(x^2)-2=0
x^2-3x+2=0
(x-2)(x-1)=0
x=1,2

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, y=1^2,2^2 Therefore the points of intersection are (1,1) and (2,4).

To find the angle at which the particle traveling along y=x^2 '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).
y=x^2
dy/dx=2x
At x=1, dy/dx=2

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

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

where m1 and m2 are the graidents and \theta is the angle of intersection.

The reflection of the vector would just be 180^o-\theta



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 ax+by+c=0 for y...
by=-ax-c

y=-\frac{a}{b}x-\frac{c}{b}[/itex]<br /> <br /> so as you can see, the gradient of y=mx+k is m, while the gradient of ax+by+c=0 is -\frac{a}{b}<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 (m_1)(m_2)=-1<br /> Basically, for 2 lines to be perpendicular, their gradients must multiply to give -1.<br /> <br /> For the general line above, <br /> ax+by+c=0<br /> <br /> y=-\frac{a}{b}x-\frac{c}{b}<br /> <br /> The gradient for the normal of this line must be m_1=\frac{-1}{m_2}<br /> <br /> So, \frac{-1}{-\frac{a}{b}}=\frac{b}{a}<br /> <br /> Hence, y=\frac{b}{a}x-\frac{c}{b}
 
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 y=mx+k_1 the normal would be y=\frac{-1}{m}x+k_2

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:
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...

Similar threads

Replies
2
Views
2K
Replies
3
Views
2K
Replies
20
Views
2K
Replies
4
Views
2K
Replies
7
Views
4K
Replies
30
Views
5K
Replies
3
Views
2K
Back
Top