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 |
17 | package 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 | |
30 | uses |
31 | |
32 | MMgt, |
33 | TCollection, |
34 | TColStd, |
35 | gp, |
4952a30a |
36 | TColgp, |
7fd59977 |
37 | TShort |
38 | |
39 | is |
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 | |
50 | class Triangulation; |
7fd59977 |
51 | |
52 | class Polygon3D; |
7fd59977 |
53 | |
54 | class Polygon2D; |
7fd59977 |
55 | |
56 | class PolygonOnTriangulation; |
7fd59977 |
57 | |
4952a30a |
58 | -- |
7fd59977 |
59 | -- Tools to use triangulations |
4952a30a |
60 | -- |
61 | |
7fd59977 |
62 | class Connect; |
63 | ---Purpose: Computes and stores the link from nodes to |
64 | -- triangles and from triangles to neighbouring |
65 | -- triangles. |
66 | -- This tool is obsolete, replaced by Poly_CoherentTriangulation |
67 | |
68 | -- |
69 | -- Data types for the Coherent Triangulation data model |
70 | -- |
71 | imported CogerentTriangulation; |
72 | imported CoherentTriangle; |
73 | imported CoherentNode; |
74 | imported CoherentLink; |
75 | imported CoherentTriPtr; |
76 | imported ListOfTriangulation; |
77 | |
78 | imported MakeLoops; |
79 | ---Purpose: Algorithm to make minimal loops in a graph |
80 | |
81 | -- |
82 | -- Package methods |
4952a30a |
83 | -- |
84 | |
7fd59977 |
85 | Catenate (lstTri: ListOfTriangulation from Poly) |
86 | returns Triangulation from Poly; |
87 | ---Purpose: Join several triangulations to one new triangulation object. |
88 | -- The new triangulation is just a mechanical sum of input |
89 | -- triangulations, without node sharing. UV coordinates are |
90 | -- dropped in the result. |
91 | |
92 | Write(T : Triangulation from Poly; |
93 | OS : in out OStream; |
94 | Compact : Boolean = Standard_True); |
4952a30a |
95 | |
7fd59977 |
96 | ---Purpose: Writes the content of the triangulation <T> on the |
97 | -- stream <OS>. If <Compact> is true this is a "save" |
98 | -- format intended to be read back with the Read |
99 | -- method. If compact is False it is a "Dump" format |
100 | -- intended to be informative. |
101 | |
102 | Write(P : Polygon3D from Poly; |
103 | OS : in out OStream; |
104 | Compact : Boolean = Standard_True); |
4952a30a |
105 | |
7fd59977 |
106 | ---Purpose: Writes the content of the 3D polygon <P> on the |
107 | -- stream <OS>. If <Compact> is true this is a "save" |
108 | -- format intended to be read back with the Read |
109 | -- method. If compact is False it is a "Dump" format |
110 | -- intended to be informative. |
111 | |
112 | Write(P : Polygon2D from Poly; |
113 | OS : in out OStream; |
114 | Compact : Boolean = Standard_True); |
4952a30a |
115 | |
7fd59977 |
116 | ---Purpose: Writes the content of the 2D polygon <P> on the |
117 | -- stream <OS>. If <Compact> is true this is a "save" |
118 | -- format intended to be read back with the Read |
119 | -- method. If compact is False it is a "Dump" format |
120 | -- intended to be informative. |
121 | |
122 | |
123 | Dump(T : Triangulation from Poly; |
124 | OS : in out OStream); |
125 | ---Purpose: Dumps the triangulation. This is a call to the |
126 | -- previous method with Comapct set to False. |
4952a30a |
127 | |
7fd59977 |
128 | Dump(P : Polygon3D from Poly; |
129 | OS : in out OStream); |
130 | ---Purpose: Dumps the 3D polygon. This is a call to the |
131 | -- previous method with Comapct set to False. |
4952a30a |
132 | |
7fd59977 |
133 | Dump(P : Polygon2D from Poly; |
134 | OS : in out OStream); |
135 | ---Purpose: Dumps the 2D polygon. This is a call to the |
136 | -- previous method with Comapct set to False. |
4952a30a |
137 | |
7fd59977 |
138 | |
139 | ReadTriangulation(IS : in out IStream) |
140 | returns Triangulation from Poly; |
141 | ---Purpose: Reads a triangulation from the stream <IS>. |
4952a30a |
142 | |
7fd59977 |
143 | ReadPolygon3D(IS : in out IStream) |
144 | returns Polygon3D from Poly; |
145 | ---Purpose: Reads a 3d polygon from the stream <IS>. |
4952a30a |
146 | |
7fd59977 |
147 | ReadPolygon2D(IS : in out IStream) |
148 | returns Polygon2D from Poly; |
149 | ---Purpose: Reads a 2D polygon from the stream <IS>. |
150 | |
151 | ComputeNormals(Tri : Triangulation from Poly); |
4952a30a |
152 | ---Purpose: Compute node normals for face triangulation |
7fd59977 |
153 | -- as mean normal of surrounding triangles |
4952a30a |
154 | |
155 | PointOnTriangle(P1, P2, P3, P: XY from gp; UV: out XY from gp) |
156 | returns Real; |
157 | ---Purpose: Computes parameters of the point P on triangle |
158 | -- defined by points P1, P2, and P3, in 2d. |
159 | -- The parameters U and V are defined so that |
160 | -- P = P1 + U * (P2 - P1) + V * (P3 - P1), |
161 | -- with U >= 0, V >= 0, U + V <= 1. |
162 | -- If P is located outside of triangle, or triangle |
163 | -- is degenerated, the returned parameters correspond |
164 | -- to closest point, and returned value is square of |
165 | -- the distance from original point to triangle (0 if |
166 | -- point is inside). |
167 | |
7fd59977 |
168 | end Poly; |