public boolean isParallel(Vector2D v) { return 0.0 == RobustDeterminant.signOfDet2x2(x, y, v.x, v.y); }
private void testLineSegment(Coordinate p, LineSegment seg) { double xInt; // x intersection of segment with ray double x1; // translated coordinates double y1; double x2; double y2; /* * Test if segment crosses ray from test point in positive x direction. */ Coordinate p1 = seg.p0; Coordinate p2 = seg.p1; x1 = p1.x - p.x; y1 = p1.y - p.y; x2 = p2.x - p.x; y2 = p2.y - p.y; if (((y1 > 0) && (y2 <= 0)) || ((y2 > 0) && (y1 <= 0))) { /* * segment straddles x axis, so compute intersection. */ xInt = RobustDeterminant.signOfDet2x2(x1, y1, x2, y2) / (y2 - y1); //xsave = xInt; /* * crosses ray if strictly positive intersection. */ if (0.0 < xInt) { crossings++; } } }
double dx2 = q.x - p2.x; double dy2 = q.y - p2.y; return signOfDet2x2(dx1, dy1, dx2, dy2);
double xIntSign = RobustDeterminant.signOfDet2x2(x1, y1, x2, y2); if (xIntSign == 0.0) { isPointOnSegment = true;
public boolean isParallel(Vector2D v) { return 0.0 == RobustDeterminant.signOfDet2x2(x, y, v.x, v.y); }
private void testLineSegment(Coordinate p, LineSegment seg) { double xInt; // x intersection of segment with ray double x1; // translated coordinates double y1; double x2; double y2; /* * Test if segment crosses ray from test point in positive x direction. */ Coordinate p1 = seg.p0; Coordinate p2 = seg.p1; x1 = p1.x - p.x; y1 = p1.y - p.y; x2 = p2.x - p.x; y2 = p2.y - p.y; if (((y1 > 0) && (y2 <= 0)) || ((y2 > 0) && (y1 <= 0))) { /* * segment straddles x axis, so compute intersection. */ xInt = RobustDeterminant.signOfDet2x2(x1, y1, x2, y2) / (y2 - y1); //xsave = xInt; /* * crosses ray if strictly positive intersection. */ if (0.0 < xInt) { crossings++; } } }
double dx2 = q.x - p2.x; double dy2 = q.y - p2.y; return signOfDet2x2(dx1, dy1, dx2, dy2);
double xIntSign = RobustDeterminant.signOfDet2x2(x1, y1, x2, y2); if (xIntSign == 0.0) { isPointOnSegment = true;
public static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q) { // travelling along p1->p2, turn counter clockwise to get to q return 1, // travelling along p1->p2, turn clockwise to get to q return -1, // p1, p2 and q are colinear return 0. double p1x = cs.getOrdinate(p1, 0); double p1y = cs.getOrdinate(p1, 1); double p2x = cs.getOrdinate(p2, 0); double p2y = cs.getOrdinate(p2, 1); double qx = cs.getOrdinate(q, 0); double qy = cs.getOrdinate(q, 1); double dx1 = p2x - p1x; double dy1 = p2y - p1y; double dx2 = qx - p2x; double dy2 = qy - p2y; return RobustDeterminant.signOfDet2x2(dx1, dy1, dx2, dy2); }
public static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q) { // travelling along p1->p2, turn counter clockwise to get to q return 1, // travelling along p1->p2, turn clockwise to get to q return -1, // p1, p2 and q are colinear return 0. double p1x = cs.getOrdinate(p1, 0); double p1y = cs.getOrdinate(p1, 1); double p2x = cs.getOrdinate(p2, 0); double p2y = cs.getOrdinate(p2, 1); double qx = cs.getOrdinate(q, 0); double qy = cs.getOrdinate(q, 1); double dx1 = p2x - p1x; double dy1 = p2y - p1y; double dx2 = qx - p2x; double dy2 = qy - p2y; return RobustDeterminant.signOfDet2x2(dx1, dy1, dx2, dy2); }
public static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q) { // travelling along p1->p2, turn counter clockwise to get to q return 1, // travelling along p1->p2, turn clockwise to get to q return -1, // p1, p2 and q are colinear return 0. double p1x = cs.getOrdinate(p1, 0); double p1y = cs.getOrdinate(p1, 1); double p2x = cs.getOrdinate(p2, 0); double p2y = cs.getOrdinate(p2, 1); double qx = cs.getOrdinate(q, 0); double qy = cs.getOrdinate(q, 1); double dx1 = p2x - p1x; double dy1 = p2y - p1y; double dx2 = qx - p2x; double dy2 = qy - p2y; return RobustDeterminant.signOfDet2x2(dx1, dy1, dx2, dy2); }
public static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q) { // travelling along p1->p2, turn counter clockwise to get to q return 1, // travelling along p1->p2, turn clockwise to get to q return -1, // p1, p2 and q are colinear return 0. double p1x = cs.getOrdinate(p1, 0); double p1y = cs.getOrdinate(p1, 1); double p2x = cs.getOrdinate(p2, 0); double p2y = cs.getOrdinate(p2, 1); double qx = cs.getOrdinate(q, 0); double qy = cs.getOrdinate(q, 1); double dx1 = p2x - p1x; double dy1 = p2y - p1y; double dx2 = qx - p2x; double dy2 = qy - p2y; return RobustDeterminant.signOfDet2x2(dx1, dy1, dx2, dy2); }