b311480e |
1 | -- Created on: 1995-03-09 |
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 | |
17 | class Polygon2D from Poly inherits TShared from MMgt |
18 | |
19 | ---Purpose: Provides a polygon in 2D space (for example, in the |
20 | -- parametric space of a surface). It is generally an |
21 | -- approximate representation of a curve. |
22 | -- A Polygon2D is defined by a table of nodes. Each node is |
23 | -- a 2D point. If the polygon is closed, the point of closure is |
24 | -- repeated at the end of the table of nodes. |
25 | |
26 | |
27 | uses Array1OfPnt2d from TColgp |
28 | |
29 | raises NullObject from Standard |
30 | |
31 | is |
32 | |
33 | Create(Nodes: Array1OfPnt2d from TColgp) |
6e33d3ce |
34 | returns Polygon2D from Poly; |
7fd59977 |
35 | ---Purpose: Constructs a 2D polygon defined by the table of points, <Nodes>. |
36 | |
37 | Deflection(me) returns Real; |
38 | ---Purpose: Returns the deflection of this polygon. |
39 | -- Deflection is used in cases where the polygon is an |
40 | -- approximate representation of a curve. Deflection |
41 | -- represents the maximum distance permitted between any |
42 | -- point on the curve and the corresponding point on the polygon. |
43 | -- By default the deflection value is equal to 0. An algorithm |
44 | -- using this 2D polygon with a deflection value equal to 0 |
45 | -- considers that it is working with a true polygon and not with |
46 | -- an approximate representation of a curve. The Deflection |
47 | -- function is used to modify the deflection value of this polygon. |
48 | -- The deflection value can be used by any algorithm working with 2D polygons. |
49 | -- For example: |
50 | -- - An algorithm may use a unique deflection value for all |
51 | -- its polygons. In this case it is not necessary to use the |
52 | -- Deflection function. |
53 | -- - Or an algorithm may want to attach a different |
54 | -- deflection to each polygon. In this case, the Deflection |
55 | -- function is used to set a value on each polygon, and |
56 | -- later to fetch the value. |
57 | |
58 | Deflection(me : mutable; D : Real); |
59 | ---Purpose: Sets the deflection of this polygon to D |
60 | |
61 | NbNodes(me) returns Integer; |
62 | ---Purpose: Returns the number of nodes in this polygon. |
63 | -- Note: If the polygon is closed, the point of closure is |
64 | -- repeated at the end of its table of nodes. Thus, on a closed |
65 | -- triangle, the function NbNodes returns 4. |
66 | ---C++: inline |
67 | |
68 | Nodes(me) returns Array1OfPnt2d from TColgp |
69 | ---Purpose: Returns the table of nodes for this polygon. |
70 | ---C++: return const & |
71 | raises NullObject from Standard; |
72 | |
73 | |
74 | fields |
75 | |
76 | myDeflection: Real; |
7fd59977 |
77 | myNodes: Array1OfPnt2d from TColgp; |
78 | |
79 | end Polygon2D; |