Holiday notice: Cycling '74 will be closed Monday, Jan 15. Manual authorization, support cases, and manual order processing will be delayed.

Jun 20 2007 | 11:44 pm

Hi List

I have four points [x,y] on a plane and I need to be able to determine if they are in a line at any angle. I
know that they are in line if all of the x values are equal, or if all of the y values are equal. I do not know
what math to use to check otherwise. Is this a vector problem? trig?

Any hints are appreciated.

Thanks
David

Need personalized email and website? Look no further. It's easy
with Doteasy $0 Web Hosting! Learn more at www.doteasy.com

- Jun 20 2007 | 11:55 pmOne way you could do this is calculate the normal to the plane that is created by three points. Pick one point, this will be your origin. Now pick two points and draw a line from them to your origin, this should form a plane. Now take your fourth point and create a vector from the origin, call this the vector x. Now you can calcualte the angle between the plane and x, if it is zero then you know all points are in line on the axis the plane resides on.Anthony----- Original Message ----- From: David Morneau Date: Wednesday, June 20, 2007 6:46 pm Subject: [maxmsp] math question> Hi List > > I have four points [x,y] on a plane and I need to be able to > determine if they are in a line at any angle. I > know that they are in line if all of the x values are equal, or if > all of the y values are equal. I do not know > what math to use to check otherwise. Is this a vector problem? trig? > > Any hints are appreciated. > > Thanks > David > > > > Need personalized email and website? Look no further. It's easy > with Doteasy $0 Web Hosting! Learn more at www.doteasy.com >
- Jun 21 2007 | 12:26 amI may have been a bit vague in my explanation. Take a look at this... http://www.geocities.com/SiliconValley/2151/math3d.html Once you have calculated the normal to the plane, I think you can take the dot product of the normal with your remaining point(vector), that should give you the angle between the two.Anthony----- Original Message ----- From: apalomba@austin.rr.com Date: Wednesday, June 20, 2007 6:57 pm Subject: Re: [maxmsp] math question To: maxmsp@cycling74.com, david@5of4.com> One way you could do this is calculate the normal to the plane > that is created by three points. Pick one point, this will be your > origin. Now pick two points and draw a line from them to your > origin, > this > should form a plane. Now take your fourth point and create > a vector from the origin, call this the vector x. Now > you can calcualte the angle between the plane and x, > if it is zero then you know all points are in line on the axis > the plane resides on. > > > > > Anthony > > > ----- Original Message ----- > From: David Morneau > Date: Wednesday, June 20, 2007 6:46 pm > Subject: [maxmsp] math question > > > Hi List > > > > I have four points [x,y] on a plane and I need to be able to > > determine if they are in a line at any angle. I > > know that they are in line if all of the x values are equal, or > if > > all of the y values are equal. I do not know > > what math to use to check otherwise. Is this a vector problem? trig? > > > > Any hints are appreciated. > > > > Thanks > > David > > > > > > > > Need personalized email and website? Look no further. It's easy > > with Doteasy $0 Web Hosting! Learn more at www.doteasy.com > > >
- Jun 21 2007 | 12:41 amYou want to look at slopes i.e.(y1-y0)/(x1-x0)if these are the same for all points, then they are colinear.wesOn 6/20/07, apalomba@austin.rr.com wrote: > I may have been a bit vague in my explanation. Take a look > at this... http://www.geocities.com/SiliconValley/2151/math3d.html > Once you have calculated the normal to the plane, I think you > can take the dot product of the normal with your remaining > point(vector), that should give you the angle between the two. > > > Anthony > > > ----- Original Message ----- > From: apalomba@austin.rr.com > Date: Wednesday, June 20, 2007 6:57 pm > Subject: Re: [maxmsp] math question > To: maxmsp@cycling74.com, david@5of4.com > > > One way you could do this is calculate the normal to the plane > > that is created by three points. Pick one point, this will be your > > origin. Now pick two points and draw a line from them to your > > origin, > > this > > should form a plane. Now take your fourth point and create > > a vector from the origin, call this the vector x. Now > > you can calcualte the angle between the plane and x, > > if it is zero then you know all points are in line on the axis > > the plane resides on. > > > > > > > > > > Anthony > > > > > > ----- Original Message ----- > > From: David Morneau > > Date: Wednesday, June 20, 2007 6:46 pm > > Subject: [maxmsp] math question > > > > > Hi List > > > > > > I have four points [x,y] on a plane and I need to be able to > > > determine if they are in a line at any angle. I > > > know that they are in line if all of the x values are equal, or > > if > > > all of the y values are equal. I do not know > > > what math to use to check otherwise. Is this a vector problem? trig? > > > > > > Any hints are appreciated. > > > > > > Thanks > > > David > > > > > > > > > > > > Need personalized email and website? Look no further. It's easy > > > with Doteasy $0 Web Hosting! Learn more at www.doteasy.com > > > > > >
- Jun 21 2007 | 12:39 pmTake 2 points. If they are not at the same place, determine the equation of the line they define (for instance of the form x + a.y + b = 0, the 2 points give you a system of 2 equations that you solve to find a and b). Then check if your 3rd and 4th points satisfy the equation. JF.> Hi List > > I have four points [x,y] on a plane and I need to be able to determine if they > are in a line at any angle. I > know that they are in line if all of the x values are equal, or if all of the > y values are equal. I do not know > what math to use to check otherwise. Is this a vector problem? trig? > > Any hints are appreciated. > > Thanks > David
- Jun 21 2007 | 12:42 pmCheck out the CGA FAQ, subject 1.03, http://www.exaflop.org/docs/cgafaq/.Good old FAQs.-- PaulP.S. Here's the text: Subject 1.03: How do I find intersections of 2 2D line segments?This problem can be extremely easy or extremely difficult depends on your applications. If all you want is the intersection point, the following should work:Let A,B,C,D be 2-space position vectors. Then the directed line segments AB & CD are given by:AB=A+r(B-A), r in [0,1] CD=C+s(D-C), s in [0,1]If AB & CD intersect, thenA+r(B-A)=C+s(D-C), orAx+r(Bx-Ax)=Cx+s(Dx-Cx) Ay+r(By-Ay)=Cy+s(Dy-Cy) for some r,s in [0,1]Solving the above for r and s yields(Ay-Cy)(Dx-Cx)-(Ax-Cx)(Dy-Cy) r = ----------------------------- (eqn 1) (Bx-Ax)(Dy-Cy)-(By-Ay)(Dx-Cx)(Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay) s = ----------------------------- (eqn 2) (Bx-Ax)(Dy-Cy)-(By-Ay)(Dx-Cx)Let P be the position vector of the intersection point, thenP=A+r(B-A) orPx=Ax+r(Bx-Ax) Py=Ay+r(By-Ay)By examining the values of r & s, you can also determine some other limiting conditions:If 0 r1 or s1 line segments do not intersect-If the denominator in eqn 1 is zero, AB & CD are parallel-If the numerator in eqn 1 is also zero, AB & CD are coincidentIf the intersection point of the 2 lines are needed (lines in this context mean infinite lines) regardless whether the two line segments intersect, then-If r>1, P is located on extension of AB -If r -If s>1, P is located on extension of CD -If sAlso note that the denominators of eqn 1 & 2 are identical.References:[O'Rourke]pp. 249-51 [Gems III] pp. 199-202 "Faster Line Segment Intersection,"On 6/20/07, Wesley Smith wrote: > You want to look at slopes i.e. > > (y1-y0)/(x1-x0) > > if these are the same for all points, then they are colinear. > > wes > > On 6/20/07, apalomba@austin.rr.com wrote: > > I may have been a bit vague in my explanation. Take a look > > at this... http://www.geocities.com/SiliconValley/2151/math3d.html > > Once you have calculated the normal to the plane, I think you > > can take the dot product of the normal with your remaining > > point(vector), that should give you the angle between the two. > > > > > > Anthony > > > > > > ----- Original Message ----- > > From: apalomba@austin.rr.com > > Date: Wednesday, June 20, 2007 6:57 pm > > Subject: Re: [maxmsp] math question > > To: maxmsp@cycling74.com, david@5of4.com > > > > > One way you could do this is calculate the normal to the plane > > > that is created by three points. Pick one point, this will be your > > > origin. Now pick two points and draw a line from them to your > > > origin, > > > this > > > should form a plane. Now take your fourth point and create > > > a vector from the origin, call this the vector x. Now > > > you can calcualte the angle between the plane and x, > > > if it is zero then you know all points are in line on the axis > > > the plane resides on. > > > > > > > > > > > > > > > Anthony > > > > > > > > > ----- Original Message ----- > > > From: David Morneau > > > Date: Wednesday, June 20, 2007 6:46 pm > > > Subject: [maxmsp] math question > > > > > > > Hi List > > > > > > > > I have four points [x,y] on a plane and I need to be able to > > > > determine if they are in a line at any angle. I > > > > know that they are in line if all of the x values are equal, or > > > if > > > > all of the y values are equal. I do not know > > > > what math to use to check otherwise. Is this a vector problem? trig? > > > > > > > > Any hints are appreciated. > > > > > > > > Thanks > > > > David > > > > > > > > > > > > > > > > Need personalized email and website? Look no further. It's easy > > > > with Doteasy $0 Web Hosting! Learn more at www.doteasy.com > > > > > > > > > >-- ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| -----
- Jun 21 2007 | 1:44 pm...or you can use some of the test object from the pmpd library : http://www.maxobjects.com/?v=libraries&id_library=81 (pmpd.tLine2D, pmpd.tSeg2D, pmpd.tSquare2D... will be your friends) send it your point position, and the cordinates of the line, segment or square to test.Mathieuwww.maxobjects.com http://mathieu.chamagne.free.fr
- Jun 21 2007 | 1:59 pmThanks for all of the suggestions. I ended up calculating slopes and comparing, it works great and was easy to implement.This whole thing makes me wish I'd paid more attention in my math classes instead of complaining that I would never need this stuff since I'm in music... oh well.DavidNeed personalized email and website? Look no further. It's easy with Doteasy $0 Web Hosting! Learn more at www.doteasy.com