INTERFACE CornerEnergy;
IMPORT Energy;
TYPE
  T <: Public;
  Public = Energy.T OBJECT METHODS
      init(): T;
    END;
  (*
    The "Corner" energy measures the non-uniformity of angles between 
    consecutive edges around each vertex, projected onto the tangent plane
    at that vertex.
    
    This energy is computed only for vertices "v" that exist, have
    degree three or more, and have only existing edges and faces
    incident to them.  
    
    The surface normal at "v" is computed as the average of "Cross(a,b)"
    for all consecutive neighbors "a,b" of "v".  
    
    For such pairs, the ideal angle "I" between the projections of "a-v"
    and "b-v" is "2*Pi/n" where "n" is the degreee of "v".  
    
    The energy depends on "I" and the actual projected angle "A", as
    "(1 - cos(A-I))/(cos A)^2"; which goes to infinity when "A=0" or
    "A=Pi", and is zero iff "A=I".
    
  *)
  
END CornerEnergy.