Results 1 to 3 of 3

Math Help - find the coordinates of 12 points of intersection

  1. #1
    Newbie
    Joined
    Oct 2012
    From
    united kingdom
    Posts
    3

    find the coordinates of 12 points of intersection

    Hello
    i hope everyone is doing fine
    I have a homework for c++,which needs a mathematical solution first,that i found it difficult to find :/...
    we have 3 points,each point is emitting 2 lines,we have to find the coordinates of the 12 points of intersection.
    (we don't have any value.. the coordinate can be used as (x,y) (x',y') , as for angles, alfa beta gama..
    I will really appreciate your help!!
    Thanks you in advanced!
    evening!find the coordinates of 12 points of intersection-asd.jpg
    Last edited by blueberry94; March 22nd 2013 at 02:06 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Oct 2012
    From
    united kingdom
    Posts
    3

    Re: find the coordinates of 12 points of intersection

    What about starting to find the points of intersection of 2 lines?
    y=mx+b ,with m the slope =tan of what angle ? :/
    i just need the method literary. No numerical values.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member
    Joined
    Dec 2012
    From
    Athens, OH, USA
    Posts
    613
    Thanks
    249

    Re: find the coordinates of 12 points of intersection

    Hi,

    You really weren't very precise in your specification of the problem. First given, 3 points and 2 lines passing through each of the points there are a priori 15 possible points of intersection of the lines. Subtracting the 3 intersections of the given points, you get a maximum of 12 additional intersections. There could be 0 additional intersections; for example if the two lines passing through each point are the sides of a triangle. Next, where does the data come from? User input, read from a file, randomly generated? Since you didn't specify, I'll make up the form of the data.

    Any line has equation of the form Ax+By+C=0. Given that a point (x1,y1) is a point on the line, you need an additional point (x2,y2) to specify the line. So I would define a class Line with (private) members x1,y1,x2,y2 all doubles with a constructor which has parameters for the values of these members. Also I would have members A,B and C the coefficients of the equation of the line. Your constructor should set the value of these coefficients:
    A=y1-y2, B=x2-x1 and C=x1*y2-y1*x2.

    Also I would have a method of class Line:
    int intersect(const Line& L, Point* p);
    This method returns false if the Line L is parallel to this line. Otherwise it returns true and the Point p is set to the intersection of the lines. The lines are parallel iff det=A*L.B-B*L.A==0 (you may want to say the lines are parallel if det is very small in magnitude; problems with round off error using doubles really have to be addressed).
    Assuming the lines are not parallel,
    p->x=(-C*L.B+B*L.C)/det and p->y=(-A*L.C+C*L.A)/det

    Next I would have an array allLines of Lines with the x1,y1 fields of allLines[0] the same as the x1,y1 fields of allLines[1], etc. Also an array allIntersections of Points. Generalizing your situation to n points and 2*n lines, the intersection computation could go something like:

    intersections=0;
    for (i=0;i<2*n-2;i+=2) {
    for (j=i+2;j<n;j++) {
    if (allLines[i].intersect(allLines[j],&allIntersections[intersections]) {
    intersections++;
    }
    if (allLines[i+1].intersect(allLines[j],&allIntersections[intersections]) {
    intersections++;
    }
    }
    }

    I hope this helps. Sorry, this editor ignores indentation so the code fragment may be a little hard to read.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. triangulation
    Posted in the Advanced Math Topics Forum
    Replies: 0
    Last Post: December 12th 2009, 07:00 PM
  2. Triangulation
    Posted in the Discrete Math Forum
    Replies: 0
    Last Post: December 11th 2009, 09:37 PM
  3. Triangulation of a Torus
    Posted in the Differential Geometry Forum
    Replies: 1
    Last Post: September 25th 2009, 05:35 AM
  4. Triangulation on the sphere!!
    Posted in the Geometry Forum
    Replies: 0
    Last Post: July 17th 2009, 05:02 AM
  5. triangulation of a surface
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: November 23rd 2005, 12:58 AM

Search Tags


/mathhelpforum @mathhelpforum