0025936: Reusable data structure for 2D tesselation (3- and 4-nodal mesh)
[occt.git] / src / Poly / Poly.cdl
CommitLineData
b311480e 1-- Created on: 1995-03-06
2-- Created by: Laurent PAINNOT
3-- Copyright (c) 1995-1999 Matra Datavision
973c2be1 4-- Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5--
973c2be1 6-- This file is part of Open CASCADE Technology software library.
b311480e 7--
d5f74e42 8-- This library is free software; you can redistribute it and/or modify it under
9-- the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10-- by the Free Software Foundation, with special exception defined in the file
11-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12-- distribution for complete text of the license and disclaimer of any warranty.
b311480e 13--
973c2be1 14-- Alternatively, this file may be used under the terms of Open CASCADE
15-- commercial license or contractual agreement.
7fd59977 16
4952a30a 17package Poly
7fd59977 18
19 ---Purpose: This package provides classes and services to
20 -- handle :
4952a30a 21 --
7fd59977 22 -- * 3D triangular polyhedrons.
4952a30a 23 --
7fd59977 24 -- * 3D polygons.
4952a30a 25 --
7fd59977 26 -- * 2D polygon.
4952a30a 27 --
7fd59977 28 -- * Tools to dump, save and restore those objects.
29
30uses
31
32 MMgt,
33 TCollection,
34 TColStd,
35 gp,
4952a30a 36 TColgp,
7fd59977 37 TShort
38
39is
40
41 class Triangle;
7fd59977 42
43 class Array1OfTriangle
44 instantiates Array1 from TCollection(Triangle from Poly);
4952a30a 45
7fd59977 46 class HArray1OfTriangle
47 instantiates HArray1 from TCollection(Triangle from Poly,
48 Array1OfTriangle from Poly);
49
6c1f47fd 50 imported transient class Triangulation;
51 imported transient class Mesh;
52 imported Element;
7fd59977 53
54 class Polygon3D;
7fd59977 55
56 class Polygon2D;
7fd59977 57
58 class PolygonOnTriangulation;
7fd59977 59
4952a30a 60 --
7fd59977 61 -- Tools to use triangulations
4952a30a 62 --
63
7fd59977 64 class Connect;
65 ---Purpose: Computes and stores the link from nodes to
66 -- triangles and from triangles to neighbouring
67 -- triangles.
68 -- This tool is obsolete, replaced by Poly_CoherentTriangulation
69
70 --
71 -- Data types for the Coherent Triangulation data model
72 --
73 imported CogerentTriangulation;
74 imported CoherentTriangle;
75 imported CoherentNode;
76 imported CoherentLink;
77 imported CoherentTriPtr;
78 imported ListOfTriangulation;
79
80 imported MakeLoops;
81 ---Purpose: Algorithm to make minimal loops in a graph
82
83 --
84 -- Package methods
4952a30a 85 --
86
7fd59977 87 Catenate (lstTri: ListOfTriangulation from Poly)
88 returns Triangulation from Poly;
89 ---Purpose: Join several triangulations to one new triangulation object.
90 -- The new triangulation is just a mechanical sum of input
91 -- triangulations, without node sharing. UV coordinates are
92 -- dropped in the result.
93
94 Write(T : Triangulation from Poly;
95 OS : in out OStream;
96 Compact : Boolean = Standard_True);
4952a30a 97
7fd59977 98 ---Purpose: Writes the content of the triangulation <T> on the
99 -- stream <OS>. If <Compact> is true this is a "save"
100 -- format intended to be read back with the Read
101 -- method. If compact is False it is a "Dump" format
102 -- intended to be informative.
103
104 Write(P : Polygon3D from Poly;
105 OS : in out OStream;
106 Compact : Boolean = Standard_True);
4952a30a 107
7fd59977 108 ---Purpose: Writes the content of the 3D polygon <P> on the
109 -- stream <OS>. If <Compact> is true this is a "save"
110 -- format intended to be read back with the Read
111 -- method. If compact is False it is a "Dump" format
112 -- intended to be informative.
113
114 Write(P : Polygon2D from Poly;
115 OS : in out OStream;
116 Compact : Boolean = Standard_True);
4952a30a 117
7fd59977 118 ---Purpose: Writes the content of the 2D polygon <P> on the
119 -- stream <OS>. If <Compact> is true this is a "save"
120 -- format intended to be read back with the Read
121 -- method. If compact is False it is a "Dump" format
122 -- intended to be informative.
123
124
125 Dump(T : Triangulation from Poly;
126 OS : in out OStream);
127 ---Purpose: Dumps the triangulation. This is a call to the
128 -- previous method with Comapct set to False.
4952a30a 129
7fd59977 130 Dump(P : Polygon3D from Poly;
131 OS : in out OStream);
132 ---Purpose: Dumps the 3D polygon. This is a call to the
133 -- previous method with Comapct set to False.
4952a30a 134
7fd59977 135 Dump(P : Polygon2D from Poly;
136 OS : in out OStream);
137 ---Purpose: Dumps the 2D polygon. This is a call to the
138 -- previous method with Comapct set to False.
4952a30a 139
7fd59977 140
141 ReadTriangulation(IS : in out IStream)
142 returns Triangulation from Poly;
143 ---Purpose: Reads a triangulation from the stream <IS>.
4952a30a 144
7fd59977 145 ReadPolygon3D(IS : in out IStream)
146 returns Polygon3D from Poly;
147 ---Purpose: Reads a 3d polygon from the stream <IS>.
4952a30a 148
7fd59977 149 ReadPolygon2D(IS : in out IStream)
150 returns Polygon2D from Poly;
151 ---Purpose: Reads a 2D polygon from the stream <IS>.
152
153 ComputeNormals(Tri : Triangulation from Poly);
4952a30a 154 ---Purpose: Compute node normals for face triangulation
7fd59977 155 -- as mean normal of surrounding triangles
4952a30a 156
157 PointOnTriangle(P1, P2, P3, P: XY from gp; UV: out XY from gp)
158 returns Real;
159 ---Purpose: Computes parameters of the point P on triangle
160 -- defined by points P1, P2, and P3, in 2d.
161 -- The parameters U and V are defined so that
162 -- P = P1 + U * (P2 - P1) + V * (P3 - P1),
163 -- with U >= 0, V >= 0, U + V <= 1.
164 -- If P is located outside of triangle, or triangle
165 -- is degenerated, the returned parameters correspond
166 -- to closest point, and returned value is square of
167 -- the distance from original point to triangle (0 if
168 -- point is inside).
169
7fd59977 170end Poly;