Class S2EdgeUtil.EdgeCrosser

    • Constructor Detail

      • EdgeCrosser

        public EdgeCrosser()
        Constructs an uninitialized edge crosser. Invoke init(S2Point, S2Point) before calling the other methods.
      • EdgeCrosser

        public EdgeCrosser​(S2Point a,
                           S2Point b)
        Convenience constructor that calls init() with the given fixed edge AB.
      • EdgeCrosser

        public EdgeCrosser​(S2Point a,
                           S2Point b,
                           S2Point c)
        AB is the given fixed edge, and C is the first vertex of the vertex chain. Equivalent to using the two-arg constructor and calling restartAt(c).
    • Method Detail

      • restartAt

        public void restartAt​(S2Point c)
        Call this method when your chain 'jumps' to a new place.
      • triage

        static int triage​(S2Point ab,
                          S2Point c)
        Returns the sign of the determinant of the column matrix ABC, given the precomputed cross product AB.
      • robustCrossing

        public int robustCrossing​(S2Point d)
        This method is equivalent to calling the robustCrossing(com.google.common.geometry.S2Point) function (defined below) on the edges AB and CD. It returns +1 if there is a crossing, -1 if there is no crossing, and 0 if two points from different edges are the same. Returns 0 or -1 if either edge is degenerate. As a side effect, it saves vertex D to be used as the next vertex C.
      • robustCrossingInternal

        private int robustCrossingInternal​(S2Point d)
        Compute the actual result, and then save the current vertex D as the next vertex C, and save the orientation of the next triangle ACB (which is opposite to the current triangle BDA).
      • robustCrossingInternal2

        private int robustCrossingInternal2​(S2Point d)
      • sign

        private static int sign​(S2Point a,
                                S2Point b,
                                S2Point c,
                                S2Point aCrossB)
        Helper that checks the sign of ABC, using a precomputed cross product for AxB.