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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Poly_PolygonOnTriangulation_HeaderFile
18 #define _Poly_PolygonOnTriangulation_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
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;
33 class Poly_PolygonOnTriangulation;
34 DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
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
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);
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>.
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.
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);
72 //! Creates a copy of current polygon
73 Standard_EXPORT virtual Handle(Poly_PolygonOnTriangulation) Copy() const;
75 //! Returns the deflection of this polygon
76 Standard_EXPORT Standard_Real Deflection() const;
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);
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;
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;
95 //! Returns true if parameters are associated with the nodes in this polygon.
96 Standard_EXPORT Standard_Boolean HasParameters() const;
98 //! Returns the table of the parameters associated with each node in this polygon.
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;
107 DEFINE_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
117 Standard_Real myDeflection;
118 TColStd_Array1OfInteger myNodes;
119 Handle(TColStd_HArray1OfReal) myParameters;
125 #include <Poly_PolygonOnTriangulation.lxx>
131 #endif // _Poly_PolygonOnTriangulation_HeaderFile