with Standard_Floating_Numbers; use Standard_Floating_Numbers; with Integer_Face_Enumerators; with Floating_Face_Enumerators; package body Face_Cardinalities is function fvector ( pts : in Standard_Integer_VecVecs.VecVec ) return Vector is -- ALGORITHM : plain enumeration of vertices, edges, k-faces... use Integer_Face_Enumerators; n : constant natural := pts(pts'first).all'length; f : Vector(-1..n); procedure Count_Vertex ( i : in integer; cont : out boolean ) is begin f(0) := f(0) + 1; cont := true; end Count_Vertex; procedure Count_Vertices is new Enumerate_Vertices(Count_Vertex); procedure Count_Edge ( i,j : in integer; cont : out boolean ) is begin f(1) := f(1) + 1; cont := true; end Count_Edge; procedure Count_Edges is new Enumerate_Edges(Count_Edge); procedure Count_Face ( face : in Vector; cont : out boolean ) is begin f(face'length-1) := f(face'length-1) + 1; cont := true; end Count_Face; procedure Count_Faces is new Enumerate_Faces(Count_Face); begin f(-1) := 1; f(0..n) := (0..n => 0); Count_Vertices(pts); Count_Edges(pts); for i in 2..(n-1) loop Count_Faces(i,pts); exit when (f(i) = 0); end loop; if f(n-1) > 1 then f(n) := 1; end if; return f; end fvector; function fvector ( pts : in Standard_Floating_VecVecs.VecVec ) return Vector is -- ALGORITHM : plain enumeration of vertices, edges, k-faces... use Floating_Face_Enumerators; n : constant natural := pts(pts'first).all'length; f : Vector(-1..n); tol : constant double_float := 10.0**(-8); --10.0**(-12); procedure Count_Vertex ( i : in integer; cont : out boolean ) is begin f(0) := f(0) + 1; cont := true; end Count_Vertex; procedure Count_Vertices is new Enumerate_Vertices(Count_Vertex); procedure Count_Edge ( i,j : in integer; cont : out boolean ) is begin f(1) := f(1) + 1; cont := true; end Count_Edge; procedure Count_Edges is new Enumerate_Edges(Count_Edge); procedure Count_Face ( face : in Vector; cont : out boolean ) is begin f(face'length-1) := f(face'length-1) + 1; cont := true; end Count_Face; procedure Count_Faces is new Enumerate_Faces(Count_Face); begin f(-1) := 1; f(0..n) := (0..n => 0); Count_Vertices(pts,tol); Count_Edges(pts,tol); for i in 2..(n-1) loop Count_Faces(i,pts,tol); exit when (f(i) = 0); end loop; if f(n-1) > 1 then f(n) := 1; end if; return f; end fvector; end Face_Cardinalities;