Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
ShapeAnalysis_Surface Class Reference

Complements standard tool Geom_Surface by providing additional functionality for detection surface singularities, checking spatial surface closure and computing projections of 3D points onto a surface. More...

#include <ShapeAnalysis_Surface.hxx>

Inheritance diagram for ShapeAnalysis_Surface:
Inheritance graph
[legend]

Public Member Functions

 ShapeAnalysis_Surface (const occ::handle< Geom_Surface > &S)
 Creates an analyzer object on the basis of existing surface.
 
void Init (const occ::handle< Geom_Surface > &S)
 Loads existing surface.
 
void Init (const occ::handle< ShapeAnalysis_Surface > &other)
 Reads all the data from another Surface, without recomputing.
 
void SetDomain (const double U1, const double U2, const double V1, const double V2)
 
const occ::handle< Geom_Surface > & Surface () const
 Returns a surface being analyzed.
 
const occ::handle< GeomAdaptor_Surface > & Adaptor3d ()
 Returns the Adaptor. Creates it if not yet done.
 
const occ::handle< GeomAdaptor_Surface > & TrueAdaptor3d () const
 Returns the Adaptor (may be Null if method Adaptor() was not called)
 
double Gap () const
 Returns 3D distance found by one of the following methods. IsDegenerated, DegeneratedValues, ProjectDegenerated (distance between 3D point and found or last (if not found) singularity), IsUClosed, IsVClosed (minimum value of precision to consider the surface to be closed), ValueOfUV (distance between 3D point and found solution).
 
gp_Pnt Value (const double u, const double v)
 Returns a 3D point specified by parameters in surface parametrical space.
 
gp_Pnt Value (const gp_Pnt2d &p2d)
 Returns a 3d point specified by a point in surface parametrical space.
 
bool HasSingularities (const double preci)
 Returns True if the surface has singularities for the given precision (i.e. if there are surface singularities with sizes not greater than precision).
 
int NbSingularities (const double preci)
 Returns the number of singularities for the given precision (i.e. number of surface singularities with sizes not greater than precision).
 
bool Singularity (const int num, double &preci, gp_Pnt &P3d, gp_Pnt2d &firstP2d, gp_Pnt2d &lastP2d, double &firstpar, double &lastpar, bool &uisodeg)
 Returns the characteristics of the singularity specified by its rank number <num>. That means, that it is not necessary for <num> to be in the range [1, NbSingularities] but must be not greater than possible (see ComputeSingularities). The returned characteristics are: preci: the smallest precision with which the iso-line is considered as degenerated, P3d: 3D point of singularity (middle point of the surface iso-line), firstP2d and lastP2d: first and last 2D points of the iso-line in parametrical surface, firstpar and lastpar: first and last parameters of the iso-line in parametrical surface, uisodeg: if the degenerated iso-line is U-iso (True) or V-iso (False). Returns False if <num> is out of range, else returns True.
 
bool IsDegenerated (const gp_Pnt &P3d, const double preci)
 Returns True if there is at least one surface boundary which is considered as degenerated with <preci> and distance between P3d and corresponding singular point is less than <preci>
 
bool DegeneratedValues (const gp_Pnt &P3d, const double preci, gp_Pnt2d &firstP2d, gp_Pnt2d &lastP2d, double &firstpar, double &lastpar, const bool forward=true)
 Returns True if there is at least one surface iso-line which is considered as degenerated with <preci> and distance between P3d and corresponding singular point is less than <preci> (like IsDegenerated). Returns characteristics of the first found boundary matching those criteria.
 
bool ProjectDegenerated (const gp_Pnt &P3d, const double preci, const gp_Pnt2d &neighbour, gp_Pnt2d &result)
 Projects a point <P3d> on a singularity by computing one of the coordinates of preliminary computed <result>.
 
bool ProjectDegenerated (const int nbrPnt, const NCollection_Sequence< gp_Pnt > &points, NCollection_Sequence< gp_Pnt2d > &pnt2d, const double preci, const bool direct)
 Checks points at the beginning (direct is True) or end (direct is False) of array <points> to lie in singularity of surface, and if yes, adjusts the indeterminate 2d coordinate of these points by nearest point which is not in singularity. Returns True if some points were adjusted.
 
bool IsDegenerated (const gp_Pnt2d &p2d1, const gp_Pnt2d &p2d2, const double tol, const double ratio)
 Returns True if straight pcurve going from point p2d1 to p2d2 is degenerate, i.e. lies in the singularity of the surface. NOTE: it uses another method of detecting singularity than used by ComputeSingularities() et al.! For that, maximums of distances between points p2d1, p2d2 and 0.5*(p2d1+p2d2) and between corresponding 3d points are computed. The pcurve (p2d1, p2d2) is considered as degenerate if:
 
void Bounds (double &ufirst, double &ulast, double &vfirst, double &vlast) const
 Returns the bounds of the surface (from Bounds from Surface, but buffered)
 
void ComputeBoundIsos ()
 Computes bound isos (protected against exceptions)
 
occ::handle< Geom_CurveUIso (const double U)
 Returns a U-Iso. Null if not possible or failed Remark : bound isos are buffered.
 
occ::handle< Geom_CurveVIso (const double V)
 Returns a V-Iso. Null if not possible or failed Remark : bound isos are buffered.
 
bool IsUClosed (const double preci=-1)
 Tells if the Surface is spatially closed in U with given precision. If <preci> < 0 then Precision::Confusion is used. If Geom_Surface says that the surface is U-closed, this method also says this. Otherwise additional analysis is performed, comparing given precision with the following distances:
 
bool IsVClosed (const double preci=-1)
 Tells if the Surface is spatially closed in V with given precision. If <preci> < 0 then Precision::Confusion is used. If Geom_Surface says that the surface is V-closed, this method also says this. Otherwise additional analysis is performed, comparing given precision with the following distances:
 
gp_Pnt2d ValueOfUV (const gp_Pnt &P3D, const double preci)
 Computes the parameters in the surface parametrical space of 3D point. The result is parameters of the point projected onto the surface. This method enhances functionality provided by the standard tool GeomAPI_ProjectPointOnSurface by treatment of cases when the projected point is near to the surface boundaries and when this standard tool fails.
 
gp_Pnt2d NextValueOfUV (const gp_Pnt2d &p2dPrev, const gp_Pnt &P3D, const double preci, const double maxpreci=-1.0)
 Projects a point P3D on the surface. Does the same thing as ValueOfUV but tries to optimize computations by taking into account previous point <p2dPrev>: makes a step by UV and tries Newton algorithm. If <maxpreci> >0. and distance between solution and P3D is greater than <maxpreci>, that solution is considered as bad, and ValueOfUV() is used. If not succeeded, calls ValueOfUV()
 
double UVFromIso (const gp_Pnt &P3D, const double preci, double &U, double &V)
 Tries a refinement of an already computed couple (U,V) by using projecting 3D point on iso-lines:
 
double UCloseVal () const
 Returns minimum value to consider the surface as U-closed.
 
double VCloseVal () const
 Returns minimum value to consider the surface as V-closed.
 
const Bnd_BoxGetBoxUF ()
 
const Bnd_BoxGetBoxUL ()
 
const Bnd_BoxGetBoxVF ()
 
const Bnd_BoxGetBoxVL ()
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Attributes

occ::handle< Geom_SurfacemySurf
 
occ::handle< GeomAdaptor_SurfacemyAdSur
 
Extrema_ExtPS myExtPS
 
bool myExtOK
 
int myNbDeg
 
double myPreci [4]
 
gp_Pnt myP3d [4]
 
gp_Pnt2d myFirstP2d [4]
 
gp_Pnt2d myLastP2d [4]
 
double myFirstPar [4]
 
double myLastPar [4]
 
bool myUIsoDeg [4]
 
bool myIsos
 
double myUF
 
double myUL
 
double myVF
 
double myVL
 
occ::handle< Geom_CurvemyIsoUF
 
occ::handle< Geom_CurvemyIsoUL
 
occ::handle< Geom_CurvemyIsoVF
 
occ::handle< Geom_CurvemyIsoVL
 
bool myIsoBoxes
 
Bnd_Box myBndUF
 
Bnd_Box myBndUL
 
Bnd_Box myBndVF
 
Bnd_Box myBndVL
 
double myGap
 
double myUDelt
 
double myVDelt
 
double myUCloseVal
 
double myVCloseVal
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Detailed Description

Complements standard tool Geom_Surface by providing additional functionality for detection surface singularities, checking spatial surface closure and computing projections of 3D points onto a surface.

This tool is optimised: computes most information only once

Constructor & Destructor Documentation

◆ ShapeAnalysis_Surface()

ShapeAnalysis_Surface::ShapeAnalysis_Surface ( const occ::handle< Geom_Surface > & S)

Creates an analyzer object on the basis of existing surface.

Member Function Documentation

◆ Adaptor3d()

const occ::handle< GeomAdaptor_Surface > & ShapeAnalysis_Surface::Adaptor3d ( )

Returns the Adaptor. Creates it if not yet done.

◆ Bounds()

void ShapeAnalysis_Surface::Bounds ( double & ufirst,
double & ulast,
double & vfirst,
double & vlast ) const

Returns the bounds of the surface (from Bounds from Surface, but buffered)

◆ ComputeBoundIsos()

void ShapeAnalysis_Surface::ComputeBoundIsos ( )

Computes bound isos (protected against exceptions)

◆ DegeneratedValues()

bool ShapeAnalysis_Surface::DegeneratedValues ( const gp_Pnt & P3d,
const double preci,
gp_Pnt2d & firstP2d,
gp_Pnt2d & lastP2d,
double & firstpar,
double & lastpar,
const bool forward = true )

Returns True if there is at least one surface iso-line which is considered as degenerated with <preci> and distance between P3d and corresponding singular point is less than <preci> (like IsDegenerated). Returns characteristics of the first found boundary matching those criteria.

◆ Gap()

double ShapeAnalysis_Surface::Gap ( ) const

Returns 3D distance found by one of the following methods. IsDegenerated, DegeneratedValues, ProjectDegenerated (distance between 3D point and found or last (if not found) singularity), IsUClosed, IsVClosed (minimum value of precision to consider the surface to be closed), ValueOfUV (distance between 3D point and found solution).

◆ GetBoxUF()

const Bnd_Box & ShapeAnalysis_Surface::GetBoxUF ( )

◆ GetBoxUL()

const Bnd_Box & ShapeAnalysis_Surface::GetBoxUL ( )

◆ GetBoxVF()

const Bnd_Box & ShapeAnalysis_Surface::GetBoxVF ( )

◆ GetBoxVL()

const Bnd_Box & ShapeAnalysis_Surface::GetBoxVL ( )

◆ HasSingularities()

bool ShapeAnalysis_Surface::HasSingularities ( const double preci)

Returns True if the surface has singularities for the given precision (i.e. if there are surface singularities with sizes not greater than precision).

◆ Init() [1/2]

void ShapeAnalysis_Surface::Init ( const occ::handle< Geom_Surface > & S)

Loads existing surface.

◆ Init() [2/2]

void ShapeAnalysis_Surface::Init ( const occ::handle< ShapeAnalysis_Surface > & other)

Reads all the data from another Surface, without recomputing.

◆ IsDegenerated() [1/2]

bool ShapeAnalysis_Surface::IsDegenerated ( const gp_Pnt & P3d,
const double preci )

Returns True if there is at least one surface boundary which is considered as degenerated with <preci> and distance between P3d and corresponding singular point is less than <preci>

◆ IsDegenerated() [2/2]

bool ShapeAnalysis_Surface::IsDegenerated ( const gp_Pnt2d & p2d1,
const gp_Pnt2d & p2d2,
const double tol,
const double ratio )

Returns True if straight pcurve going from point p2d1 to p2d2 is degenerate, i.e. lies in the singularity of the surface. NOTE: it uses another method of detecting singularity than used by ComputeSingularities() et al.! For that, maximums of distances between points p2d1, p2d2 and 0.5*(p2d1+p2d2) and between corresponding 3d points are computed. The pcurve (p2d1, p2d2) is considered as degenerate if:

  • max distance in 3d is less than <tol>
  • max distance in 2d is at least <ratio> times greater than the Resolution computed from max distance in 3d (max3d < tol && max2d > ratio * Resolution(max3d)) NOTE: <ratio> should be >1 (e.g. 10)

◆ IsUClosed()

bool ShapeAnalysis_Surface::IsUClosed ( const double preci = -1)

Tells if the Surface is spatially closed in U with given precision. If <preci> < 0 then Precision::Confusion is used. If Geom_Surface says that the surface is U-closed, this method also says this. Otherwise additional analysis is performed, comparing given precision with the following distances:

  • periodic B-Splines are closed,
  • polynomial B-Spline with boundary multiplicities degree+1 and Bezier - maximum distance between poles,
  • rational B-Spline or one with boundary multiplicities not degree+1 - maximum distance computed at knots and their middles,
  • surface of extrusion - distance between ends of basis curve,
  • other (RectangularTrimmed and Offset) - maximum distance computed at 100 equi-distanted points.

◆ IsVClosed()

bool ShapeAnalysis_Surface::IsVClosed ( const double preci = -1)

Tells if the Surface is spatially closed in V with given precision. If <preci> < 0 then Precision::Confusion is used. If Geom_Surface says that the surface is V-closed, this method also says this. Otherwise additional analysis is performed, comparing given precision with the following distances:

  • periodic B-Splines are closed,
  • polynomial B-Spline with boundary multiplicities degree+1 and Bezier - maximum distance between poles,
  • rational B-Spline or one with boundary multiplicities not degree+1 - maximum distance computed at knots and their middles,
  • surface of revolution - distance between ends of basis curve,
  • other (RectangularTrimmed and Offset) - maximum distance computed at 100 equi-distanted points.

◆ NbSingularities()

int ShapeAnalysis_Surface::NbSingularities ( const double preci)

Returns the number of singularities for the given precision (i.e. number of surface singularities with sizes not greater than precision).

◆ NextValueOfUV()

gp_Pnt2d ShapeAnalysis_Surface::NextValueOfUV ( const gp_Pnt2d & p2dPrev,
const gp_Pnt & P3D,
const double preci,
const double maxpreci = -1.0 )

Projects a point P3D on the surface. Does the same thing as ValueOfUV but tries to optimize computations by taking into account previous point <p2dPrev>: makes a step by UV and tries Newton algorithm. If <maxpreci> >0. and distance between solution and P3D is greater than <maxpreci>, that solution is considered as bad, and ValueOfUV() is used. If not succeeded, calls ValueOfUV()

◆ ProjectDegenerated() [1/2]

bool ShapeAnalysis_Surface::ProjectDegenerated ( const gp_Pnt & P3d,
const double preci,
const gp_Pnt2d & neighbour,
gp_Pnt2d & result )

Projects a point <P3d> on a singularity by computing one of the coordinates of preliminary computed <result>.

Finds the iso-line which is considered as degenerated with <preci> and a. distance between P3d and corresponding singular point is less than <preci> (like IsDegenerated) or b. difference between already computed <result>'s coordinate and iso-coordinate of the boundary is less than 2D resolution (computed from <preci> by Geom_Adaptor). Then sets not yet computed <result>'s coordinate taking it from <neighbour> and returns True.

◆ ProjectDegenerated() [2/2]

bool ShapeAnalysis_Surface::ProjectDegenerated ( const int nbrPnt,
const NCollection_Sequence< gp_Pnt > & points,
NCollection_Sequence< gp_Pnt2d > & pnt2d,
const double preci,
const bool direct )

Checks points at the beginning (direct is True) or end (direct is False) of array <points> to lie in singularity of surface, and if yes, adjusts the indeterminate 2d coordinate of these points by nearest point which is not in singularity. Returns True if some points were adjusted.

◆ SetDomain()

void ShapeAnalysis_Surface::SetDomain ( const double U1,
const double U2,
const double V1,
const double V2 )

◆ Singularity()

bool ShapeAnalysis_Surface::Singularity ( const int num,
double & preci,
gp_Pnt & P3d,
gp_Pnt2d & firstP2d,
gp_Pnt2d & lastP2d,
double & firstpar,
double & lastpar,
bool & uisodeg )

Returns the characteristics of the singularity specified by its rank number <num>. That means, that it is not necessary for <num> to be in the range [1, NbSingularities] but must be not greater than possible (see ComputeSingularities). The returned characteristics are: preci: the smallest precision with which the iso-line is considered as degenerated, P3d: 3D point of singularity (middle point of the surface iso-line), firstP2d and lastP2d: first and last 2D points of the iso-line in parametrical surface, firstpar and lastpar: first and last parameters of the iso-line in parametrical surface, uisodeg: if the degenerated iso-line is U-iso (True) or V-iso (False). Returns False if <num> is out of range, else returns True.

◆ Surface()

const occ::handle< Geom_Surface > & ShapeAnalysis_Surface::Surface ( ) const

Returns a surface being analyzed.

◆ TrueAdaptor3d()

const occ::handle< GeomAdaptor_Surface > & ShapeAnalysis_Surface::TrueAdaptor3d ( ) const

Returns the Adaptor (may be Null if method Adaptor() was not called)

◆ UCloseVal()

double ShapeAnalysis_Surface::UCloseVal ( ) const

Returns minimum value to consider the surface as U-closed.

◆ UIso()

occ::handle< Geom_Curve > ShapeAnalysis_Surface::UIso ( const double U)

Returns a U-Iso. Null if not possible or failed Remark : bound isos are buffered.

◆ UVFromIso()

double ShapeAnalysis_Surface::UVFromIso ( const gp_Pnt & P3D,
const double preci,
double & U,
double & V )

Tries a refinement of an already computed couple (U,V) by using projecting 3D point on iso-lines:

  1. boundaries of the surface,
  2. iso-lines passing through (U,V)
  3. iteratively received iso-lines passing through new U and new V (number of iterations is limited by 5 in each direction) Returns the best resulting distance between P3D and Value(U,V) in the case of success. Else, returns a very great value

◆ Value() [1/2]

gp_Pnt ShapeAnalysis_Surface::Value ( const double u,
const double v )

Returns a 3D point specified by parameters in surface parametrical space.

◆ Value() [2/2]

gp_Pnt ShapeAnalysis_Surface::Value ( const gp_Pnt2d & p2d)

Returns a 3d point specified by a point in surface parametrical space.

◆ ValueOfUV()

gp_Pnt2d ShapeAnalysis_Surface::ValueOfUV ( const gp_Pnt & P3D,
const double preci )

Computes the parameters in the surface parametrical space of 3D point. The result is parameters of the point projected onto the surface. This method enhances functionality provided by the standard tool GeomAPI_ProjectPointOnSurface by treatment of cases when the projected point is near to the surface boundaries and when this standard tool fails.

◆ VCloseVal()

double ShapeAnalysis_Surface::VCloseVal ( ) const

Returns minimum value to consider the surface as V-closed.

◆ VIso()

occ::handle< Geom_Curve > ShapeAnalysis_Surface::VIso ( const double V)

Returns a V-Iso. Null if not possible or failed Remark : bound isos are buffered.

Field Documentation

◆ myAdSur

occ::handle<GeomAdaptor_Surface> ShapeAnalysis_Surface::myAdSur
protected

◆ myBndUF

Bnd_Box ShapeAnalysis_Surface::myBndUF
protected

◆ myBndUL

Bnd_Box ShapeAnalysis_Surface::myBndUL
protected

◆ myBndVF

Bnd_Box ShapeAnalysis_Surface::myBndVF
protected

◆ myBndVL

Bnd_Box ShapeAnalysis_Surface::myBndVL
protected

◆ myExtOK

bool ShapeAnalysis_Surface::myExtOK
protected

◆ myExtPS

Extrema_ExtPS ShapeAnalysis_Surface::myExtPS
protected

◆ myFirstP2d

gp_Pnt2d ShapeAnalysis_Surface::myFirstP2d[4]
protected

◆ myFirstPar

double ShapeAnalysis_Surface::myFirstPar[4]
protected

◆ myGap

double ShapeAnalysis_Surface::myGap
protected

◆ myIsoBoxes

bool ShapeAnalysis_Surface::myIsoBoxes
protected

◆ myIsos

bool ShapeAnalysis_Surface::myIsos
protected

◆ myIsoUF

occ::handle<Geom_Curve> ShapeAnalysis_Surface::myIsoUF
protected

◆ myIsoUL

occ::handle<Geom_Curve> ShapeAnalysis_Surface::myIsoUL
protected

◆ myIsoVF

occ::handle<Geom_Curve> ShapeAnalysis_Surface::myIsoVF
protected

◆ myIsoVL

occ::handle<Geom_Curve> ShapeAnalysis_Surface::myIsoVL
protected

◆ myLastP2d

gp_Pnt2d ShapeAnalysis_Surface::myLastP2d[4]
protected

◆ myLastPar

double ShapeAnalysis_Surface::myLastPar[4]
protected

◆ myNbDeg

int ShapeAnalysis_Surface::myNbDeg
protected

◆ myP3d

gp_Pnt ShapeAnalysis_Surface::myP3d[4]
protected

◆ myPreci

double ShapeAnalysis_Surface::myPreci[4]
protected

◆ mySurf

occ::handle<Geom_Surface> ShapeAnalysis_Surface::mySurf
protected

◆ myUCloseVal

double ShapeAnalysis_Surface::myUCloseVal
protected

◆ myUDelt

double ShapeAnalysis_Surface::myUDelt
protected

◆ myUF

double ShapeAnalysis_Surface::myUF
protected

◆ myUIsoDeg

bool ShapeAnalysis_Surface::myUIsoDeg[4]
protected

◆ myUL

double ShapeAnalysis_Surface::myUL
protected

◆ myVCloseVal

double ShapeAnalysis_Surface::myVCloseVal
protected

◆ myVDelt

double ShapeAnalysis_Surface::myVDelt
protected

◆ myVF

double ShapeAnalysis_Surface::myVF
protected

◆ myVL

double ShapeAnalysis_Surface::myVL
protected

The documentation for this class was generated from the following file: