2 -- Created: Mon Mar 6 09:38:50 1995
3 -- Author: Laurent PAINNOT
5 ---Copyright: Matra Datavision 1995
11 ---Purpose: This package provides classes and services to
14 -- * 3D triangular polyhedrons.
20 -- * Tools to dump, save and restore those objects.
34 ---Purpose: A triangle is a triplet of integers (indices of
37 class Array1OfTriangle
38 instantiates Array1 from TCollection(Triangle from Poly);
40 class HArray1OfTriangle
41 instantiates HArray1 from TCollection(Triangle from Poly,
42 Array1OfTriangle from Poly);
45 ---Purpose: A Triangulation is a 3D polyhedron made of
46 -- triangles. It is made of a nodes which are
47 -- indexed. Nodes have a 3d value and a 2d value.
48 -- Triangles are triplet of node indices.
50 -- This is a Transient class.
54 ---Purpose: A Polygon3D is made of indexed nodes.
55 -- Nodes have a 3d value.
58 ---Purpose: A Polygon2D is made of indexed nodes.
59 -- Nodes have a 2d value.
61 class PolygonOnTriangulation;
62 ---Purpose: A polygonOnTriangulation is made of node indices
63 -- referencing a triangulation.
67 -- Tools to use triangulations
71 ---Purpose: Computes and stores the link from nodes to
72 -- triangles and from triangles to neighbouring
74 -- This tool is obsolete, replaced by Poly_CoherentTriangulation
77 -- Data types for the Coherent Triangulation data model
79 imported CogerentTriangulation;
80 imported CoherentTriangle;
81 imported CoherentNode;
82 imported CoherentLink;
83 imported CoherentTriPtr;
84 imported ListOfTriangulation;
87 ---Purpose: Algorithm to make minimal loops in a graph
93 Catenate (lstTri: ListOfTriangulation from Poly)
94 returns Triangulation from Poly;
95 ---Purpose: Join several triangulations to one new triangulation object.
96 -- The new triangulation is just a mechanical sum of input
97 -- triangulations, without node sharing. UV coordinates are
98 -- dropped in the result.
100 Write(T : Triangulation from Poly;
102 Compact : Boolean = Standard_True);
104 ---Purpose: Writes the content of the triangulation <T> on the
105 -- stream <OS>. If <Compact> is true this is a "save"
106 -- format intended to be read back with the Read
107 -- method. If compact is False it is a "Dump" format
108 -- intended to be informative.
110 Write(P : Polygon3D from Poly;
112 Compact : Boolean = Standard_True);
114 ---Purpose: Writes the content of the 3D polygon <P> on the
115 -- stream <OS>. If <Compact> is true this is a "save"
116 -- format intended to be read back with the Read
117 -- method. If compact is False it is a "Dump" format
118 -- intended to be informative.
120 Write(P : Polygon2D from Poly;
122 Compact : Boolean = Standard_True);
124 ---Purpose: Writes the content of the 2D polygon <P> on the
125 -- stream <OS>. If <Compact> is true this is a "save"
126 -- format intended to be read back with the Read
127 -- method. If compact is False it is a "Dump" format
128 -- intended to be informative.
131 Dump(T : Triangulation from Poly;
132 OS : in out OStream);
133 ---Purpose: Dumps the triangulation. This is a call to the
134 -- previous method with Comapct set to False.
136 Dump(P : Polygon3D from Poly;
137 OS : in out OStream);
138 ---Purpose: Dumps the 3D polygon. This is a call to the
139 -- previous method with Comapct set to False.
141 Dump(P : Polygon2D from Poly;
142 OS : in out OStream);
143 ---Purpose: Dumps the 2D polygon. This is a call to the
144 -- previous method with Comapct set to False.
147 ReadTriangulation(IS : in out IStream)
148 returns Triangulation from Poly;
149 ---Purpose: Reads a triangulation from the stream <IS>.
151 ReadPolygon3D(IS : in out IStream)
152 returns Polygon3D from Poly;
153 ---Purpose: Reads a 3d polygon from the stream <IS>.
155 ReadPolygon2D(IS : in out IStream)
156 returns Polygon2D from Poly;
157 ---Purpose: Reads a 2D polygon from the stream <IS>.
159 ComputeNormals(Tri : Triangulation from Poly);
160 ---Purpose: Compute node normals for face triangulation
161 -- as mean normal of surrounding triangles
163 PointOnTriangle(P1, P2, P3, P: XY from gp; UV: out XY from gp)
165 ---Purpose: Computes parameters of the point P on triangle
166 -- defined by points P1, P2, and P3, in 2d.
167 -- The parameters U and V are defined so that
168 -- P = P1 + U * (P2 - P1) + V * (P3 - P1),
169 -- with U >= 0, V >= 0, U + V <= 1.
170 -- If P is located outside of triangle, or triangle
171 -- is degenerated, the returned parameters correspond
172 -- to closest point, and returned value is square of
173 -- the distance from original point to triangle (0 if