INTERFACE Map;

IMPORT Oct, Color;

TYPE 
  Arc = Oct.Arc;
  Edge <: PublicEdge;
  PublicEdge = Oct.Edge OBJECT
    METHODS
      init(order: CARDINAL): Edge;
        (* 
          Initializes "self" and hangs from it a new unglued
          triangle grid of the given order. *)
    END;
     
PROCEDURE MakeEdge(order: CARDINAL): Arc;
  (* 
    Returns Arc{edge := NEW(Edge).init(order), bits := 0} *)

PROCEDURE SetPrimalProperties(
    a: Arc; 
    vertexColor: Color.T;
    vertexRadius: REAL;
    edgeColor: Color.T;
    edgeRadius: REAL;
    faceColor: Color.T;
    faceTransp: Color.T;
  );
  (*
    Sets the style properties for the grid 
    edges comprising the primal edge "a", its origin and destination,
    and the grid triangles comprising the two quarter-grids to the
    left of "a" and of "Sym(a)".  *)

PROCEDURE Corner(a: Arc): Oct.Arc;
  (* 
    The arc "c" from the triangulated grid of "a" 
    which has Org(c) = Org(a) and lies 45 degrees 
    counterclockwise from "a". 
    Updated by GluePatch, but may be 
    destroyed by DOct.Consist. *) 

PROCEDURE CCorner(a: Arc): Oct.Arc;
  (*
    The arc "c" from the triangulated patch of "a" 
    which has Org(c) = Org(a) and lies 45 degrees 
    clockwise from "a". Updated by GluePatch, but may be
    destroyed by DOct.Consist. *)

PROCEDURE Middle(a: Arc): Oct.Arc;  
  (*
    An arc from the triangulated patch of "a" 
    which is contained in "a" and lies near the center of the 
    patch. Its origin is the vertex at the center of the grid.
    Should not be affected by GluePatch or Consist if 
    order >= 3.  *)

PROCEDURE GluePatch(a: Arc);
  (*
    Glues the triangulated patch of "a" to that of "Onext(a)",
    by identifying Corner(a) (and successive arcs) with
    CCorner(Onext(a)) (and successive arcs).  

    Note that the result may have degenerate triangles (sharing 
    three vertices). *)
  
END Map.