|
|
|||
File indexing completed on 2026-09-14 09:15:41
0001 // Created on: 1995-03-09 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_Polygon2D_HeaderFile 0018 #define _Poly_Polygon2D_HeaderFile 0019 0020 #include <gp_Pnt2d.hxx> 0021 #include <NCollection_Array1.hxx> 0022 #include <Standard_Transient.hxx> 0023 0024 //! Provides a polygon in 2D space (for example, in the 0025 //! parametric space of a surface). It is generally an 0026 //! approximate representation of a curve. 0027 //! A Polygon2D is defined by a table of nodes. Each node is 0028 //! a 2D point. If the polygon is closed, the point of closure is 0029 //! repeated at the end of the table of nodes. 0030 class Poly_Polygon2D : public Standard_Transient 0031 { 0032 public: 0033 //! Constructs a 2D polygon with specified number of nodes. 0034 Standard_EXPORT explicit Poly_Polygon2D(const int theNbNodes); 0035 0036 //! Constructs a 2D polygon defined by the table of points, <Nodes>. 0037 Standard_EXPORT Poly_Polygon2D(const NCollection_Array1<gp_Pnt2d>& Nodes); 0038 0039 //! Creates a copy of current polygon. 0040 Standard_EXPORT virtual occ::handle<Poly_Polygon2D> Copy() const; 0041 0042 //! Returns the deflection of this polygon. 0043 //! Deflection is used in cases where the polygon is an 0044 //! approximate representation of a curve. Deflection 0045 //! represents the maximum distance permitted between any 0046 //! point on the curve and the corresponding point on the polygon. 0047 //! By default the deflection value is equal to 0. An algorithm 0048 //! using this 2D polygon with a deflection value equal to 0 0049 //! considers that it is working with a true polygon and not with 0050 //! an approximate representation of a curve. The Deflection 0051 //! function is used to modify the deflection value of this polygon. 0052 //! The deflection value can be used by any algorithm working with 2D polygons. 0053 //! For example: 0054 //! - An algorithm may use a unique deflection value for all 0055 //! its polygons. In this case it is not necessary to use the 0056 //! Deflection function. 0057 //! - Or an algorithm may want to attach a different 0058 //! deflection to each polygon. In this case, the Deflection 0059 //! function is used to set a value on each polygon, and 0060 //! later to fetch the value. 0061 double Deflection() const { return myDeflection; } 0062 0063 //! Sets the deflection of this polygon. 0064 void Deflection(const double theDefl) { myDeflection = theDefl; } 0065 0066 //! Returns the number of nodes in this polygon. 0067 //! Note: If the polygon is closed, the point of closure is 0068 //! repeated at the end of its table of nodes. Thus, on a closed 0069 //! triangle, the function NbNodes returns 4. 0070 int NbNodes() const { return myNodes.Length(); } 0071 0072 //! Returns the table of nodes for this polygon. 0073 const NCollection_Array1<gp_Pnt2d>& Nodes() const { return myNodes; } 0074 0075 //! Returns the table of nodes for this polygon. 0076 NCollection_Array1<gp_Pnt2d>& ChangeNodes() { return myNodes; } 0077 0078 //! Dumps the content of me into the stream 0079 Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; 0080 0081 DEFINE_STANDARD_RTTIEXT(Poly_Polygon2D, Standard_Transient) 0082 0083 private: 0084 double myDeflection; 0085 NCollection_Array1<gp_Pnt2d> myNodes; 0086 }; 0087 0088 #endif // _Poly_Polygon2D_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|