0

My problem is simple, yet I haven't been able to solve it so far. Let's say I have a line l (defined by two 3 dimensional points p1 and p2) and a point p3. All points are on the same arbitrarily oriented plane. The line has its starting point at p1 and moves torwards p2. The plane normal is arbitrary but fixed. My question is now: How can I determine whether p3 is on the left or on the right side of the line? My only idea was to calculate a signed distance of p3 to the line:

        Vector3D p1 = new Vector3D(4, 1, 0);
        Vector3D p2 = new Vector3D(2, 2, 0);
        Vector3D p3 = new Vector3D(4, 2, 0);

        double n = (p1 - p2).Cross(p1 - p3).Length();
        double d = (p3 - p2).Length();
        double dis = n/d;

But this does not help me because the distance is always positive, regardless of the position of p3.

NMO
  • 748
  • 8
  • 16
  • Hint: construct a vector that's in the plane, but perpendicular to the line, then take a dot product with that vector and look at the sign of the result. (How you decide to assign those signs to "left" and "right" is up to you ...) – Mark Dickinson Nov 09 '15 at 06:13
  • 3
    There is no sense in `left/right ` until you 1)define line direction and define positive plane normal direction or 2) state that some point in the plane is left to the line – MBo Nov 09 '15 at 06:26

0 Answers0