1 -- Created on: 1993-07-29
2 -- Created by: Remi LEQUETTE
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 class MakePolygon from BRepBuilderAPI inherits MakeShape from BRepBuilderAPI
25 ---Purpose: Describes functions to build polygonal wires. A
26 -- polygonal wire can be built from any number of points
27 -- or vertices, and consists of a sequence of connected
29 -- When a point or vertex is added to the polygon if
30 -- it is identic to the previous point no edge is
31 -- built. The method added can be used to test it.
32 -- Construction of a Polygonal Wire
34 -- - a complete polygonal wire by defining all its points
35 -- or vertices (limited to four), or
36 -- - an empty polygonal wire and add its points or
37 -- vertices in sequence (unlimited number).
38 -- A MakePolygon object provides a framework for:
39 -- - initializing the construction of a polygonal wire,
40 -- - adding points or vertices to the polygonal wire under construction, and
41 -- - consulting the result.
48 MakePolygon from BRepLib
55 returns MakePolygon from BRepBuilderAPI;
56 ---Purpose: Initializes an empty polygonal wire, to which points or
57 -- vertices are added using the Add function.
58 -- As soon as the polygonal wire under construction
59 -- contains vertices, it can be consulted using the Wire function.
61 Create(P1, P2 : Pnt from gp)
63 returns MakePolygon from BRepBuilderAPI;
65 Create(P1, P2, P3 : Pnt from gp;
66 Close : Boolean = Standard_False)
68 returns MakePolygon from BRepBuilderAPI;
70 Create(P1, P2, P3, P4 : Pnt from gp;
71 Close : Boolean = Standard_False)
73 returns MakePolygon from BRepBuilderAPI;
74 ---Purpose: Constructs a polygonal wire from 2, 3 or 4 points. Vertices are
75 -- automatically created on the given points. The polygonal wire is
76 -- closed if Close is true; otherwise it is open. Further vertices can
77 -- be added using the Add function. The polygonal wire under
78 -- construction can be consulted at any time by using the Wire function.
80 -- //an open polygon from four points
81 -- TopoDS_Wire W = BRepBuilderAPI_MakePolygon(P1,P2,P3,P4);
82 -- Warning: The process is equivalent to:
83 -- - initializing an empty polygonal wire,
84 -- - and adding the given points in sequence.
85 -- Consequently, be careful when using this function: if the
86 -- sequence of points p1 - p2 - p1 is found among the arguments of the
87 -- constructor, you will create a polygonal wire with two
88 -- consecutive coincident edges.
90 Create(V1, V2 : Vertex from TopoDS)
92 returns MakePolygon from BRepBuilderAPI;
94 Create(V1, V2, V3 : Vertex from TopoDS;
95 Close : Boolean = Standard_False)
97 returns MakePolygon from BRepBuilderAPI;
99 Create(V1, V2, V3, V4 : Vertex from TopoDS;
100 Close : Boolean = Standard_False)
102 returns MakePolygon from BRepBuilderAPI;
103 ---Purpose: Constructs a polygonal wire from
104 -- 2, 3 or 4 vertices. The polygonal wire is closed if Close is true;
105 -- otherwise it is open (default value). Further vertices can be
106 -- added using the Add function. The polygonal wire under
107 -- construction can be consulted at any time by using the Wire function.
109 -- //a closed triangle from three vertices
110 -- TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,Standard_True);
112 -- The process is equivalent to:
113 -- - initializing an empty polygonal wire,
114 -- - then adding the given points in sequence.
115 -- So be careful, as when using this function, you could create a
116 -- polygonal wire with two consecutive coincident edges if
117 -- the sequence of vertices v1 - v2 - v1 is found among the
118 -- constructor's arguments.
120 Add(me : in out; P : Pnt from gp)
124 Add(me : in out; V : Vertex from TopoDS)
128 -- Adds the point P or the vertex V at the end of the
129 -- polygonal wire under construction. A vertex is
130 -- automatically created on the point P.
132 -- - When P or V is coincident to the previous vertex,
133 -- no edge is built. The method Added can be used to
134 -- test for this. Neither P nor V is checked to verify
135 -- that it is coincident with another vertex than the last
136 -- one, of the polygonal wire under construction. It is
137 -- also possible to add vertices on a closed polygon
138 -- (built for example by using a constructor which
139 -- declares the polygon closed, or after the use of the Close function).
140 -- Consequently, be careful using this function: you might create:
141 -- - a polygonal wire with two consecutive coincident edges, or
142 -- - a non manifold polygonal wire.
143 -- - P or V is not checked to verify if it is
144 -- coincident with another vertex but the last one, of
145 -- the polygonal wire under construction. It is also
146 -- possible to add vertices on a closed polygon (built
147 -- for example by using a constructor which declares
148 -- the polygon closed, or after the use of the Close function).
149 -- Consequently, be careful when using this function: you might create:
150 -- - a polygonal wire with two consecutive coincident edges, or
151 -- - a non-manifold polygonal wire.
153 Added(me) returns Boolean
154 ---Purpose: Returns true if the last vertex added to the constructed
155 -- polygonal wire is not coincident with the previous one.
159 ---Purpose: Closes the polygonal wire under construction. Note - this
160 -- is equivalent to adding the first vertex to the polygonal
161 -- wire under construction.
164 FirstVertex(me) returns Vertex from TopoDS
165 ---C++: return const &
169 LastVertex(me) returns Vertex from TopoDS
170 ---C++: return const &
173 ---Purpose: Returns the first or the last vertex of the polygonal wire under construction.
174 -- If the constructed polygonal wire is closed, the first and the last vertices are identical.
176 IsDone(me) returns Boolean
180 -- Returns true if this algorithm contains a valid polygonal
181 -- wire (i.e. if there is at least one edge).
182 -- IsDone returns false if fewer than two vertices have
183 -- been chained together by this construction algorithm.
185 Edge(me) returns Edge from TopoDS
186 ---Purpose: Returns the edge built between the last two points or
187 -- vertices added to the constructed polygonal wire under construction.
189 -- If there is only one vertex in the polygonal wire, the result is a null edge.
190 ---C++: return const &
191 ---C++: alias "Standard_EXPORT operator TopoDS_Edge() const;"
196 Wire(me) returns Wire from TopoDS
198 -- Returns the constructed polygonal wire, or the already
199 -- built part of the polygonal wire under construction.
201 -- StdFail_NotDone if the wire is not built, i.e. if fewer than
202 -- two vertices have been chained together by this construction algorithm.
203 ---C++: return const &
204 ---C++: alias "Standard_EXPORT operator TopoDS_Wire() const;"
211 myMakePolygon : MakePolygon from BRepLib;