d12424a47c113c08fa67c9da011f4045b20f1204
[occt.git] / src / Poly / Poly_PolygonOnTriangulation.hxx
1 // Created on: 1996-02-21
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Poly_PolygonOnTriangulation_HeaderFile
18 #define _Poly_PolygonOnTriangulation_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Real.hxx>
24 #include <TColStd_Array1OfInteger.hxx>
25 #include <TColStd_HArray1OfReal.hxx>
26 #include <Standard_Transient.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 class Standard_NullObject;
31
32
33 class Poly_PolygonOnTriangulation;
34 DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
35
36 //! This class provides a polygon in 3D space, based on the triangulation
37 //! of a surface. It may be the approximate representation of a
38 //! curve on the surface, or more generally the shape.
39 //! A PolygonOnTriangulation is defined by a table of
40 //! nodes. Each node is an index in the table of nodes specific
41 //! to a triangulation, and represents a point on the surface. If
42 //! the polygon is closed, the index of the point of closure is
43 //! repeated at the end of the table of nodes.
44 //! If the polygon is an approximate representation of a curve
45 //! on a surface, you can associate with each of its nodes the
46 //! value of the parameter of the corresponding point on the
47 //! curve.represents a 3d Polygon
48 class Poly_PolygonOnTriangulation : public Standard_Transient
49 {
50
51 public:
52
53   
54   //! Constructs a 3D polygon on the triangulation of a shape,
55   //! defined by the table of nodes, <Nodes>.
56   Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes);
57   
58
59   //! Constructs a 3D polygon on the triangulation of a shape, defined by:
60   //! -   the table of nodes, Nodes, and the table of parameters, <Parameters>.
61   //! where:
62   //! -   a node value is an index in the table of nodes specific
63   //! to an existing triangulation of a shape
64   //! -   and a parameter value is the value of the parameter of
65   //! the corresponding point on the curve approximated by
66   //! the constructed polygon.
67   //! Warning
68   //! The tables Nodes and Parameters must be the same size.
69   //! This property is not checked at construction time.
70   Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes, const TColStd_Array1OfReal& Parameters);
71
72   //! Creates a copy of current polygon
73   Standard_EXPORT virtual Handle(Poly_PolygonOnTriangulation) Copy() const;
74
75   //! Returns the deflection of this polygon
76   Standard_EXPORT Standard_Real Deflection() const;
77   
78   //! Sets the deflection of this polygon to D.
79   //! See more on deflection in Poly_Polygones2D.
80   Standard_EXPORT void Deflection (const Standard_Real D);
81   
82
83   //! Returns the number of nodes for this polygon.
84   //! Note: If the polygon is closed, the point of closure is
85   //! repeated at the end of its table of nodes. Thus, on a closed
86   //! triangle, the function NbNodes returns 4.
87     Standard_Integer NbNodes() const;
88   
89   //! Returns the table of nodes for this polygon. A node value
90   //! is an index in the table of nodes specific to an existing
91   //! triangulation of a shape.
92   Standard_EXPORT const TColStd_Array1OfInteger& Nodes() const;
93   
94
95   //! Returns true if parameters are associated with the nodes in this polygon.
96   Standard_EXPORT Standard_Boolean HasParameters() const;
97   
98   //! Returns the table of the parameters associated with each node in this polygon.
99   //! Warning
100   //! Use the function HasParameters to check if parameters
101   //! are associated with the nodes in this polygon.
102   Standard_EXPORT Handle(TColStd_HArray1OfReal) Parameters() const;
103
104
105
106
107   DEFINE_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
108
109 protected:
110
111
112
113
114 private:
115
116
117   Standard_Real myDeflection;
118   TColStd_Array1OfInteger myNodes;
119   Handle(TColStd_HArray1OfReal) myParameters;
120
121
122 };
123
124
125 #include <Poly_PolygonOnTriangulation.lxx>
126
127
128
129
130
131 #endif // _Poly_PolygonOnTriangulation_HeaderFile