Returns true if vector (x2, y2) is clockwise of (x1, y1) in (ox, oy) centered
coordinate.
@param ox
@param oy
@param x1
@param y1
@param x2
@param y2
@return
330387
public static final boolean isClockwise(double ox, double oy, double x1, double y1, double x2, double y2)
    {
        return isClockwise(x1-ox, y1-oy, x2-ox, y2-oy);
    }
434408
def normal
      vec1 = self.vertices[1] - self.vertices[0]
      vec2 = self.vertices[2] - self.vertices[0]
      return (vec1.cross(vec2).normalize)
    end
57956
private int edgeAngleCompare_(/* const */Edge edge1, /* const */Edge edge2) {
		if (edge1.equals(edge2))
			return 0;

		Point2D v1 = edge1.m_segment._getTangent(edge1.getReversed() ? 1.0
				: 0.0);
		if (edge1.getReversed())
			v1.negate();
		Point2D v2 = edge2.m_segment._getTangent(edge2.getReversed() ? 1.0
				: 0.0);
		if (edge2.getReversed())
			v2.negate();

		int q1 = v1._getQuarter();
		int q2 = v2._getQuarter();

		if (q2 == q1) {
			double cross = v1.crossProduct(v2);
			double crossError = 4 * NumberUtils.doubleEps()
					* (Math.abs(v2.x * v1.y) + Math.abs(v2.y * v1.x));
			if (Math.abs(cross) <= crossError) {
				cross--; // To avoid warning of "this line has no effect" from
							// cross = cross.
				cross++;
			}
			assert (Math.abs(cross) > crossError);
			return cross < 0 ? 1 : (cross > 0 ? -1 : 0);
		} else {
			return q1 < q2 ? -1 : 1;
		}
	}
656891
def same_position?(pos1, pos2)
      return unless pos1 && pos2
      pos1.line == pos2.line && pos1.offset == pos2.offset
    end
1363952
def same_direction?(rhs)
      Util3D.check_arg_type(Vector3, rhs)
      return false if(!parallel?(rhs))
      return false if(self.dot(rhs) < self.tolerance)
      return true
    end
721390
public boolean almostParallel(SquareNode a , int sideA , SquareNode b , int sideB ) {
		double selected = acuteAngle(a,sideA,b,sideB);

		if( selected > parallelThreshold )
			return false;

		// see if the two sides are about parallel too
//		double left = acuteAngle(a,add(sideA,-1),b,add(sideB,1));
//		double right = acuteAngle(a,add(sideA,1),b,add(sideB,-1));
//
//		if( left > selected+parallelThreshold || right > selected+parallelThreshold )
//			return false;


//		if( selected >  acuteAngle(a,sideA,b,add(sideB,1)) || selected >  acuteAngle(a,sideA,b,add(sideB,-1)) )
//			return false;
//
//		if( selected >  acuteAngle(a,add(sideA,1),b,sideB) || selected >  acuteAngle(a,add(sideA,-1),b,sideB) )
//			return false;

		return true;
	}
497855
private boolean isClockwise(Point center, Point a, Point b) {
        double cross = (a.x - center.x) * (b.y - center.y) - (b.x - center.x) * (a.y - center.y);
        return cross > 0;
    }
654769
public static boolean isInside(Circle circle, double x, double y)
    {
        return distanceFromCenter(circle, x, y) < circle.getRadius();
    }
122132
public static boolean intersects(Bbox one, Bbox two) {
		if (two.getX() > one.getMaxX()) {
			return false;
		}
		if (two.getY() > one.getMaxY()) {
			return false;
		}
		if (two.getMaxX() < one.getX()) {
			return false;
		}
		if (two.getMaxY() < one.getY()) {
			return false;
		}
		return true;
	}
756723
public boolean eq(IntIntSortedVector other) {
        // This is slow, but correct.
        IntIntSortedVector v1 = IntIntSortedVector.getWithNoZeroValues(this);
        IntIntSortedVector v2 = IntIntSortedVector.getWithNoZeroValues(other);
                
        if (v2.size() != v1.size()) {
            return false;
        }

        for (IntIntEntry ve : v1) {
            if (!Primitives.equals(ve.get(), v2.get(ve.index()))) {
                return false;
            }
        }
        for (IntIntEntry ve : v2) {
            if (!Primitives.equals(ve.get(), v1.get(ve.index()))) {
                return false;
            }
        }
        return true;
    }
1348995
public Matrix4x3d rotateAround(Quaterniondc quat, double ox, double oy, double oz, Matrix4x3d dest) {
        if ((properties & PROPERTY_IDENTITY) != 0)
            return rotationAround(quat, ox, oy, oz);
        return rotateAroundAffine(quat, ox, oy, oz, dest);
    }
981842
public static final boolean isInside(int x, int y, Rect box) {
        return (box.x < x && x < box.x + box.w && box.y < y && y < box.y + box.h);
    }
1089903
public boolean intersect(Line other, boolean limit, Vector2f result) {
		float dx1 = end.getX() - start.getX();
		float dx2 = other.end.getX() - other.start.getX();
		float dy1 = end.getY() - start.getY();
		float dy2 = other.end.getY() - other.start.getY();
		float denom = (dy2 * dx1) - (dx2 * dy1);

		if (denom == 0) {
			return false;
		}

		float ua = (dx2 * (start.getY() - other.start.getY()))
				- (dy2 * (start.getX() - other.start.getX()));
		ua /= denom;
		float ub = (dx1 * (start.getY() - other.start.getY()))
				- (dy1 * (start.getX() - other.start.getX()));
		ub /= denom;

		if ((limit) && ((ua < 0) || (ua > 1) || (ub < 0) || (ub > 1))) {
			return false;
		}

		float u = ua;

		float ix = start.getX() + (u * (end.getX() - start.getX()));
		float iy = start.getY() + (u * (end.getY() - start.getY()));

		result.set(ix, iy);
		return true;
	}
1270714
public boolean areInSameAxis(int tId1, int tId2) {
		if (tId1==tId2) return true;

		if (axisAngles== null) calcRotAxesAndAngles();

		if (getAxisFoldType(tId1)==1 && getAxisFoldType(tId2)==1) return true;

		// we can't deal yet with improper rotations: we return false whenever either of them is improper
		if (getAxisFoldType(tId1)<0 || getAxisFoldType(tId2)<0) return false;

		Vector3d axis1 = new Vector3d(axisAngles[tId1].x, axisAngles[tId1].y, axisAngles[tId1].z);
		Vector3d axis2 = new Vector3d(axisAngles[tId2].x, axisAngles[tId2].y, axisAngles[tId2].z);

		// TODO revise: we might need to consider that the 2 are in same direction but opposite senses
		// the method is not used at the moment anyway
		if (deltaComp(axis1.angle(axis2), 0.0, DELTA)) return true;

		return false;
	}
116405
def is_clockwise(vertices):
    
    it = iterator.consecutive(cycle(vertices), 3)
    clockwise = 0
    counter = 0
    for _ in range(len(vertices)):
        p0, p1, p2 = next(it)
        cross = cross_product(p1, p2, p0)
        int_angle = interior_angle(p0, p2, p1)  # raises ValueError
        if cross < 0:
            clockwise += int_angle
            counter += 2 * pi - int_angle
        else:
            clockwise += 2 * pi - int_angle
            counter += int_angle
    if round(clockwise / pi) == len(vertices) - 2:
        return True
    elif round(counter / pi) == len(vertices) - 2:
        return False
    else:
        raise ValueError("the polygon is complex or overlapped")
878971
public static Coordinate vectorIntersection(Coordinate p1, Vector3D v1, Coordinate p2, Vector3D v2) {
        double delta;
        Coordinate i = null;
        // Cramer's rule for compute intersection of two planes
        delta = v1.getX() * (-v2.getY()) - (-v1.getY()) * v2.getX();
        if (delta != 0) {
            double k = ((p2.x - p1.x) * (-v2.getY()) - (p2.y - p1.y) * (-v2.getX())) / delta;
            // Fix precision problem with big decimal
            i = new Coordinate(p1.x + k * v1.getX(), p1.y + k * v1.getY(), p1.z + k * v1.getZ());
            if(new LineSegment(p1, new Coordinate(p1.x + v1.getX(), p1.y + v1.getY())).projectionFactor(i) < 0 ||
                    new LineSegment(p2, new Coordinate(p2.x + v2.getX(), p2.y + v2.getY())).projectionFactor(i) < 0) {
                return null;
            }
        }
        return i;
    }
146232
private boolean isScrollingHorizontal(float x1, float y1, float x2, float y2) {
        float deltaX = x2 - x1;
        float deltaY = y2 - y1;

        if (Math.abs(deltaX) > mTouchSlop &&
                Math.abs(deltaX) > Math.abs(deltaY)) {

            return true;
        }

        return false;
    }