mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0031137: Modeling Data, BinTools_ShapeSet - avoid allocation of temporary arrays
BinTools_ShapeSet now defines maps with proper types instead of Standard_Transient. BinTools_ShapeSet now avoids allocation of temporary arrays while reading triangulation and polygonal data. Classes Poly_Triangle, Poly_PolygonOnTriangulation, Poly_Polygon3D and Poly_Polygon2D have been cleared from .lxx files and extended by new methods for preallocating and filling array, as alternative to passing arrays by copy. wavefront command - export "f" instead of obsolete "fo" keys into file. BinTools - added missing tools for reading/writing short reals.
This commit is contained in:
@@ -19,15 +19,10 @@ Poly_MakeLoops.cxx
|
||||
Poly_MakeLoops.hxx
|
||||
Poly_Polygon2D.cxx
|
||||
Poly_Polygon2D.hxx
|
||||
Poly_Polygon2D.lxx
|
||||
Poly_Polygon3D.cxx
|
||||
Poly_Polygon3D.hxx
|
||||
Poly_Polygon3D.lxx
|
||||
Poly_PolygonOnTriangulation.cxx
|
||||
Poly_PolygonOnTriangulation.hxx
|
||||
Poly_PolygonOnTriangulation.lxx
|
||||
Poly_Triangle.cxx
|
||||
Poly_Triangle.hxx
|
||||
Poly_Triangle.lxx
|
||||
Poly_Triangulation.cxx
|
||||
Poly_Triangulation.hxx
|
||||
|
@@ -14,17 +14,24 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Poly_Polygon2D.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Polygon2D
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Poly_Polygon2D::Poly_Polygon2D (const Standard_Integer theNbNodes)
|
||||
: myDeflection (0.0),
|
||||
myNodes (1, theNbNodes)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Polygon2D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes):
|
||||
myDeflection(0.),
|
||||
@@ -34,35 +41,3 @@ Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes):
|
||||
for (i = Nodes.Lower(); i <= Nodes.Upper(); i++)
|
||||
myNodes(j++) = Nodes(i);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Poly_Polygon2D::Deflection() const
|
||||
{
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Poly_Polygon2D::Deflection(const Standard_Real D)
|
||||
{
|
||||
myDeflection = D;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Nodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TColgp_Array1OfPnt2d& Poly_Polygon2D::Nodes() const
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -17,17 +17,10 @@
|
||||
#ifndef _Poly_Polygon2D_HeaderFile
|
||||
#define _Poly_Polygon2D_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_NullObject;
|
||||
|
||||
|
||||
class Poly_Polygon2D;
|
||||
DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
|
||||
|
||||
//! Provides a polygon in 2D space (for example, in the
|
||||
@@ -38,13 +31,14 @@ DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
|
||||
//! repeated at the end of the table of nodes.
|
||||
class Poly_Polygon2D : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a 2D polygon with specified number of nodes.
|
||||
Standard_EXPORT explicit Poly_Polygon2D (const Standard_Integer theNbNodes);
|
||||
|
||||
//! Constructs a 2D polygon defined by the table of points, <Nodes>.
|
||||
Standard_EXPORT Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes);
|
||||
|
||||
|
||||
//! Returns the deflection of this polygon.
|
||||
//! Deflection is used in cases where the polygon is an
|
||||
//! approximate representation of a curve. Deflection
|
||||
@@ -64,44 +58,30 @@ public:
|
||||
//! deflection to each polygon. In this case, the Deflection
|
||||
//! function is used to set a value on each polygon, and
|
||||
//! later to fetch the value.
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this polygon to D
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
|
||||
Standard_Real Deflection() const { return myDeflection; }
|
||||
|
||||
//! Sets the deflection of this polygon.
|
||||
void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
|
||||
|
||||
//! Returns the number of nodes in this polygon.
|
||||
//! Note: If the polygon is closed, the point of closure is
|
||||
//! repeated at the end of its table of nodes. Thus, on a closed
|
||||
//! triangle, the function NbNodes returns 4.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
Standard_Integer NbNodes() const { return myNodes.Length(); }
|
||||
|
||||
//! Returns the table of nodes for this polygon.
|
||||
Standard_EXPORT const TColgp_Array1OfPnt2d& Nodes() const;
|
||||
|
||||
|
||||
const TColgp_Array1OfPnt2d& Nodes() const { return myNodes; }
|
||||
|
||||
//! Returns the table of nodes for this polygon.
|
||||
TColgp_Array1OfPnt2d& ChangeNodes() { return myNodes; }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
TColgp_Array1OfPnt2d myNodes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Polygon2D.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Polygon2D_HeaderFile
|
||||
|
@@ -1,26 +0,0 @@
|
||||
// Created on: 1995-03-09
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : NbNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer Poly_Polygon2D::NbNodes() const
|
||||
{
|
||||
return myNodes.Length();
|
||||
}
|
||||
|
@@ -14,14 +14,25 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Poly_Polygon3D.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Polygon3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Poly_Polygon3D::Poly_Polygon3D (const Standard_Integer theNbNodes,
|
||||
const Standard_Boolean theHasParams)
|
||||
: myDeflection (0.0),
|
||||
myNodes (1, theNbNodes)
|
||||
{
|
||||
if (theHasParams)
|
||||
{
|
||||
myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Polygon3D
|
||||
//purpose :
|
||||
@@ -70,67 +81,3 @@ Handle(Poly_Polygon3D) Poly_Polygon3D::Copy() const
|
||||
aCopy->Deflection(myDeflection);
|
||||
return aCopy;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Poly_Polygon3D::Deflection() const
|
||||
{
|
||||
return myDeflection;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Poly_Polygon3D::Deflection(const Standard_Real D)
|
||||
{
|
||||
myDeflection = D;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Nodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TColgp_Array1OfPnt& Poly_Polygon3D::Nodes() const
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Poly_Polygon3D::HasParameters() const
|
||||
{
|
||||
return !myParameters.IsNull();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TColStd_Array1OfReal& Poly_Polygon3D::Parameters() const
|
||||
{
|
||||
return myParameters->Array1();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TColStd_Array1OfReal& Poly_Polygon3D::ChangeParameters() const
|
||||
{
|
||||
return myParameters->ChangeArray1();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -17,20 +17,12 @@
|
||||
#ifndef _Poly_Polygon3D_HeaderFile
|
||||
#define _Poly_Polygon3D_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_NullObject;
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
|
||||
class Poly_Polygon3D;
|
||||
DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
|
||||
|
||||
//! This class Provides a polygon in 3D space. It is generally an approximate representation of a curve.
|
||||
@@ -42,11 +34,13 @@ DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
|
||||
//! parameter of the corresponding point on the curve.
|
||||
class Poly_Polygon3D : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! onstructs a 3D polygon defined by the table of points, Nodes.
|
||||
//! Constructs a 3D polygon with specific number of nodes.
|
||||
Standard_EXPORT Poly_Polygon3D (const Standard_Integer theNbNodes,
|
||||
const Standard_Boolean theHasParams);
|
||||
|
||||
//! Constructs a 3D polygon defined by the table of points, Nodes.
|
||||
Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
|
||||
|
||||
//! Constructs a 3D polygon defined by
|
||||
@@ -63,59 +57,45 @@ public:
|
||||
Standard_EXPORT virtual Handle(Poly_Polygon3D) Copy() const;
|
||||
|
||||
//! Returns the deflection of this polygon
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this polygon to D. See more on deflection in Poly_Polygon2D
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
Standard_Real Deflection() const { return myDeflection; }
|
||||
|
||||
//! Sets the deflection of this polygon. See more on deflection in Poly_Polygon2D
|
||||
void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
|
||||
|
||||
//! Returns the number of nodes in this polygon.
|
||||
//! Note: If the polygon is closed, the point of closure is
|
||||
//! repeated at the end of its table of nodes. Thus, on a closed
|
||||
//! triangle the function NbNodes returns 4.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
Standard_Integer NbNodes() const { return myNodes.Length(); }
|
||||
|
||||
//! Returns the table of nodes for this polygon.
|
||||
Standard_EXPORT const TColgp_Array1OfPnt& Nodes() const;
|
||||
|
||||
const TColgp_Array1OfPnt& Nodes() const { return myNodes; }
|
||||
|
||||
//! Returns the table of nodes for this polygon.
|
||||
TColgp_Array1OfPnt& ChangeNodes() { return myNodes; }
|
||||
|
||||
//! Returns the table of the parameters associated with each node in this polygon.
|
||||
//! HasParameters function checks if parameters are associated with the nodes of this polygon.
|
||||
Standard_EXPORT Standard_Boolean HasParameters() const;
|
||||
Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
|
||||
|
||||
//! Returns true if parameters are associated with the nodes
|
||||
//! in this polygon.
|
||||
Standard_EXPORT const TColStd_Array1OfReal& Parameters() const;
|
||||
|
||||
const TColStd_Array1OfReal& Parameters() const { return myParameters->Array1(); }
|
||||
|
||||
//! Returns the table of the parameters associated with each node in this polygon.
|
||||
//! ChangeParameters function returnes the array as shared. Therefore if the table is selected by
|
||||
//! reference you can, by simply modifying it, directly modify
|
||||
//! the data structure of this polygon.
|
||||
Standard_EXPORT TColStd_Array1OfReal& ChangeParameters() const;
|
||||
|
||||
|
||||
|
||||
TColStd_Array1OfReal& ChangeParameters() const { return myParameters->ChangeArray1(); }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
TColgp_Array1OfPnt myNodes;
|
||||
Handle(TColStd_HArray1OfReal) myParameters;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Polygon3D.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Polygon3D_HeaderFile
|
||||
|
@@ -1,26 +0,0 @@
|
||||
// Created on: 1995-03-09
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : NbNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer Poly_Polygon3D::NbNodes() const
|
||||
{
|
||||
return myNodes.Length();
|
||||
}
|
||||
|
@@ -14,13 +14,25 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Poly_PolygonOnTriangulation.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_PolygonOnTriangulation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Poly_PolygonOnTriangulation::Poly_PolygonOnTriangulation (const Standard_Integer theNbNodes,
|
||||
const Standard_Boolean theHasParams)
|
||||
: myDeflection (0.0),
|
||||
myNodes (1, theNbNodes)
|
||||
{
|
||||
if (theHasParams)
|
||||
{
|
||||
myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_PolygonOnTriangulation
|
||||
//purpose :
|
||||
@@ -66,53 +78,16 @@ Handle(Poly_PolygonOnTriangulation) Poly_PolygonOnTriangulation::Copy() const
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//function : SetParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Poly_PolygonOnTriangulation::Deflection() const
|
||||
void Poly_PolygonOnTriangulation::SetParameters (const Handle(TColStd_HArray1OfReal)& theParameters)
|
||||
{
|
||||
return myDeflection;
|
||||
if (!theParameters.IsNull()
|
||||
&& (theParameters->Lower() != myNodes.Lower()
|
||||
|| theParameters->Upper() != myNodes.Upper()))
|
||||
{
|
||||
throw Standard_OutOfRange ("Poly_PolygonOnTriangulation::SetParameters() - invalid array size");
|
||||
}
|
||||
myParameters = theParameters;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Deflection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Poly_PolygonOnTriangulation::Deflection(const Standard_Real D)
|
||||
{
|
||||
myDeflection = D;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Nodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TColStd_Array1OfInteger& Poly_PolygonOnTriangulation::Nodes() const
|
||||
{
|
||||
return myNodes;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : HasParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Poly_PolygonOnTriangulation::HasParameters() const
|
||||
{
|
||||
return (!myParameters.IsNull());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Parameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TColStd_HArray1OfReal) Poly_PolygonOnTriangulation::Parameters() const
|
||||
{
|
||||
return myParameters;
|
||||
}
|
||||
|
||||
|
@@ -17,20 +17,13 @@
|
||||
#ifndef _Poly_PolygonOnTriangulation_HeaderFile
|
||||
#define _Poly_PolygonOnTriangulation_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class Standard_NullObject;
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
|
||||
|
||||
class Poly_PolygonOnTriangulation;
|
||||
DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
|
||||
|
||||
//! This class provides a polygon in 3D space, based on the triangulation
|
||||
@@ -47,14 +40,15 @@ DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
|
||||
//! curve.represents a 3d Polygon
|
||||
class Poly_PolygonOnTriangulation : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
//! Constructs a 3D polygon on the triangulation of a shape with specified size of nodes.
|
||||
Standard_EXPORT Poly_PolygonOnTriangulation (const Standard_Integer theNbNodes,
|
||||
const Standard_Boolean theHasParams);
|
||||
|
||||
//! Constructs a 3D polygon on the triangulation of a shape,
|
||||
//! defined by the table of nodes, <Nodes>.
|
||||
Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes);
|
||||
|
||||
|
||||
//! Constructs a 3D polygon on the triangulation of a shape, defined by:
|
||||
//! - the table of nodes, Nodes, and the table of parameters, <Parameters>.
|
||||
@@ -73,59 +67,51 @@ public:
|
||||
Standard_EXPORT virtual Handle(Poly_PolygonOnTriangulation) Copy() const;
|
||||
|
||||
//! Returns the deflection of this polygon
|
||||
Standard_EXPORT Standard_Real Deflection() const;
|
||||
|
||||
//! Sets the deflection of this polygon to D.
|
||||
Standard_Real Deflection() const { return myDeflection; }
|
||||
|
||||
//! Sets the deflection of this polygon.
|
||||
//! See more on deflection in Poly_Polygones2D.
|
||||
Standard_EXPORT void Deflection (const Standard_Real D);
|
||||
|
||||
void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
|
||||
|
||||
//! Returns the number of nodes for this polygon.
|
||||
//! Note: If the polygon is closed, the point of closure is
|
||||
//! repeated at the end of its table of nodes. Thus, on a closed
|
||||
//! triangle, the function NbNodes returns 4.
|
||||
Standard_Integer NbNodes() const;
|
||||
|
||||
Standard_Integer NbNodes() const { return myNodes.Length(); }
|
||||
|
||||
//! Returns the table of nodes for this polygon. A node value
|
||||
//! is an index in the table of nodes specific to an existing
|
||||
//! triangulation of a shape.
|
||||
Standard_EXPORT const TColStd_Array1OfInteger& Nodes() const;
|
||||
|
||||
const TColStd_Array1OfInteger& Nodes() const { return myNodes; }
|
||||
|
||||
//! Returns the table of nodes for this polygon for modification.
|
||||
TColStd_Array1OfInteger& ChangeNodes() { return myNodes; }
|
||||
|
||||
//! Returns true if parameters are associated with the nodes in this polygon.
|
||||
Standard_EXPORT Standard_Boolean HasParameters() const;
|
||||
|
||||
Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
|
||||
|
||||
//! Returns the table of the parameters associated with each node in this polygon.
|
||||
//! Warning
|
||||
//! Use the function HasParameters to check if parameters
|
||||
//! are associated with the nodes in this polygon.
|
||||
Standard_EXPORT Handle(TColStd_HArray1OfReal) Parameters() const;
|
||||
|
||||
const Handle(TColStd_HArray1OfReal)& Parameters() const { return myParameters; }
|
||||
|
||||
//! Returns the table of the parameters associated with each node in this polygon.
|
||||
//! Warning! HasParameters() should be called beforehand to check if parameters array is allocated.
|
||||
TColStd_Array1OfReal& ChangeParameters() { return myParameters->ChangeArray1(); }
|
||||
|
||||
//! Sets the table of the parameters associated with each node in this polygon.
|
||||
//! Raises exception if array size doesn't much number of polygon nodes.
|
||||
Standard_EXPORT void SetParameters (const Handle(TColStd_HArray1OfReal)& theParameters);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_Real myDeflection;
|
||||
TColStd_Array1OfInteger myNodes;
|
||||
Handle(TColStd_HArray1OfReal) myParameters;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_PolygonOnTriangulation.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_PolygonOnTriangulation_HeaderFile
|
||||
|
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : NbNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer Poly_PolygonOnTriangulation::NbNodes() const
|
||||
{
|
||||
return myNodes.Length();
|
||||
}
|
||||
|
@@ -1,71 +0,0 @@
|
||||
// Created on: 1995-03-06
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Poly_Triangle.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Triangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Poly_Triangle::Poly_Triangle()
|
||||
{
|
||||
myNodes[0] = myNodes[1] = myNodes[2] = 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Poly_Triangle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Poly_Triangle::Poly_Triangle(const Standard_Integer N1,
|
||||
const Standard_Integer N2,
|
||||
const Standard_Integer N3)
|
||||
{
|
||||
myNodes[0] = N1;
|
||||
myNodes[1] = N2;
|
||||
myNodes[2] = N3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Poly_Triangle::Set(const Standard_Integer N1,
|
||||
const Standard_Integer N2,
|
||||
const Standard_Integer N3)
|
||||
{
|
||||
myNodes[0] = N1;
|
||||
myNodes[1] = N2;
|
||||
myNodes[2] = N3;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Poly_Triangle::Get(Standard_Integer& N1,
|
||||
Standard_Integer& N2,
|
||||
Standard_Integer& N3) const
|
||||
{
|
||||
N1 = myNodes[0];
|
||||
N2 = myNodes[1];
|
||||
N3 = myNodes[2];
|
||||
}
|
||||
|
@@ -20,81 +20,79 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
class Standard_OutOfRange;
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
|
||||
//! Describes a component triangle of a triangulation
|
||||
//! (Poly_Triangulation object).
|
||||
//! A Triangle is defined by a triplet of nodes. Each node is an
|
||||
//! index in the table of nodes specific to an existing
|
||||
//! Describes a component triangle of a triangulation (Poly_Triangulation object).
|
||||
//! A Triangle is defined by a triplet of nodes.
|
||||
//! Each node is an index in the table of nodes specific to an existing
|
||||
//! triangulation of a shape, and represents a point on the surface.
|
||||
class Poly_Triangle
|
||||
class Poly_Triangle
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Constructs a triangle and sets all indices to zero.
|
||||
Standard_EXPORT Poly_Triangle();
|
||||
|
||||
//! Constructs a triangle and sets its three indices
|
||||
//! to N1, N2 and N3 respectively, where these node values
|
||||
//! are indices in the table of nodes specific to an existing
|
||||
//! triangulation of a shape.
|
||||
Standard_EXPORT Poly_Triangle(const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
|
||||
|
||||
//! Sets the value of the three nodes of this triangle to N1, N2 and N3 respectively.
|
||||
Standard_EXPORT void Set (const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
|
||||
|
||||
//! Sets the value of the Indexth node of this triangle to Node.
|
||||
//! Raises OutOfRange if Index is not in 1,2,3
|
||||
void Set (const Standard_Integer Index, const Standard_Integer Node);
|
||||
|
||||
//! Returns the node indices of this triangle in N1, N2 and N3.
|
||||
Standard_EXPORT void Get (Standard_Integer& N1, Standard_Integer& N2, Standard_Integer& N3) const;
|
||||
Poly_Triangle() { myNodes[0] = myNodes[1] = myNodes[2] = 0; }
|
||||
|
||||
//! Constructs a triangle and sets its three indices,
|
||||
//! where these node values are indices in the table of nodes specific to an existing triangulation of a shape.
|
||||
Poly_Triangle (const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3)
|
||||
{
|
||||
myNodes[0] = theN1;
|
||||
myNodes[1] = theN2;
|
||||
myNodes[2] = theN3;
|
||||
}
|
||||
|
||||
//! Sets the value of the three nodes of this triangle.
|
||||
void Set (const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3)
|
||||
{
|
||||
myNodes[0] = theN1;
|
||||
myNodes[1] = theN2;
|
||||
myNodes[2] = theN3;
|
||||
}
|
||||
|
||||
//! Sets the value of node with specified index of this triangle.
|
||||
//! Raises Standard_OutOfRange if index is not in 1,2,3
|
||||
void Set (const Standard_Integer theIndex, const Standard_Integer theNode)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::Set(), invalid index");
|
||||
myNodes[theIndex - 1] = theNode;
|
||||
}
|
||||
|
||||
//! Returns the node indices of this triangle.
|
||||
void Get (Standard_Integer& theN1, Standard_Integer& theN2, Standard_Integer& theN3) const
|
||||
{
|
||||
theN1 = myNodes[0];
|
||||
theN2 = myNodes[1];
|
||||
theN3 = myNodes[2];
|
||||
}
|
||||
|
||||
//! Get the node of given Index.
|
||||
//! Raises OutOfRange from Standard if Index is not in 1,2,3
|
||||
Standard_Integer Value (const Standard_Integer Index) const;
|
||||
Standard_Integer operator() (const Standard_Integer Index) const
|
||||
{
|
||||
return Value(Index);
|
||||
}
|
||||
|
||||
Standard_Integer Value (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::Value(), invalid index");
|
||||
return myNodes[theIndex - 1];
|
||||
}
|
||||
|
||||
Standard_Integer operator() (const Standard_Integer Index) const { return Value(Index); }
|
||||
|
||||
//! Get the node of given Index.
|
||||
//! Raises OutOfRange if Index is not in 1,2,3
|
||||
Standard_Integer& ChangeValue (const Standard_Integer Index);
|
||||
Standard_Integer& operator() (const Standard_Integer Index)
|
||||
{
|
||||
return ChangeValue(Index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
Standard_Integer& ChangeValue (const Standard_Integer theIndex)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::ChangeValue(), invalid index");
|
||||
return myNodes[theIndex - 1];
|
||||
}
|
||||
|
||||
Standard_Integer& operator() (const Standard_Integer Index) { return ChangeValue(Index); }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer myNodes[3];
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <Poly_Triangle.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _Poly_Triangle_HeaderFile
|
||||
|
@@ -1,52 +0,0 @@
|
||||
// Created on: 1995-03-06
|
||||
// Created by: Laurent PAINNOT
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void Poly_Triangle::Set(const Standard_Integer Index, const Standard_Integer Node)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
|
||||
myNodes[Index-1] = Node;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer Poly_Triangle::Value(const Standard_Integer Index) const
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
|
||||
return myNodes[Index-1];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer& Poly_Triangle::ChangeValue
|
||||
(const Standard_Integer Index)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
|
||||
return myNodes[Index-1];
|
||||
}
|
||||
|
Reference in New Issue
Block a user