/// <summary>
        /// Find the previous edge (clockwise) of the adjacent triangle. [rprev(abc) -> b**]
        /// </summary>
        public void Rprev(ref Otri ot)
        {
            //Sym(ref ot);
            ot.tri    = tri.neighbors[orient].tri;
            ot.orient = tri.neighbors[orient].orient;

            //ot.LprevSelf();
            ot.orient = minus1Mod3[ot.orient];

            //ot.SymSelf();
            int tmp = ot.orient;

            ot.orient = ot.tri.neighbors[tmp].orient;
            ot.tri    = ot.tri.neighbors[tmp].tri;
        }
        /// <summary>
        /// Find the next edge (counterclockwise) of the adjacent triangle. [rnext(abc) -> *a*]
        /// </summary>
        public void Rnext(ref Otri ot)
        {
            //Sym(ref ot);
            ot.tri    = tri.neighbors[orient].tri;
            ot.orient = tri.neighbors[orient].orient;

            //ot.LnextSelf();
            ot.orient = plus1Mod3[ot.orient];

            //ot.SymSelf();
            int tmp = ot.orient;

            ot.orient = ot.tri.neighbors[tmp].orient;
            ot.tri    = ot.tri.neighbors[tmp].tri;
        }
        // The following primitives are all described by Guibas and Stolfi.
        // However, Guibas and Stolfi use an edge-based data structure,
        // whereas I use a triangle-based data structure.
        //
        // lnext: finds the next edge (counterclockwise) of a triangle.
        //
        // onext: spins counterclockwise around a vertex; that is, it finds
        // the next edge with the same origin in the counterclockwise direction. This
        // edge is part of a different triangle.
        //
        // oprev: spins clockwise around a vertex; that is, it finds the
        // next edge with the same origin in the clockwise direction.  This edge is
        // part of a different triangle.
        //
        // dnext: spins counterclockwise around a vertex; that is, it finds
        // the next edge with the same destination in the counterclockwise direction.
        // This edge is part of a different triangle.
        //
        // dprev: spins clockwise around a vertex; that is, it finds the
        // next edge with the same destination in the clockwise direction. This edge
        // is part of a different triangle.
        //
        // rnext: moves one edge counterclockwise about the adjacent
        // triangle. (It's best understood by reading Guibas and Stolfi. It
        // involves changing triangles twice.)
        //
        // rprev: moves one edge clockwise about the adjacent triangle.
        // (It's best understood by reading Guibas and Stolfi.  It involves
        // changing triangles twice.)

        /// <summary>
        /// Find the abutting triangle; same edge. [sym(abc) -> ba*]
        /// </summary>
        /// Note that the edge direction is necessarily reversed, because the handle specified
        /// by an oriented triangle is directed counterclockwise around the triangle.
        /// </remarks>
        public void Sym(ref Otri ot)
        {
            ot.tri    = tri.neighbors[orient].tri;
            ot.orient = tri.neighbors[orient].orient;
        }
 /// <summary>
 /// Test for equality of oriented triangles.
 /// </summary>
 public bool Equals(Otri ot)
 {
     return((tri == ot.tri) && (orient == ot.orient));
 }
 /// <summary>
 /// Copy an oriented triangle.
 /// </summary>
 public void Copy(ref Otri ot)
 {
     ot.tri    = tri;
     ot.orient = orient;
 }
 /// <summary>
 /// Find the previous edge (clockwise) of a triangle. [lprev(abc) -> cab]
 /// </summary>
 public void Lprev(ref Otri ot)
 {
     ot.tri    = tri;
     ot.orient = minus1Mod3[orient];
 }
 /// <summary>
 /// Find the next edge (counterclockwise) of a triangle. [lnext(abc) -> bca]
 /// </summary>
 public void Lnext(ref Otri ot)
 {
     ot.tri    = tri;
     ot.orient = plus1Mod3[orient];
 }
 /// <summary>
 /// Finds a triangle abutting a subsegment.
 /// </summary>
 internal void Pivot(ref Otri ot)
 {
     ot = seg.triangles[orient];
 }