Jump to content
  • Advertisement
Sign in to follow this  
Integer1984

Point on line

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Not sure whether this isn't homework. So for now I will reply something vague.

The representation of your line is "the line that goes through these 2 points". However, there are other representations, too. One other representation is "all points of the space that lie on the line" would help you, since the point of interest has to be one of all those points to fulfil the condition. The mentioned representation is named a ray. A ray has a parameter, and you have to compute whether a value of the parameter can be found so that the ray hits the point of interest. An approach to compute the ray representation would be to express the linear hull of the 2 given points and to isolate the weighting parameter.

Share this post


Link to post
Share on other sites
For example you can use the most intuitive algebraic way to check this this:

Algebraic way:
==============
you have two points P1=(x1,y1,z1), P2=(x2,y2,z2).

to create a line L(t) from P1->P2

L(t) = P1(1-t) + P2*t

When t=1 then L(t) = P2 and when t=0 L(t) = P1. Since L(t) is a linear function it must be a line through P1 and P2 in R^3.

Now we want to check if it "intersect" P3=(x3,y3,z3).

To do this we simple solve the equation in _t_: P3 = P1(1-t)+P2*t, it has exactly one solution in t if P3 is on the line, and zero if P3 is not on the line.




Share this post


Link to post
Share on other sites
It is not a homework. I am working in ARX and solve that problem with drawing a line between two points and checked if point is on line.

AcGeLine3d myLine (pointBefore, pointAfther);
if(myLine.isOn(pointToCheck)) return true;
else
return false;

I was just curius how to mathematical check that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!