|
|
|||
File indexing completed on 2026-09-13 09:17:35
0001 // Created on: 1995-03-07 0002 // Created by: Laurent PAINNOT 0003 // Copyright (c) 1995-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Poly_Polygon3D_HeaderFile 0018 #define _Poly_Polygon3D_HeaderFile 0019 0020 #include <Standard_Transient.hxx> 0021 #include <gp_Pnt.hxx> 0022 #include <NCollection_Array1.hxx> 0023 #include <NCollection_HArray1.hxx> 0024 0025 //! This class Provides a polygon in 3D space. It is generally an approximate representation of a 0026 //! curve. A Polygon3D is defined by a table of nodes. Each node is a 3D point. If the polygon is 0027 //! closed, the point of closure is repeated at the end of the table of nodes. If the polygon is an 0028 //! approximate representation of a curve, you can associate with each of its nodes the value of the 0029 //! parameter of the corresponding point on the curve. 0030 class Poly_Polygon3D : public Standard_Transient 0031 { 0032 public: 0033 //! Constructs a 3D polygon with specific number of nodes. 0034 Standard_EXPORT Poly_Polygon3D(const int theNbNodes, const bool theHasParams); 0035 0036 //! Constructs a 3D polygon defined by the table of points, Nodes. 0037 Standard_EXPORT Poly_Polygon3D(const NCollection_Array1<gp_Pnt>& Nodes); 0038 0039 //! Constructs a 3D polygon defined by 0040 //! the table of points, Nodes, and the parallel table of 0041 //! parameters, Parameters, where each value of the table 0042 //! Parameters is the parameter of the corresponding point 0043 //! on the curve approximated by the constructed polygon. 0044 //! Warning 0045 //! Both the Nodes and Parameters tables must have the 0046 //! same bounds. This property is not checked at construction time. 0047 Standard_EXPORT Poly_Polygon3D(const NCollection_Array1<gp_Pnt>& Nodes, 0048 const NCollection_Array1<double>& Parameters); 0049 0050 //! Creates a copy of current polygon 0051 Standard_EXPORT virtual occ::handle<Poly_Polygon3D> Copy() const; 0052 0053 //! Returns the deflection of this polygon 0054 double Deflection() const { return myDeflection; } 0055 0056 //! Sets the deflection of this polygon. See more on deflection in Poly_Polygon2D 0057 void Deflection(const double theDefl) { myDeflection = theDefl; } 0058 0059 //! Returns the number of nodes in this polygon. 0060 //! Note: If the polygon is closed, the point of closure is 0061 //! repeated at the end of its table of nodes. Thus, on a closed 0062 //! triangle the function NbNodes returns 4. 0063 int NbNodes() const { return myNodes.Length(); } 0064 0065 //! Returns the table of nodes for this polygon. 0066 const NCollection_Array1<gp_Pnt>& Nodes() const { return myNodes; } 0067 0068 //! Returns the table of nodes for this polygon. 0069 NCollection_Array1<gp_Pnt>& ChangeNodes() { return myNodes; } 0070 0071 //! Returns the table of the parameters associated with each node in this polygon. 0072 //! HasParameters function checks if parameters are associated with the nodes of this polygon. 0073 bool HasParameters() const { return !myParameters.IsNull(); } 0074 0075 //! Returns true if parameters are associated with the nodes 0076 //! in this polygon. 0077 const NCollection_Array1<double>& Parameters() const { return myParameters->Array1(); } 0078 0079 //! Returns the table of the parameters associated with each node in this polygon. 0080 //! ChangeParameters function returns the array as shared. 0081 //! Therefore if the table is selected by reference you can, by simply modifying it, 0082 //! directly modify the data structure of this polygon. 0083 NCollection_Array1<double>& ChangeParameters() const { return myParameters->ChangeArray1(); } 0084 0085 //! Dumps the content of me into the stream 0086 Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; 0087 0088 DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D, Standard_Transient) 0089 0090 private: 0091 double myDeflection; 0092 NCollection_Array1<gp_Pnt> myNodes; 0093 occ::handle<NCollection_HArray1<double>> myParameters; 0094 }; 0095 0096 #endif // _Poly_Polygon3D_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|