Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:38

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 <TColgp_Array1OfPnt.hxx>
0022 #include <TColStd_HArray1OfReal.hxx>
0023 
0024 DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
0025 
0026 //! This class Provides a polygon in 3D space. It is generally an approximate representation of a curve.
0027 //! A Polygon3D is defined by a table of nodes. Each node is
0028 //! a 3D point. If the polygon is closed, the point of closure is
0029 //! repeated at the end of the table of nodes.
0030 //! If the polygon is an approximate representation of a curve,
0031 //! you can associate with each of its nodes the value of the
0032 //! parameter of the corresponding point on the curve.
0033 class Poly_Polygon3D : public Standard_Transient
0034 {
0035 public:
0036 
0037   //! Constructs a 3D polygon with specific number of nodes.
0038   Standard_EXPORT Poly_Polygon3D (const Standard_Integer theNbNodes,
0039                                   const Standard_Boolean theHasParams);
0040 
0041   //! Constructs a 3D polygon defined by the table of points, Nodes.
0042   Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
0043   
0044   //! Constructs a 3D polygon defined by
0045   //! the table of points, Nodes, and the parallel table of
0046   //! parameters, Parameters, where each value of the table
0047   //! Parameters is the parameter of the corresponding point
0048   //! on the curve approximated by the constructed polygon.
0049   //! Warning
0050   //! Both the Nodes and Parameters tables must have the
0051   //! same bounds. This property is not checked at construction time.
0052   Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes, const TColStd_Array1OfReal& Parameters);
0053 
0054   //! Creates a copy of current polygon
0055   Standard_EXPORT virtual Handle(Poly_Polygon3D) Copy() const;
0056   
0057   //! Returns the deflection of this polygon
0058   Standard_Real Deflection() const { return myDeflection; }
0059 
0060   //! Sets the deflection of this polygon. See more on deflection in Poly_Polygon2D
0061   void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
0062   
0063   //! Returns the number of nodes in this polygon.
0064   //! Note: If the polygon is closed, the point of closure is
0065   //! repeated at the end of its table of nodes. Thus, on a closed
0066   //! triangle the function NbNodes returns 4.
0067   Standard_Integer NbNodes() const { return myNodes.Length(); }
0068 
0069   //! Returns the table of nodes for this polygon.
0070   const TColgp_Array1OfPnt& Nodes() const { return myNodes; }
0071 
0072   //! Returns the table of nodes for this polygon.
0073   TColgp_Array1OfPnt& ChangeNodes() { return myNodes; }
0074 
0075   //! Returns the table of the parameters associated with each node in this polygon.
0076   //! HasParameters function checks if   parameters are associated with the nodes of this polygon.
0077   Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
0078   
0079   //! Returns true if parameters are associated with the nodes
0080   //! in this polygon.
0081   const TColStd_Array1OfReal& Parameters() const { return myParameters->Array1(); }
0082 
0083   //! Returns the table of the parameters associated with each node in this polygon.
0084   //! ChangeParameters function returns the array as shared.
0085   //! Therefore if the table is selected by reference you can, by simply modifying it,
0086   //! directly modify the data structure of this polygon.
0087   TColStd_Array1OfReal& ChangeParameters() const { return myParameters->ChangeArray1(); }
0088 
0089   //! Dumps the content of me into the stream
0090   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
0091 
0092   DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
0093 
0094 private:
0095 
0096   Standard_Real myDeflection;
0097   TColgp_Array1OfPnt myNodes;
0098   Handle(TColStd_HArray1OfReal) myParameters;
0099 
0100 };
0101 
0102 #endif // _Poly_Polygon3D_HeaderFile