mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
@@ -21,49 +21,53 @@
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//-- IntSurf::MakeTransition(Vtgint,Vtgrst,Normale,Transline,Transarc);
|
||||
//--
|
||||
//--
|
||||
//-- tgFirst = Tangente Ligne Intersection
|
||||
//-- tgSecond = Tangenet Restriction
|
||||
//-- Normale = Normale a la surface
|
||||
void IntSurf::MakeTransition (const gp_Vec& TgFirst,
|
||||
const gp_Vec& TgSecond,
|
||||
const gp_Dir& Normale,
|
||||
IntSurf_Transition& TFirst,
|
||||
IntSurf_Transition& TSecond)
|
||||
void IntSurf::MakeTransition(const gp_Vec& TgFirst,
|
||||
const gp_Vec& TgSecond,
|
||||
const gp_Dir& Normale,
|
||||
IntSurf_Transition& TFirst,
|
||||
IntSurf_Transition& TSecond)
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
// Effectuer le produit mixte normale, tangente 1, tangente 2
|
||||
// pour avoir le type de la transition.
|
||||
|
||||
gp_Vec pvect(TgSecond.Crossed(TgFirst));
|
||||
|
||||
Standard_Real NTgSecond = TgSecond.Magnitude();
|
||||
Standard_Real NTgFirst = TgFirst.Magnitude();
|
||||
Standard_Real NTgSecondNTgFirstAngular = NTgSecond*NTgFirst*Precision::Angular();
|
||||
|
||||
if(NTgFirst <= Precision::Confusion()) {
|
||||
TFirst.SetValue(Standard_True,IntSurf_Undecided);
|
||||
TSecond.SetValue(Standard_True,IntSurf_Undecided);
|
||||
gp_Vec pvect(TgSecond.Crossed(TgFirst));
|
||||
|
||||
Standard_Real NTgSecond = TgSecond.Magnitude();
|
||||
Standard_Real NTgFirst = TgFirst.Magnitude();
|
||||
Standard_Real NTgSecondNTgFirstAngular = NTgSecond * NTgFirst * Precision::Angular();
|
||||
|
||||
if (NTgFirst <= Precision::Confusion())
|
||||
{
|
||||
TFirst.SetValue(Standard_True, IntSurf_Undecided);
|
||||
TSecond.SetValue(Standard_True, IntSurf_Undecided);
|
||||
}
|
||||
else if ( (NTgSecond <= Precision::Confusion())
|
||||
|| (pvect.Magnitude()<= NTgSecondNTgFirstAngular)) {
|
||||
TFirst.SetValue(Standard_True,IntSurf_Unknown,TgFirst.Dot(TgSecond)<0.0);
|
||||
TSecond.SetValue(Standard_True,IntSurf_Unknown,TgFirst.Dot(TgSecond)<0.0);
|
||||
else if ((NTgSecond <= Precision::Confusion()) || (pvect.Magnitude() <= NTgSecondNTgFirstAngular))
|
||||
{
|
||||
TFirst.SetValue(Standard_True, IntSurf_Unknown, TgFirst.Dot(TgSecond) < 0.0);
|
||||
TSecond.SetValue(Standard_True, IntSurf_Unknown, TgFirst.Dot(TgSecond) < 0.0);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Standard_Real yu = pvect.Dot(Normale);
|
||||
yu/=NTgSecond*NTgFirst;
|
||||
if (yu>0.0001) {
|
||||
TFirst.SetValue(Standard_False,IntSurf_In);
|
||||
TSecond.SetValue(Standard_False,IntSurf_Out);
|
||||
yu /= NTgSecond * NTgFirst;
|
||||
if (yu > 0.0001)
|
||||
{
|
||||
TFirst.SetValue(Standard_False, IntSurf_In);
|
||||
TSecond.SetValue(Standard_False, IntSurf_Out);
|
||||
}
|
||||
else if(yu<-0.0001) {
|
||||
TFirst.SetValue(Standard_False,IntSurf_Out);
|
||||
TSecond.SetValue(Standard_False,IntSurf_In);
|
||||
else if (yu < -0.0001)
|
||||
{
|
||||
TFirst.SetValue(Standard_False, IntSurf_Out);
|
||||
TSecond.SetValue(Standard_False, IntSurf_In);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
//-- MODIF XAB
|
||||
gp_Vec V1(TgSecond.X() / NTgSecond,TgSecond.Y() / NTgSecond, TgSecond.Z() / NTgSecond);
|
||||
@@ -84,31 +88,24 @@ void IntSurf::MakeTransition (const gp_Vec& TgFirst,
|
||||
TFirst.SetValue(Standard_True,IntSurf_Undecided);
|
||||
TSecond.SetValue(Standard_True,IntSurf_Undecided);
|
||||
}
|
||||
|
||||
#else
|
||||
TFirst.SetValue(Standard_True,IntSurf_Undecided);
|
||||
TSecond.SetValue(Standard_True,IntSurf_Undecided);
|
||||
|
||||
|
||||
#else
|
||||
TFirst.SetValue(Standard_True, IntSurf_Undecided);
|
||||
TSecond.SetValue(Standard_True, IntSurf_Undecided);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPeriod
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void IntSurf::SetPeriod(const Handle(Adaptor3d_Surface)& theFirstSurf,
|
||||
const Handle(Adaptor3d_Surface)& theSecondSurf,
|
||||
Standard_Real theArrOfPeriod[4])
|
||||
Standard_Real theArrOfPeriod[4])
|
||||
{
|
||||
theArrOfPeriod[0] = theFirstSurf->IsUPeriodic()? theFirstSurf->UPeriod() : 0.0;
|
||||
theArrOfPeriod[1] = theFirstSurf->IsVPeriodic()? theFirstSurf->VPeriod() : 0.0;
|
||||
theArrOfPeriod[2] = theSecondSurf->IsUPeriodic()? theSecondSurf->UPeriod() : 0.0;
|
||||
theArrOfPeriod[3] = theSecondSurf->IsVPeriodic()? theSecondSurf->VPeriod() : 0.0;
|
||||
theArrOfPeriod[0] = theFirstSurf->IsUPeriodic() ? theFirstSurf->UPeriod() : 0.0;
|
||||
theArrOfPeriod[1] = theFirstSurf->IsVPeriodic() ? theFirstSurf->VPeriod() : 0.0;
|
||||
theArrOfPeriod[2] = theSecondSurf->IsUPeriodic() ? theSecondSurf->UPeriod() : 0.0;
|
||||
theArrOfPeriod[3] = theSecondSurf->IsVPeriodic() ? theSecondSurf->VPeriod() : 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -26,13 +26,11 @@ class gp_Vec;
|
||||
//! This package provides resources for
|
||||
//! all the packages concerning the intersection
|
||||
//! between surfaces.
|
||||
class IntSurf
|
||||
class IntSurf
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Computes the transition of the intersection point
|
||||
//! between the two lines.
|
||||
//! TgFirst is the tangent vector of the first line.
|
||||
@@ -41,7 +39,11 @@ public:
|
||||
//! product TgFirst^TgSecond.
|
||||
//! TFirst is the transition of the point on the first line.
|
||||
//! TSecond is the transition of the point on the second line.
|
||||
Standard_EXPORT static void MakeTransition (const gp_Vec& TgFirst, const gp_Vec& TgSecond, const gp_Dir& Normal, IntSurf_Transition& TFirst, IntSurf_Transition& TSecond);
|
||||
Standard_EXPORT static void MakeTransition(const gp_Vec& TgFirst,
|
||||
const gp_Vec& TgSecond,
|
||||
const gp_Dir& Normal,
|
||||
IntSurf_Transition& TFirst,
|
||||
IntSurf_Transition& TSecond);
|
||||
|
||||
//! Fills theArrOfPeriod array by the period values of theFirstSurf and theSecondSurf.
|
||||
//! [0] = U-period of theFirstSurf,
|
||||
@@ -53,8 +55,7 @@ public:
|
||||
//! its period is considered to be equal to 0.
|
||||
Standard_EXPORT static void SetPeriod(const Handle(Adaptor3d_Surface)& theFirstSurf,
|
||||
const Handle(Adaptor3d_Surface)& theSecondSurf,
|
||||
Standard_Real theArrOfPeriod[4]);
|
||||
|
||||
Standard_Real theArrOfPeriod[4]);
|
||||
};
|
||||
|
||||
#endif // _IntSurf_HeaderFile
|
||||
|
@@ -22,49 +22,28 @@
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
//! creation d 'un couple de 2 entiers
|
||||
class IntSurf_Couple
|
||||
class IntSurf_Couple
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
IntSurf_Couple();
|
||||
|
||||
IntSurf_Couple(const Standard_Integer Index1, const Standard_Integer Index2);
|
||||
|
||||
IntSurf_Couple();
|
||||
|
||||
IntSurf_Couple(const Standard_Integer Index1, const Standard_Integer Index2);
|
||||
|
||||
//! returns the first element
|
||||
Standard_Integer First() const;
|
||||
|
||||
Standard_Integer First() const;
|
||||
|
||||
//! returns the Second element
|
||||
Standard_Integer Second() const;
|
||||
|
||||
|
||||
|
||||
Standard_Integer Second() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Integer firstInteger;
|
||||
Standard_Integer secondInteger;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_Couple.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_Couple_HeaderFile
|
||||
|
@@ -12,24 +12,24 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline IntSurf_Couple::IntSurf_Couple() :
|
||||
firstInteger(0),secondInteger(0)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
inline IntSurf_Couple::IntSurf_Couple(const Standard_Integer Index1,
|
||||
const Standard_Integer Index2):
|
||||
firstInteger(Index1),secondInteger(Index2)
|
||||
{}
|
||||
inline IntSurf_Couple::IntSurf_Couple()
|
||||
: firstInteger(0),
|
||||
secondInteger(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline IntSurf_Couple::IntSurf_Couple(const Standard_Integer Index1, const Standard_Integer Index2)
|
||||
: firstInteger(Index1),
|
||||
secondInteger(Index2)
|
||||
{
|
||||
}
|
||||
|
||||
inline Standard_Integer IntSurf_Couple::First() const
|
||||
{
|
||||
return firstInteger;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntSurf_Couple::Second() const {
|
||||
inline Standard_Integer IntSurf_Couple::Second() const
|
||||
{
|
||||
return secondInteger;
|
||||
}
|
||||
|
||||
|
@@ -12,32 +12,36 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <IntSurf_InteriorPoint.hxx>
|
||||
|
||||
IntSurf_InteriorPoint::IntSurf_InteriorPoint ()
|
||||
: paramu(0.0),
|
||||
paramv(0.0)
|
||||
IntSurf_InteriorPoint::IntSurf_InteriorPoint()
|
||||
: paramu(0.0),
|
||||
paramv(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
IntSurf_InteriorPoint::IntSurf_InteriorPoint(const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const gp_Vec& Direc,
|
||||
const gp_Vec2d& Direc2d)
|
||||
: point(P),
|
||||
paramu(U),
|
||||
paramv(V),
|
||||
direc(Direc),
|
||||
direc2d(Direc2d)
|
||||
|
||||
IntSurf_InteriorPoint::IntSurf_InteriorPoint (const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const gp_Vec& Direc,
|
||||
const gp_Vec2d& Direc2d):
|
||||
point(P),paramu(U),paramv(V),direc(Direc),direc2d(Direc2d)
|
||||
{
|
||||
}
|
||||
|
||||
{}
|
||||
|
||||
void IntSurf_InteriorPoint::SetValue (const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const gp_Vec& Direc,
|
||||
const gp_Vec2d& Direc2d) {
|
||||
void IntSurf_InteriorPoint::SetValue(const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const gp_Vec& Direc,
|
||||
const gp_Vec2d& Direc2d)
|
||||
{
|
||||
|
||||
point = P;
|
||||
paramu = U;
|
||||
@@ -45,6 +49,3 @@ void IntSurf_InteriorPoint::SetValue (const gp_Pnt& P,
|
||||
direc = Direc;
|
||||
direc2d = Direc2d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -24,76 +24,63 @@
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
|
||||
|
||||
//! Definition of a point solution of the
|
||||
//! intersection between an implicit an a
|
||||
//! parametrised surface. These points are
|
||||
//! passing points on the intersection lines,
|
||||
//! or starting points for the closed lines
|
||||
//! on the parametrised surface.
|
||||
class IntSurf_InteriorPoint
|
||||
class IntSurf_InteriorPoint
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_InteriorPoint();
|
||||
|
||||
Standard_EXPORT IntSurf_InteriorPoint(const gp_Pnt& P, const Standard_Real U, const Standard_Real V, const gp_Vec& Direc, const gp_Vec2d& Direc2d);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Pnt& P, const Standard_Real U, const Standard_Real V, const gp_Vec& Direc, const gp_Vec2d& Direc2d);
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_InteriorPoint(const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const gp_Vec& Direc,
|
||||
const gp_Vec2d& Direc2d);
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const gp_Vec& Direc,
|
||||
const gp_Vec2d& Direc2d);
|
||||
|
||||
//! Returns the 3d coordinates of the interior point.
|
||||
const gp_Pnt& Value() const;
|
||||
|
||||
const gp_Pnt& Value() const;
|
||||
|
||||
//! Returns the parameters of the interior point on the
|
||||
//! parametric surface.
|
||||
void Parameters (Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
void Parameters(Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
//! Returns the first parameter of the interior point on the
|
||||
//! parametric surface.
|
||||
Standard_Real UParameter() const;
|
||||
|
||||
Standard_Real UParameter() const;
|
||||
|
||||
//! Returns the second parameter of the interior point on the
|
||||
//! parametric surface.
|
||||
Standard_Real VParameter() const;
|
||||
|
||||
Standard_Real VParameter() const;
|
||||
|
||||
//! Returns the tangent at the intersection in 3d space
|
||||
//! associated to the interior point.
|
||||
const gp_Vec& Direction() const;
|
||||
|
||||
const gp_Vec& Direction() const;
|
||||
|
||||
//! Returns the tangent at the intersection in the parametric
|
||||
//! space of the parametric surface.
|
||||
const gp_Vec2d& Direction2d() const;
|
||||
|
||||
|
||||
|
||||
const gp_Vec2d& Direction2d() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
gp_Pnt point;
|
||||
gp_Pnt point;
|
||||
Standard_Real paramu;
|
||||
Standard_Real paramv;
|
||||
gp_Vec direc;
|
||||
gp_Vec2d direc2d;
|
||||
|
||||
|
||||
gp_Vec direc;
|
||||
gp_Vec2d direc2d;
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_InteriorPoint.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_InteriorPoint_HeaderFile
|
||||
|
@@ -12,39 +12,38 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline const gp_Pnt& IntSurf_InteriorPoint::Value () const {
|
||||
inline const gp_Pnt& IntSurf_InteriorPoint::Value() const
|
||||
{
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_InteriorPoint::Parameters (Standard_Real& U,
|
||||
Standard_Real& V) const {
|
||||
inline void IntSurf_InteriorPoint::Parameters(Standard_Real& U, Standard_Real& V) const
|
||||
{
|
||||
U = paramu;
|
||||
V = paramv;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntSurf_InteriorPoint::UParameter () const {
|
||||
inline Standard_Real IntSurf_InteriorPoint::UParameter() const
|
||||
{
|
||||
|
||||
return paramu;
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Real IntSurf_InteriorPoint::VParameter () const {
|
||||
inline Standard_Real IntSurf_InteriorPoint::VParameter() const
|
||||
{
|
||||
|
||||
return paramv;
|
||||
}
|
||||
|
||||
|
||||
inline const gp_Vec& IntSurf_InteriorPoint::Direction () const {
|
||||
inline const gp_Vec& IntSurf_InteriorPoint::Direction() const
|
||||
{
|
||||
|
||||
return direc;
|
||||
}
|
||||
|
||||
|
||||
inline const gp_Vec2d& IntSurf_InteriorPoint::Direction2d () const {
|
||||
inline const gp_Vec2d& IntSurf_InteriorPoint::Direction2d() const
|
||||
{
|
||||
|
||||
return direc2d;
|
||||
}
|
||||
|
||||
|
@@ -25,56 +25,35 @@
|
||||
#include <gp_Dir2d.hxx>
|
||||
class IntSurf_InteriorPoint;
|
||||
|
||||
|
||||
//! This class provides a tool on the "interior point"
|
||||
//! that can be used to instantiates the Walking
|
||||
//! algorithms (see package IntWalk).
|
||||
class IntSurf_InteriorPointTool
|
||||
class IntSurf_InteriorPointTool
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Returns the 3d coordinates of the starting point.
|
||||
static gp_Pnt Value3d (const IntSurf_InteriorPoint& PStart);
|
||||
|
||||
static gp_Pnt Value3d(const IntSurf_InteriorPoint& PStart);
|
||||
|
||||
//! Returns the <U,V> parameters which are associated
|
||||
//! with <P>
|
||||
//! it's the parameters which start the marching algorithm
|
||||
static void Value2d (const IntSurf_InteriorPoint& PStart, Standard_Real& U, Standard_Real& V);
|
||||
|
||||
static void Value2d(const IntSurf_InteriorPoint& PStart, Standard_Real& U, Standard_Real& V);
|
||||
|
||||
//! returns the tangent at the intersection in 3d space
|
||||
//! associated to <P>
|
||||
static gp_Vec Direction3d (const IntSurf_InteriorPoint& PStart);
|
||||
|
||||
static gp_Vec Direction3d(const IntSurf_InteriorPoint& PStart);
|
||||
|
||||
//! returns the tangent at the intersection in the
|
||||
//! parametric space of the parametrized surface.This tangent
|
||||
//! is associated to the value2d
|
||||
static gp_Dir2d Direction2d (const IntSurf_InteriorPoint& PStart);
|
||||
|
||||
|
||||
|
||||
static gp_Dir2d Direction2d(const IntSurf_InteriorPoint& PStart);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_InteriorPointTool.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_InteriorPointTool_HeaderFile
|
||||
|
@@ -17,30 +17,27 @@
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
|
||||
inline gp_Pnt IntSurf_InteriorPointTool::Value3d
|
||||
(const IntSurf_InteriorPoint& PStart)
|
||||
inline gp_Pnt IntSurf_InteriorPointTool::Value3d(const IntSurf_InteriorPoint& PStart)
|
||||
{
|
||||
|
||||
return PStart.Value();
|
||||
}
|
||||
|
||||
inline void IntSurf_InteriorPointTool::Value2d
|
||||
(const IntSurf_InteriorPoint& PStart,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
inline void IntSurf_InteriorPointTool::Value2d(const IntSurf_InteriorPoint& PStart,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
{
|
||||
PStart.Parameters(U,V);
|
||||
PStart.Parameters(U, V);
|
||||
}
|
||||
|
||||
inline gp_Vec IntSurf_InteriorPointTool::Direction3d
|
||||
(const IntSurf_InteriorPoint& PStart) {
|
||||
inline gp_Vec IntSurf_InteriorPointTool::Direction3d(const IntSurf_InteriorPoint& PStart)
|
||||
{
|
||||
|
||||
return PStart.Direction();
|
||||
}
|
||||
|
||||
inline gp_Dir2d IntSurf_InteriorPointTool::Direction2d
|
||||
(const IntSurf_InteriorPoint& PStart) {
|
||||
inline gp_Dir2d IntSurf_InteriorPointTool::Direction2d(const IntSurf_InteriorPoint& PStart)
|
||||
{
|
||||
|
||||
return PStart.Direction2d();
|
||||
}
|
||||
|
||||
|
@@ -12,42 +12,43 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IntSurf_LineOn2S.hxx>
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntSurf_LineOn2S,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(IntSurf_LineOn2S, Standard_Transient)
|
||||
|
||||
IntSurf_LineOn2S::
|
||||
IntSurf_LineOn2S(const IntSurf_Allocator& theAllocator) : mySeq(theAllocator)
|
||||
IntSurf_LineOn2S::IntSurf_LineOn2S(const IntSurf_Allocator& theAllocator)
|
||||
: mySeq(theAllocator)
|
||||
{
|
||||
myBuv1.SetWhole();
|
||||
myBuv2.SetWhole();
|
||||
myBxyz.SetWhole();
|
||||
}
|
||||
|
||||
|
||||
Handle(IntSurf_LineOn2S) IntSurf_LineOn2S::Split (const Standard_Integer Index)
|
||||
Handle(IntSurf_LineOn2S) IntSurf_LineOn2S::Split(const Standard_Integer Index)
|
||||
{
|
||||
IntSurf_SequenceOfPntOn2S SS;
|
||||
mySeq.Split(Index,SS);
|
||||
Handle(IntSurf_LineOn2S) NS = new IntSurf_LineOn2S ();
|
||||
Standard_Integer i;
|
||||
Standard_Integer leng = SS.Length();
|
||||
for (i=1; i<=leng; i++) {
|
||||
mySeq.Split(Index, SS);
|
||||
Handle(IntSurf_LineOn2S) NS = new IntSurf_LineOn2S();
|
||||
Standard_Integer i;
|
||||
Standard_Integer leng = SS.Length();
|
||||
for (i = 1; i <= leng; i++)
|
||||
{
|
||||
NS->Add(SS(i));
|
||||
}
|
||||
return NS;
|
||||
}
|
||||
|
||||
|
||||
void IntSurf_LineOn2S::InsertBefore(const Standard_Integer index, const IntSurf_PntOn2S& P) {
|
||||
if(index>mySeq.Length()) {
|
||||
void IntSurf_LineOn2S::InsertBefore(const Standard_Integer index, const IntSurf_PntOn2S& P)
|
||||
{
|
||||
if (index > mySeq.Length())
|
||||
{
|
||||
mySeq.Append(P);
|
||||
}
|
||||
else {
|
||||
mySeq.InsertBefore(index,P);
|
||||
else
|
||||
{
|
||||
mySeq.InsertBefore(index, P);
|
||||
}
|
||||
|
||||
if (!myBxyz.IsWhole())
|
||||
@@ -66,7 +67,8 @@ void IntSurf_LineOn2S::InsertBefore(const Standard_Integer index, const IntSurf_
|
||||
}
|
||||
}
|
||||
|
||||
void IntSurf_LineOn2S::RemovePoint(const Standard_Integer index) {
|
||||
void IntSurf_LineOn2S::RemovePoint(const Standard_Integer index)
|
||||
{
|
||||
mySeq.Remove(index);
|
||||
myBuv1.SetWhole();
|
||||
myBuv2.SetWhole();
|
||||
@@ -86,32 +88,34 @@ Standard_Boolean IntSurf_LineOn2S::IsOutBox(const gp_Pnt& Pxyz)
|
||||
}
|
||||
Standard_Real x0, y0, z0, x1, y1, z1;
|
||||
myBxyz.Get(x0, y0, z0, x1, y1, z1);
|
||||
x1 -= x0; y1 -= y0; z1 -= z0;
|
||||
if (x1>y1)
|
||||
x1 -= x0;
|
||||
y1 -= y0;
|
||||
z1 -= z0;
|
||||
if (x1 > y1)
|
||||
{
|
||||
if (x1>z1)
|
||||
if (x1 > z1)
|
||||
{
|
||||
myBxyz.Enlarge(x1*0.01);
|
||||
myBxyz.Enlarge(x1 * 0.01);
|
||||
}
|
||||
else
|
||||
{
|
||||
myBxyz.Enlarge(z1*0.01);
|
||||
myBxyz.Enlarge(z1 * 0.01);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (y1>z1)
|
||||
if (y1 > z1)
|
||||
{
|
||||
myBxyz.Enlarge(y1*0.01);
|
||||
myBxyz.Enlarge(y1 * 0.01);
|
||||
}
|
||||
else
|
||||
{
|
||||
myBxyz.Enlarge(z1*0.01);
|
||||
myBxyz.Enlarge(z1 * 0.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
Standard_Boolean out = myBxyz.IsOut(Pxyz);
|
||||
return(out);
|
||||
return (out);
|
||||
}
|
||||
|
||||
Standard_Boolean IntSurf_LineOn2S::IsOutSurf1Box(const gp_Pnt2d& P1uv)
|
||||
@@ -119,7 +123,7 @@ Standard_Boolean IntSurf_LineOn2S::IsOutSurf1Box(const gp_Pnt2d& P1uv)
|
||||
if (myBuv1.IsWhole())
|
||||
{
|
||||
Standard_Integer n = NbPoints();
|
||||
Standard_Real pu1, pu2, pv1, pv2;
|
||||
Standard_Real pu1, pu2, pv1, pv2;
|
||||
myBuv1.SetVoid();
|
||||
for (Standard_Integer i = 1; i <= n; i++)
|
||||
{
|
||||
@@ -129,17 +133,17 @@ Standard_Boolean IntSurf_LineOn2S::IsOutSurf1Box(const gp_Pnt2d& P1uv)
|
||||
myBuv1.Get(pu1, pv1, pu2, pv2);
|
||||
pu2 -= pu1;
|
||||
pv2 -= pv1;
|
||||
if (pu2>pv2)
|
||||
if (pu2 > pv2)
|
||||
{
|
||||
myBuv1.Enlarge(pu2*0.01);
|
||||
myBuv1.Enlarge(pu2 * 0.01);
|
||||
}
|
||||
else
|
||||
{
|
||||
myBuv1.Enlarge(pv2*0.01);
|
||||
myBuv1.Enlarge(pv2 * 0.01);
|
||||
}
|
||||
}
|
||||
Standard_Boolean out = myBuv1.IsOut(P1uv);
|
||||
return(out);
|
||||
return (out);
|
||||
}
|
||||
|
||||
Standard_Boolean IntSurf_LineOn2S::IsOutSurf2Box(const gp_Pnt2d& P2uv)
|
||||
@@ -147,7 +151,7 @@ Standard_Boolean IntSurf_LineOn2S::IsOutSurf2Box(const gp_Pnt2d& P2uv)
|
||||
if (myBuv2.IsWhole())
|
||||
{
|
||||
Standard_Integer n = NbPoints();
|
||||
Standard_Real pu1, pu2, pv1, pv2;
|
||||
Standard_Real pu1, pu2, pv1, pv2;
|
||||
myBuv2.SetVoid();
|
||||
for (Standard_Integer i = 1; i <= n; i++)
|
||||
{
|
||||
@@ -157,23 +161,21 @@ Standard_Boolean IntSurf_LineOn2S::IsOutSurf2Box(const gp_Pnt2d& P2uv)
|
||||
myBuv2.Get(pu1, pv1, pu2, pv2);
|
||||
pu2 -= pu1;
|
||||
pv2 -= pv1;
|
||||
if (pu2>pv2)
|
||||
if (pu2 > pv2)
|
||||
{
|
||||
myBuv2.Enlarge(pu2*0.01);
|
||||
myBuv2.Enlarge(pu2 * 0.01);
|
||||
}
|
||||
else
|
||||
{
|
||||
myBuv2.Enlarge(pv2*0.01);
|
||||
myBuv2.Enlarge(pv2 * 0.01);
|
||||
}
|
||||
}
|
||||
Standard_Boolean out = myBuv2.IsOut(P2uv);
|
||||
return(out);
|
||||
return (out);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void IntSurf_LineOn2S::Add(const IntSurf_PntOn2S& P)
|
||||
{
|
||||
mySeq.Append(P);
|
||||
@@ -193,14 +195,12 @@ void IntSurf_LineOn2S::Add(const IntSurf_PntOn2S& P)
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetUV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void IntSurf_LineOn2S::SetUV(const Standard_Integer Index,
|
||||
const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V)
|
||||
const Standard_Real U,
|
||||
const Standard_Real V)
|
||||
{
|
||||
mySeq(Index).SetValue(OnFirst, U, V);
|
||||
|
||||
|
@@ -28,52 +28,49 @@
|
||||
#include <Standard_Real.hxx>
|
||||
class IntSurf_PntOn2S;
|
||||
|
||||
|
||||
class IntSurf_LineOn2S;
|
||||
DEFINE_STANDARD_HANDLE(IntSurf_LineOn2S, Standard_Transient)
|
||||
|
||||
|
||||
class IntSurf_LineOn2S : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_LineOn2S(const IntSurf_Allocator& theAllocator = 0);
|
||||
|
||||
|
||||
//! Adds a point in the line.
|
||||
Standard_EXPORT void Add(const IntSurf_PntOn2S& P);
|
||||
|
||||
|
||||
//! Returns the number of points in the line.
|
||||
Standard_Integer NbPoints() const;
|
||||
|
||||
Standard_Integer NbPoints() const;
|
||||
|
||||
//! Returns the point of range Index in the line.
|
||||
const IntSurf_PntOn2S& Value (const Standard_Integer Index) const;
|
||||
|
||||
const IntSurf_PntOn2S& Value(const Standard_Integer Index) const;
|
||||
|
||||
//! Reverses the order of points of the line.
|
||||
void Reverse();
|
||||
|
||||
void Reverse();
|
||||
|
||||
//! Keeps in <me> the points 1 to Index-1, and returns
|
||||
//! the items Index to the end.
|
||||
Standard_EXPORT Handle(IntSurf_LineOn2S) Split (const Standard_Integer Index);
|
||||
|
||||
Standard_EXPORT Handle(IntSurf_LineOn2S) Split(const Standard_Integer Index);
|
||||
|
||||
//! Replaces the point of range Index in the line.
|
||||
void Value (const Standard_Integer Index, const IntSurf_PntOn2S& P);
|
||||
|
||||
void Value(const Standard_Integer Index, const IntSurf_PntOn2S& P);
|
||||
|
||||
//! Sets the 3D point of the Index-th PntOn2S
|
||||
Standard_EXPORT void SetPoint(const Standard_Integer Index, const gp_Pnt& thePnt);
|
||||
|
||||
|
||||
//! Sets the parametric coordinates on one of the surfaces
|
||||
//! of the point of range Index in the line.
|
||||
Standard_EXPORT void SetUV(const Standard_Integer Index,
|
||||
const Standard_Boolean OnFirst,
|
||||
const Standard_Real U, const Standard_Real V);
|
||||
|
||||
void Clear();
|
||||
|
||||
Standard_EXPORT void InsertBefore (const Standard_Integer I, const IntSurf_PntOn2S& P);
|
||||
|
||||
Standard_EXPORT void RemovePoint (const Standard_Integer I);
|
||||
const Standard_Real U,
|
||||
const Standard_Real V);
|
||||
|
||||
void Clear();
|
||||
|
||||
Standard_EXPORT void InsertBefore(const Standard_Integer I, const IntSurf_PntOn2S& P);
|
||||
|
||||
Standard_EXPORT void RemovePoint(const Standard_Integer I);
|
||||
|
||||
//! Returns TRUE if theP is out of the box built from
|
||||
//! the points on 1st surface
|
||||
@@ -86,28 +83,16 @@ public:
|
||||
//! Returns TRUE if theP is out of the box built from 3D-points.
|
||||
Standard_EXPORT Standard_Boolean IsOutBox(const gp_Pnt& theP);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(IntSurf_LineOn2S,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(IntSurf_LineOn2S, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
IntSurf_SequenceOfPntOn2S mySeq;
|
||||
Bnd_Box2d myBuv1;
|
||||
Bnd_Box2d myBuv2;
|
||||
Bnd_Box myBxyz;
|
||||
|
||||
Bnd_Box2d myBuv1;
|
||||
Bnd_Box2d myBuv2;
|
||||
Bnd_Box myBxyz;
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_LineOn2S.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_LineOn2S_HeaderFile
|
||||
|
@@ -14,41 +14,36 @@
|
||||
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
|
||||
inline Standard_Integer IntSurf_LineOn2S::NbPoints() const {
|
||||
inline Standard_Integer IntSurf_LineOn2S::NbPoints() const
|
||||
{
|
||||
|
||||
return mySeq.Length();
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_LineOn2S::Reverse () {
|
||||
inline void IntSurf_LineOn2S::Reverse()
|
||||
{
|
||||
mySeq.Reverse();
|
||||
}
|
||||
|
||||
|
||||
inline const IntSurf_PntOn2S& IntSurf_LineOn2S::
|
||||
Value(const Standard_Integer Index) const
|
||||
inline const IntSurf_PntOn2S& IntSurf_LineOn2S::Value(const Standard_Integer Index) const
|
||||
{
|
||||
return mySeq(Index);
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_LineOn2S::Value(const Standard_Integer Index,
|
||||
const IntSurf_PntOn2S& P)
|
||||
inline void IntSurf_LineOn2S::Value(const Standard_Integer Index, const IntSurf_PntOn2S& P)
|
||||
{
|
||||
mySeq(Index) = P;
|
||||
}
|
||||
|
||||
inline void IntSurf_LineOn2S::SetPoint(const Standard_Integer Index,
|
||||
const gp_Pnt& thePnt)
|
||||
inline void IntSurf_LineOn2S::SetPoint(const Standard_Integer Index, const gp_Pnt& thePnt)
|
||||
{
|
||||
mySeq(Index).SetValue (thePnt);
|
||||
mySeq(Index).SetValue(thePnt);
|
||||
}
|
||||
|
||||
inline void IntSurf_LineOn2S::Clear ()
|
||||
inline void IntSurf_LineOn2S::Clear()
|
||||
{
|
||||
mySeq.Clear();
|
||||
myBuv1.SetWhole();
|
||||
myBuv2.SetWhole();
|
||||
myBxyz.SetWhole();
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef IntSurf_ListIteratorOfListOfPntOn2S_HeaderFile
|
||||
#define IntSurf_ListIteratorOfListOfPntOn2S_HeaderFile
|
||||
|
||||
|
@@ -20,8 +20,7 @@
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
typedef NCollection_List<IntSurf_PntOn2S> IntSurf_ListOfPntOn2S;
|
||||
typedef NCollection_List<IntSurf_PntOn2S> IntSurf_ListOfPntOn2S;
|
||||
typedef NCollection_List<IntSurf_PntOn2S>::Iterator IntSurf_ListIteratorOfListOfPntOn2S;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -12,34 +12,29 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <IntSurf_PathPoint.hxx>
|
||||
#include <StdFail_UndefinedDerivative.hxx>
|
||||
|
||||
IntSurf_PathPoint::IntSurf_PathPoint ():
|
||||
ispass(Standard_True), istgt(Standard_True)
|
||||
IntSurf_PathPoint::IntSurf_PathPoint()
|
||||
: ispass(Standard_True),
|
||||
istgt(Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
IntSurf_PathPoint::IntSurf_PathPoint (const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V):
|
||||
pt(P),ispass(Standard_True),istgt(Standard_True)
|
||||
IntSurf_PathPoint::IntSurf_PathPoint(const gp_Pnt& P, const Standard_Real U, const Standard_Real V)
|
||||
: pt(P),
|
||||
ispass(Standard_True),
|
||||
istgt(Standard_True)
|
||||
{
|
||||
sequv = new TColgp_HSequenceOfXY ();
|
||||
sequv->Append(gp_XY(U,V));
|
||||
sequv = new TColgp_HSequenceOfXY();
|
||||
sequv->Append(gp_XY(U, V));
|
||||
}
|
||||
|
||||
|
||||
void IntSurf_PathPoint::SetValue (const gp_Pnt& P,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V)
|
||||
void IntSurf_PathPoint::SetValue(const gp_Pnt& P, const Standard_Real U, const Standard_Real V)
|
||||
{
|
||||
pt = P;
|
||||
sequv = new TColgp_HSequenceOfXY ();
|
||||
sequv->Append(gp_XY(U,V));
|
||||
pt = P;
|
||||
sequv = new TColgp_HSequenceOfXY();
|
||||
sequv->Append(gp_XY(U, V));
|
||||
}
|
||||
|
||||
|
@@ -27,73 +27,51 @@
|
||||
#include <TColgp_HSequenceOfXY.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
|
||||
|
||||
class IntSurf_PathPoint
|
||||
class IntSurf_PathPoint
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_PathPoint();
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_PathPoint(const gp_Pnt& P, const Standard_Real U, const Standard_Real V);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Pnt& P, const Standard_Real U, const Standard_Real V);
|
||||
|
||||
void AddUV (const Standard_Real U, const Standard_Real V);
|
||||
|
||||
void SetDirections (const gp_Vec& V, const gp_Dir2d& D);
|
||||
|
||||
void SetTangency (const Standard_Boolean Tang);
|
||||
|
||||
void SetPassing (const Standard_Boolean Pass);
|
||||
|
||||
const gp_Pnt& Value() const;
|
||||
|
||||
void Value2d (Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
Standard_Boolean IsPassingPnt() const;
|
||||
|
||||
Standard_Boolean IsTangent() const;
|
||||
|
||||
const gp_Vec& Direction3d() const;
|
||||
|
||||
const gp_Dir2d& Direction2d() const;
|
||||
|
||||
Standard_Integer Multiplicity() const;
|
||||
|
||||
void Parameters (const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Pnt& P, const Standard_Real U, const Standard_Real V);
|
||||
|
||||
void AddUV(const Standard_Real U, const Standard_Real V);
|
||||
|
||||
void SetDirections(const gp_Vec& V, const gp_Dir2d& D);
|
||||
|
||||
void SetTangency(const Standard_Boolean Tang);
|
||||
|
||||
void SetPassing(const Standard_Boolean Pass);
|
||||
|
||||
const gp_Pnt& Value() const;
|
||||
|
||||
void Value2d(Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
Standard_Boolean IsPassingPnt() const;
|
||||
|
||||
Standard_Boolean IsTangent() const;
|
||||
|
||||
const gp_Vec& Direction3d() const;
|
||||
|
||||
const gp_Dir2d& Direction2d() const;
|
||||
|
||||
Standard_Integer Multiplicity() const;
|
||||
|
||||
void Parameters(const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
gp_Pnt pt;
|
||||
Standard_Boolean ispass;
|
||||
Standard_Boolean istgt;
|
||||
gp_Vec vectg;
|
||||
gp_Dir2d dirtg;
|
||||
gp_Pnt pt;
|
||||
Standard_Boolean ispass;
|
||||
Standard_Boolean istgt;
|
||||
gp_Vec vectg;
|
||||
gp_Dir2d dirtg;
|
||||
Handle(TColgp_HSequenceOfXY) sequv;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_PathPoint.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_PathPoint_HeaderFile
|
||||
|
@@ -15,75 +15,86 @@
|
||||
#include <StdFail_UndefinedDerivative.hxx>
|
||||
#include <TColgp_HSequenceOfXY.hxx>
|
||||
|
||||
inline void IntSurf_PathPoint::AddUV(const Standard_Real U,
|
||||
const Standard_Real V) {
|
||||
sequv->Append(gp_XY(U,V));
|
||||
inline void IntSurf_PathPoint::AddUV(const Standard_Real U, const Standard_Real V)
|
||||
{
|
||||
sequv->Append(gp_XY(U, V));
|
||||
}
|
||||
|
||||
inline void IntSurf_PathPoint::SetDirections (const gp_Vec& V,
|
||||
const gp_Dir2d& D) {
|
||||
|
||||
inline void IntSurf_PathPoint::SetDirections(const gp_Vec& V, const gp_Dir2d& D)
|
||||
{
|
||||
|
||||
istgt = Standard_False;
|
||||
vectg = V;
|
||||
dirtg = D;
|
||||
}
|
||||
|
||||
inline void IntSurf_PathPoint::SetTangency (const Standard_Boolean Tang) {
|
||||
|
||||
inline void IntSurf_PathPoint::SetTangency(const Standard_Boolean Tang)
|
||||
{
|
||||
|
||||
istgt = Tang;
|
||||
}
|
||||
|
||||
inline void IntSurf_PathPoint::SetPassing (const Standard_Boolean Pass) {
|
||||
inline void IntSurf_PathPoint::SetPassing(const Standard_Boolean Pass)
|
||||
{
|
||||
|
||||
ispass = Pass;
|
||||
}
|
||||
|
||||
inline const gp_Pnt& IntSurf_PathPoint::Value () const
|
||||
inline const gp_Pnt& IntSurf_PathPoint::Value() const
|
||||
{
|
||||
return pt;
|
||||
}
|
||||
|
||||
inline void IntSurf_PathPoint::Value2d (Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
inline void IntSurf_PathPoint::Value2d(Standard_Real& U, Standard_Real& V) const
|
||||
{
|
||||
gp_XY uv(sequv->Sequence().First());
|
||||
U = uv.X();
|
||||
V = uv.Y();
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntSurf_PathPoint::IsPassingPnt () const {
|
||||
inline Standard_Boolean IntSurf_PathPoint::IsPassingPnt() const
|
||||
{
|
||||
|
||||
return ispass;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntSurf_PathPoint::IsTangent () const {
|
||||
inline Standard_Boolean IntSurf_PathPoint::IsTangent() const
|
||||
{
|
||||
|
||||
return istgt;
|
||||
}
|
||||
|
||||
inline const gp_Vec& IntSurf_PathPoint::Direction3d () const {
|
||||
inline const gp_Vec& IntSurf_PathPoint::Direction3d() const
|
||||
{
|
||||
|
||||
if (istgt) {throw StdFail_UndefinedDerivative();}
|
||||
if (istgt)
|
||||
{
|
||||
throw StdFail_UndefinedDerivative();
|
||||
}
|
||||
return vectg;
|
||||
}
|
||||
|
||||
inline const gp_Dir2d& IntSurf_PathPoint::Direction2d () const {
|
||||
inline const gp_Dir2d& IntSurf_PathPoint::Direction2d() const
|
||||
{
|
||||
|
||||
if (istgt) {throw StdFail_UndefinedDerivative();}
|
||||
if (istgt)
|
||||
{
|
||||
throw StdFail_UndefinedDerivative();
|
||||
}
|
||||
return dirtg;
|
||||
}
|
||||
|
||||
inline Standard_Integer IntSurf_PathPoint::Multiplicity () const {
|
||||
inline Standard_Integer IntSurf_PathPoint::Multiplicity() const
|
||||
{
|
||||
|
||||
return (sequv->Length()-1);
|
||||
return (sequv->Length() - 1);
|
||||
}
|
||||
|
||||
inline void IntSurf_PathPoint::Parameters (const Standard_Integer Index,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
inline void IntSurf_PathPoint::Parameters(const Standard_Integer Index,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
{
|
||||
gp_XY uv(sequv->Value(Index+1));
|
||||
gp_XY uv(sequv->Value(Index + 1));
|
||||
U = uv.X();
|
||||
V = uv.Y();
|
||||
}
|
||||
|
||||
|
@@ -28,79 +28,60 @@ class Standard_OutOfRange;
|
||||
class StdFail_UndefinedDerivative;
|
||||
class IntSurf_PathPoint;
|
||||
|
||||
|
||||
|
||||
class IntSurf_PathPointTool
|
||||
class IntSurf_PathPointTool
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Returns the 3d coordinates of the starting point.
|
||||
static gp_Pnt Value3d (const IntSurf_PathPoint& PStart);
|
||||
|
||||
static gp_Pnt Value3d(const IntSurf_PathPoint& PStart);
|
||||
|
||||
//! Returns the <U, V> parameters which are associated
|
||||
//! with <P>
|
||||
//! it's the parameters which start the marching algorithm
|
||||
static void Value2d (const IntSurf_PathPoint& PStart, Standard_Real& U, Standard_Real& V);
|
||||
|
||||
static void Value2d(const IntSurf_PathPoint& PStart, Standard_Real& U, Standard_Real& V);
|
||||
|
||||
//! Returns True if the point is a point on a non-oriented
|
||||
//! arc, which means that the intersection line does not
|
||||
//! stop at such a point but just go through such a point.
|
||||
//! IsPassingPnt is True when IsOnArc is True
|
||||
static Standard_Boolean IsPassingPnt (const IntSurf_PathPoint& PStart);
|
||||
|
||||
static Standard_Boolean IsPassingPnt(const IntSurf_PathPoint& PStart);
|
||||
|
||||
//! Returns True if the surfaces are tangent at this point.
|
||||
//! IsTangent can be True when IsOnArc is True
|
||||
//! if IsPassingPnt is True and IsTangent is True,this point
|
||||
//! is a stopped point.
|
||||
static Standard_Boolean IsTangent (const IntSurf_PathPoint& PStart);
|
||||
|
||||
static Standard_Boolean IsTangent(const IntSurf_PathPoint& PStart);
|
||||
|
||||
//! returns the tangent at the intersection in 3d space
|
||||
//! associated to <P>
|
||||
//! an exception is raised if IsTangent is true.
|
||||
static gp_Vec Direction3d (const IntSurf_PathPoint& PStart);
|
||||
|
||||
static gp_Vec Direction3d(const IntSurf_PathPoint& PStart);
|
||||
|
||||
//! returns the tangent at the intersection in the
|
||||
//! parametric space of the parametrized surface.This tangent
|
||||
//! is associated to the value2d
|
||||
//! la tangente a un sens signifiant (indique le sens de chemin
|
||||
//! ement)
|
||||
//! an exception is raised if IsTangent is true.
|
||||
static gp_Dir2d Direction2d (const IntSurf_PathPoint& PStart);
|
||||
|
||||
static gp_Dir2d Direction2d(const IntSurf_PathPoint& PStart);
|
||||
|
||||
//! Returns the multiplicity of the point i-e
|
||||
//! the number of auxillar parameters associated to the
|
||||
//! point which the principal parameters are given by Value2d
|
||||
static Standard_Integer Multiplicity (const IntSurf_PathPoint& PStart);
|
||||
|
||||
static Standard_Integer Multiplicity(const IntSurf_PathPoint& PStart);
|
||||
|
||||
//! Parametric coordinates associated to the multiplicity.
|
||||
//! An exception is raised if Mult<=0 or Mult>multiplicity.
|
||||
static void Parameters (const IntSurf_PathPoint& PStart, const Standard_Integer Mult, Standard_Real& U, Standard_Real& V);
|
||||
|
||||
|
||||
|
||||
static void Parameters(const IntSurf_PathPoint& PStart,
|
||||
const Standard_Integer Mult,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_PathPointTool.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_PathPointTool_HeaderFile
|
||||
|
@@ -17,58 +17,48 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
|
||||
inline gp_Pnt IntSurf_PathPointTool::Value3d (const IntSurf_PathPoint& PStart)
|
||||
inline gp_Pnt IntSurf_PathPointTool::Value3d(const IntSurf_PathPoint& PStart)
|
||||
{
|
||||
return PStart.Value();
|
||||
}
|
||||
|
||||
inline void IntSurf_PathPointTool::Value2d (const IntSurf_PathPoint& PStart,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) {
|
||||
PStart.Value2d(U,V);
|
||||
inline void IntSurf_PathPointTool::Value2d(const IntSurf_PathPoint& PStart,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
{
|
||||
PStart.Value2d(U, V);
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntSurf_PathPointTool::IsPassingPnt
|
||||
(const IntSurf_PathPoint& PStart) {
|
||||
inline Standard_Boolean IntSurf_PathPointTool::IsPassingPnt(const IntSurf_PathPoint& PStart)
|
||||
{
|
||||
|
||||
return PStart.IsPassingPnt();
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Boolean IntSurf_PathPointTool::IsTangent
|
||||
(const IntSurf_PathPoint& PStart)
|
||||
inline Standard_Boolean IntSurf_PathPointTool::IsTangent(const IntSurf_PathPoint& PStart)
|
||||
{
|
||||
return PStart.IsTangent();
|
||||
}
|
||||
|
||||
|
||||
inline gp_Vec IntSurf_PathPointTool::Direction3d
|
||||
(const IntSurf_PathPoint& PStart)
|
||||
inline gp_Vec IntSurf_PathPointTool::Direction3d(const IntSurf_PathPoint& PStart)
|
||||
{
|
||||
return PStart.Direction3d();
|
||||
}
|
||||
|
||||
inline gp_Dir2d IntSurf_PathPointTool::Direction2d
|
||||
(const IntSurf_PathPoint& PStart)
|
||||
inline gp_Dir2d IntSurf_PathPointTool::Direction2d(const IntSurf_PathPoint& PStart)
|
||||
{
|
||||
return PStart.Direction2d();
|
||||
}
|
||||
|
||||
|
||||
inline Standard_Integer IntSurf_PathPointTool::Multiplicity
|
||||
(const IntSurf_PathPoint& PStart)
|
||||
inline Standard_Integer IntSurf_PathPointTool::Multiplicity(const IntSurf_PathPoint& PStart)
|
||||
{
|
||||
return PStart.Multiplicity();
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_PathPointTool::Parameters (const IntSurf_PathPoint& PStart,
|
||||
const Standard_Integer Mult,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
inline void IntSurf_PathPointTool::Parameters(const IntSurf_PathPoint& PStart,
|
||||
const Standard_Integer Mult,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V)
|
||||
{
|
||||
PStart.Parameters(Mult,U,V);
|
||||
PStart.Parameters(Mult, U, V);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -12,39 +12,48 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IntSurf_PntOn2S.hxx>
|
||||
|
||||
IntSurf_PntOn2S::IntSurf_PntOn2S ()
|
||||
: pt(0,0,0),u1(0),v1(0),u2(0),v2(0)
|
||||
{}
|
||||
IntSurf_PntOn2S::IntSurf_PntOn2S()
|
||||
: pt(0, 0, 0),
|
||||
u1(0),
|
||||
v1(0),
|
||||
u2(0),
|
||||
v2(0)
|
||||
{
|
||||
}
|
||||
|
||||
void IntSurf_PntOn2S::SetValue (const gp_Pnt& Pt,
|
||||
const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V) {
|
||||
void IntSurf_PntOn2S::SetValue(const gp_Pnt& Pt,
|
||||
const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V)
|
||||
{
|
||||
|
||||
pt = Pt;
|
||||
if (OnFirst) {
|
||||
if (OnFirst)
|
||||
{
|
||||
u1 = U;
|
||||
v1 = V;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
u2 = U;
|
||||
v2 = V;
|
||||
}
|
||||
}
|
||||
|
||||
void IntSurf_PntOn2S::SetValue(const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V)
|
||||
{
|
||||
|
||||
void IntSurf_PntOn2S::SetValue (const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V) {
|
||||
|
||||
if (OnFirst) {
|
||||
if (OnFirst)
|
||||
{
|
||||
u1 = U;
|
||||
v1 = V;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
u2 = U;
|
||||
v2 = V;
|
||||
}
|
||||
@@ -54,35 +63,37 @@ gp_Pnt2d IntSurf_PntOn2S::ValueOnSurface(const Standard_Boolean OnFirst) const
|
||||
{
|
||||
gp_Pnt2d PointOnSurf;
|
||||
if (OnFirst)
|
||||
PointOnSurf.SetCoord(u1,v1);
|
||||
PointOnSurf.SetCoord(u1, v1);
|
||||
else
|
||||
PointOnSurf.SetCoord(u2,v2);
|
||||
PointOnSurf.SetCoord(u2, v2);
|
||||
return PointOnSurf;
|
||||
}
|
||||
|
||||
void IntSurf_PntOn2S::ParametersOnSurface(const Standard_Boolean OnFirst,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
{
|
||||
if (OnFirst) {
|
||||
if (OnFirst)
|
||||
{
|
||||
U = u1;
|
||||
V = v1;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
U = u2;
|
||||
V = v2;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean IntSurf_PntOn2S::IsSame( const IntSurf_PntOn2S& theOterPoint,
|
||||
const Standard_Real theTol3D,
|
||||
const Standard_Real theTol2D) const
|
||||
Standard_Boolean IntSurf_PntOn2S::IsSame(const IntSurf_PntOn2S& theOterPoint,
|
||||
const Standard_Real theTol3D,
|
||||
const Standard_Real theTol2D) const
|
||||
{
|
||||
if(pt.SquareDistance(theOterPoint.Value()) > theTol3D*theTol3D)
|
||||
if (pt.SquareDistance(theOterPoint.Value()) > theTol3D * theTol3D)
|
||||
return Standard_False;
|
||||
|
||||
if(theTol2D < 0.0)
|
||||
{//We need not compare 2D-coordinates of the points
|
||||
if (theTol2D < 0.0)
|
||||
{ // We need not compare 2D-coordinates of the points
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -91,13 +102,13 @@ Standard_Boolean IntSurf_PntOn2S::IsSame( const IntSurf_PntOn2S& theOterPoint,
|
||||
|
||||
gp_Pnt2d aP1(u1, v1), aP2(aU1, aV1);
|
||||
|
||||
if(!aP1.IsEqual(aP2, theTol2D))
|
||||
if (!aP1.IsEqual(aP2, theTol2D))
|
||||
return Standard_False;
|
||||
|
||||
aP1.SetCoord(u2, v2);
|
||||
aP2.SetCoord(aU2, aV2);
|
||||
|
||||
if(!aP1.IsEqual(aP2, theTol2D))
|
||||
if (!aP1.IsEqual(aP2, theTol2D))
|
||||
return Standard_False;
|
||||
|
||||
return Standard_True;
|
||||
|
@@ -25,91 +25,86 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
class gp_Pnt2d;
|
||||
|
||||
|
||||
//! This class defines the geometric information
|
||||
//! for an intersection point between 2 surfaces :
|
||||
//! The coordinates ( Pnt from gp ), and two
|
||||
//! parametric coordinates.
|
||||
class IntSurf_PntOn2S
|
||||
class IntSurf_PntOn2S
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor.
|
||||
Standard_EXPORT IntSurf_PntOn2S();
|
||||
|
||||
|
||||
//! Sets the value of the point in 3d space.
|
||||
void SetValue (const gp_Pnt& Pt);
|
||||
|
||||
void SetValue(const gp_Pnt& Pt);
|
||||
|
||||
//! Sets the values of the point in 3d space, and
|
||||
//! in the parametric space of one of the surface.
|
||||
Standard_EXPORT void SetValue (const gp_Pnt& Pt, const Standard_Boolean OnFirst, const Standard_Real U, const Standard_Real V);
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Pnt& Pt,
|
||||
const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V);
|
||||
|
||||
//! Sets the values of the point in 3d space, and
|
||||
//! in the parametric space of each surface.
|
||||
void SetValue (const gp_Pnt& Pt, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
|
||||
|
||||
void SetValue(const gp_Pnt& Pt,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2);
|
||||
|
||||
//! Set the values of the point in the parametric
|
||||
//! space of one of the surface.
|
||||
Standard_EXPORT void SetValue (const Standard_Boolean OnFirst, const Standard_Real U, const Standard_Real V);
|
||||
|
||||
Standard_EXPORT void SetValue(const Standard_Boolean OnFirst,
|
||||
const Standard_Real U,
|
||||
const Standard_Real V);
|
||||
|
||||
//! Set the values of the point in the parametric
|
||||
//! space of one of the surface.
|
||||
void SetValue (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2) ;
|
||||
|
||||
void SetValue(const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2);
|
||||
|
||||
//! Returns the point in 3d space.
|
||||
const gp_Pnt& Value() const;
|
||||
|
||||
const gp_Pnt& Value() const;
|
||||
|
||||
//! Returns the point in 2d space of one of the surfaces.
|
||||
Standard_EXPORT gp_Pnt2d ValueOnSurface (const Standard_Boolean OnFirst) const;
|
||||
|
||||
Standard_EXPORT gp_Pnt2d ValueOnSurface(const Standard_Boolean OnFirst) const;
|
||||
|
||||
//! Returns the parameters of the point on the first surface.
|
||||
void ParametersOnS1 (Standard_Real& U1, Standard_Real& V1) const;
|
||||
|
||||
void ParametersOnS1(Standard_Real& U1, Standard_Real& V1) const;
|
||||
|
||||
//! Returns the parameters of the point on the second surface.
|
||||
void ParametersOnS2 (Standard_Real& U2, Standard_Real& V2) const;
|
||||
|
||||
void ParametersOnS2(Standard_Real& U2, Standard_Real& V2) const;
|
||||
|
||||
//! Returns the parameters of the point in the
|
||||
//! parametric space of one of the surface.
|
||||
Standard_EXPORT void ParametersOnSurface (const Standard_Boolean OnFirst, Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
Standard_EXPORT void ParametersOnSurface(const Standard_Boolean OnFirst,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) const;
|
||||
|
||||
//! Returns the parameters of the point on both surfaces.
|
||||
void Parameters (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
|
||||
|
||||
void Parameters(Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
|
||||
|
||||
//! Returns TRUE if 2D- and 3D-coordinates of theOterPoint are equal to
|
||||
//! corresponding coordinates of me (with given tolerance).
|
||||
//! If theTol2D < 0.0 we will compare 3D-points only.
|
||||
Standard_EXPORT Standard_Boolean IsSame (const IntSurf_PntOn2S& theOtherPoint, const Standard_Real theTol3D = 0.0, const Standard_Real theTol2D = -1.0) const;
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSame(const IntSurf_PntOn2S& theOtherPoint,
|
||||
const Standard_Real theTol3D = 0.0,
|
||||
const Standard_Real theTol2D = -1.0) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
gp_Pnt pt;
|
||||
gp_Pnt pt;
|
||||
Standard_Real u1;
|
||||
Standard_Real v1;
|
||||
Standard_Real u2;
|
||||
Standard_Real v2;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_PntOn2S.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_PntOn2S_HeaderFile
|
||||
|
@@ -12,17 +12,18 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline void IntSurf_PntOn2S::SetValue (const gp_Pnt& Pt ) {
|
||||
inline void IntSurf_PntOn2S::SetValue(const gp_Pnt& Pt)
|
||||
{
|
||||
|
||||
pt = Pt;
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_PntOn2S::SetValue (const gp_Pnt& Pt,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2) {
|
||||
inline void IntSurf_PntOn2S::SetValue(const gp_Pnt& Pt,
|
||||
const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2)
|
||||
{
|
||||
|
||||
pt = Pt;
|
||||
u1 = U1;
|
||||
@@ -31,48 +32,42 @@ inline void IntSurf_PntOn2S::SetValue (const gp_Pnt& Pt,
|
||||
v2 = V2;
|
||||
}
|
||||
|
||||
inline void IntSurf_PntOn2S::SetValue (const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2) {
|
||||
inline void IntSurf_PntOn2S::SetValue(const Standard_Real U1,
|
||||
const Standard_Real V1,
|
||||
const Standard_Real U2,
|
||||
const Standard_Real V2)
|
||||
{
|
||||
u1 = U1;
|
||||
v1 = V1;
|
||||
u2 = U2;
|
||||
v2 = V2;
|
||||
}
|
||||
|
||||
|
||||
inline const gp_Pnt& IntSurf_PntOn2S::Value () const {
|
||||
inline const gp_Pnt& IntSurf_PntOn2S::Value() const
|
||||
{
|
||||
|
||||
return pt;
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_PntOn2S::ParametersOnS1 (Standard_Real& U1,
|
||||
Standard_Real& V1) const
|
||||
inline void IntSurf_PntOn2S::ParametersOnS1(Standard_Real& U1, Standard_Real& V1) const
|
||||
{
|
||||
U1 = u1;
|
||||
V1 = v1;
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_PntOn2S::ParametersOnS2 (Standard_Real& U2,
|
||||
Standard_Real& V2) const
|
||||
inline void IntSurf_PntOn2S::ParametersOnS2(Standard_Real& U2, Standard_Real& V2) const
|
||||
{
|
||||
U2 = u2;
|
||||
V2 = v2;
|
||||
}
|
||||
|
||||
inline void IntSurf_PntOn2S::Parameters (Standard_Real& U1,
|
||||
Standard_Real& V1,
|
||||
Standard_Real& U2,
|
||||
Standard_Real& V2) const
|
||||
inline void IntSurf_PntOn2S::Parameters(Standard_Real& U1,
|
||||
Standard_Real& V1,
|
||||
Standard_Real& U2,
|
||||
Standard_Real& V2) const
|
||||
{
|
||||
U1 = u1;
|
||||
V1 = v1;
|
||||
U2 = u2;
|
||||
V2 = v2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -12,7 +12,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
@@ -26,39 +25,57 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric ():typ(GeomAbs_OtherSurface),
|
||||
prm1(0.), prm2(0.), prm3(0.), prm4(0.), ax3direc(Standard_False)
|
||||
IntSurf_Quadric::IntSurf_Quadric()
|
||||
: typ(GeomAbs_OtherSurface),
|
||||
prm1(0.),
|
||||
prm2(0.),
|
||||
prm3(0.),
|
||||
prm4(0.),
|
||||
ax3direc(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric (const gp_Pln& P):
|
||||
ax3(P.Position()),typ(GeomAbs_Plane)
|
||||
IntSurf_Quadric::IntSurf_Quadric(const gp_Pln& P)
|
||||
: ax3(P.Position()),
|
||||
typ(GeomAbs_Plane)
|
||||
{
|
||||
ax3direc = ax3.Direct();
|
||||
P.Coefficients(prm1,prm2,prm3,prm4);
|
||||
P.Coefficients(prm1, prm2, prm3, prm4);
|
||||
}
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric (const gp_Cylinder& C):
|
||||
|
||||
ax3(C.Position()),lin(ax3.Axis()),typ(GeomAbs_Cylinder)
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric(const gp_Cylinder& C)
|
||||
:
|
||||
|
||||
ax3(C.Position()),
|
||||
lin(ax3.Axis()),
|
||||
typ(GeomAbs_Cylinder)
|
||||
{
|
||||
prm2=prm3=prm4=0.0;
|
||||
ax3direc=ax3.Direct();
|
||||
prm1=C.Radius();
|
||||
prm2 = prm3 = prm4 = 0.0;
|
||||
ax3direc = ax3.Direct();
|
||||
prm1 = C.Radius();
|
||||
}
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric (const gp_Sphere& S):
|
||||
|
||||
ax3(S.Position()),lin(ax3.Axis()),typ(GeomAbs_Sphere)
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric(const gp_Sphere& S)
|
||||
:
|
||||
|
||||
ax3(S.Position()),
|
||||
lin(ax3.Axis()),
|
||||
typ(GeomAbs_Sphere)
|
||||
{
|
||||
prm2=prm3=prm4=0.0;
|
||||
ax3direc = ax3.Direct();
|
||||
prm1=S.Radius();
|
||||
prm2 = prm3 = prm4 = 0.0;
|
||||
ax3direc = ax3.Direct();
|
||||
prm1 = S.Radius();
|
||||
}
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric (const gp_Cone& C):
|
||||
|
||||
ax3(C.Position()),typ(GeomAbs_Cone)
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric(const gp_Cone& C)
|
||||
:
|
||||
|
||||
ax3(C.Position()),
|
||||
typ(GeomAbs_Cone)
|
||||
{
|
||||
ax3direc = ax3.Direct();
|
||||
lin.SetPosition(ax3.Axis());
|
||||
@@ -67,10 +84,13 @@ IntSurf_Quadric::IntSurf_Quadric (const gp_Cone& C):
|
||||
prm3 = Cos(prm2);
|
||||
prm4 = 0.0;
|
||||
}
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric (const gp_Torus& T):
|
||||
|
||||
ax3(T.Position()),typ(GeomAbs_Torus)
|
||||
// ============================================================
|
||||
IntSurf_Quadric::IntSurf_Quadric(const gp_Torus& T)
|
||||
:
|
||||
|
||||
ax3(T.Position()),
|
||||
typ(GeomAbs_Torus)
|
||||
{
|
||||
ax3direc = ax3.Direct();
|
||||
lin.SetPosition(ax3.Axis());
|
||||
@@ -79,39 +99,43 @@ IntSurf_Quadric::IntSurf_Quadric (const gp_Torus& T):
|
||||
prm3 = 0.0;
|
||||
prm4 = 0.0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::SetValue (const gp_Pln& P)
|
||||
void IntSurf_Quadric::SetValue(const gp_Pln& P)
|
||||
{
|
||||
typ = GeomAbs_Plane;
|
||||
ax3 = P.Position();
|
||||
typ = GeomAbs_Plane;
|
||||
ax3 = P.Position();
|
||||
ax3direc = ax3.Direct();
|
||||
P.Coefficients(prm1,prm2,prm3,prm4);
|
||||
P.Coefficients(prm1, prm2, prm3, prm4);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::SetValue (const gp_Cylinder& C)
|
||||
void IntSurf_Quadric::SetValue(const gp_Cylinder& C)
|
||||
{
|
||||
typ = GeomAbs_Cylinder;
|
||||
ax3 = C.Position();
|
||||
typ = GeomAbs_Cylinder;
|
||||
ax3 = C.Position();
|
||||
ax3direc = ax3.Direct();
|
||||
lin.SetPosition(ax3.Axis());
|
||||
prm1 = C.Radius();
|
||||
prm2=prm3=prm4=0.0;
|
||||
prm2 = prm3 = prm4 = 0.0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::SetValue (const gp_Sphere& S)
|
||||
void IntSurf_Quadric::SetValue(const gp_Sphere& S)
|
||||
{
|
||||
typ = GeomAbs_Sphere;
|
||||
ax3 = S.Position();
|
||||
typ = GeomAbs_Sphere;
|
||||
ax3 = S.Position();
|
||||
ax3direc = ax3.Direct();
|
||||
lin.SetPosition(ax3.Axis());
|
||||
prm1 = S.Radius();
|
||||
prm2=prm3=prm4=0.0;
|
||||
prm2 = prm3 = prm4 = 0.0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::SetValue (const gp_Cone& C)
|
||||
void IntSurf_Quadric::SetValue(const gp_Cone& C)
|
||||
{
|
||||
typ = GeomAbs_Cone;
|
||||
ax3 = C.Position();
|
||||
typ = GeomAbs_Cone;
|
||||
ax3 = C.Position();
|
||||
ax3direc = ax3.Direct();
|
||||
lin.SetPosition(ax3.Axis());
|
||||
prm1 = C.RefRadius();
|
||||
@@ -119,11 +143,12 @@ void IntSurf_Quadric::SetValue (const gp_Cone& C)
|
||||
prm3 = Cos(prm2);
|
||||
prm4 = 0.0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::SetValue (const gp_Torus& T)
|
||||
void IntSurf_Quadric::SetValue(const gp_Torus& T)
|
||||
{
|
||||
typ = GeomAbs_Torus;
|
||||
ax3 = T.Position();
|
||||
typ = GeomAbs_Torus;
|
||||
ax3 = T.Position();
|
||||
ax3direc = ax3.Direct();
|
||||
lin.SetPosition(ax3.Axis());
|
||||
prm1 = T.MajorRadius();
|
||||
@@ -131,404 +156,437 @@ void IntSurf_Quadric::SetValue (const gp_Torus& T)
|
||||
prm3 = 0.0;
|
||||
prm4 = 0.0;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
Standard_Real IntSurf_Quadric::Distance (const gp_Pnt& P) const {
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane: // plan
|
||||
return prm1*P.X() + prm2*P.Y() + prm3*P.Z() + prm4;
|
||||
case GeomAbs_Cylinder: // cylindre
|
||||
return (lin.Distance(P) - prm1);
|
||||
case GeomAbs_Sphere: // sphere
|
||||
return (lin.Location().Distance(P) - prm1);
|
||||
case GeomAbs_Cone: // cone
|
||||
Standard_Real IntSurf_Quadric::Distance(const gp_Pnt& P) const
|
||||
{
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane: // plan
|
||||
return prm1 * P.X() + prm2 * P.Y() + prm3 * P.Z() + prm4;
|
||||
case GeomAbs_Cylinder: // cylindre
|
||||
return (lin.Distance(P) - prm1);
|
||||
case GeomAbs_Sphere: // sphere
|
||||
return (lin.Location().Distance(P) - prm1);
|
||||
case GeomAbs_Cone: // cone
|
||||
{
|
||||
Standard_Real dist = lin.Distance(P);
|
||||
Standard_Real U,V;
|
||||
ElSLib::ConeParameters(ax3,prm1,prm2,P,U,V);
|
||||
gp_Pnt Pp = ElSLib::ConeValue(U,V,ax3,prm1,prm2);
|
||||
Standard_Real U, V;
|
||||
ElSLib::ConeParameters(ax3, prm1, prm2, P, U, V);
|
||||
gp_Pnt Pp = ElSLib::ConeValue(U, V, ax3, prm1, prm2);
|
||||
Standard_Real distp = lin.Distance(Pp);
|
||||
dist = (dist-distp)/prm3;
|
||||
return(dist);
|
||||
dist = (dist - distp) / prm3;
|
||||
return (dist);
|
||||
}
|
||||
case GeomAbs_Torus: // torus
|
||||
case GeomAbs_Torus: // torus
|
||||
{
|
||||
gp_Pnt O, Pp, PT;
|
||||
//
|
||||
O = ax3.Location();
|
||||
gp_Vec OZ (ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O,P).Dot(ax3.Direction()))));
|
||||
gp_Vec OZ(ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O, P).Dot(ax3.Direction()))));
|
||||
//
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ?
|
||||
ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ()*prm1);
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ? ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ() * prm1);
|
||||
//
|
||||
Standard_Real dist = P.Distance(PT) - prm2;
|
||||
return dist;
|
||||
}
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
return(0.0);
|
||||
return (0.0);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
gp_Vec IntSurf_Quadric::Gradient (const gp_Pnt& P) const {
|
||||
gp_Vec IntSurf_Quadric::Gradient(const gp_Pnt& P) const
|
||||
{
|
||||
gp_Vec grad;
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane: // plan
|
||||
grad.SetCoord(prm1,prm2,prm3);
|
||||
break;
|
||||
case GeomAbs_Cylinder: // cylindre
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane: // plan
|
||||
grad.SetCoord(prm1, prm2, prm3);
|
||||
break;
|
||||
case GeomAbs_Cylinder: // cylindre
|
||||
{
|
||||
gp_XYZ PP(lin.Location().XYZ());
|
||||
PP.Add(ElCLib::Parameter(lin,P)*lin.Direction().XYZ());
|
||||
grad.SetXYZ(P.XYZ()-PP);
|
||||
PP.Add(ElCLib::Parameter(lin, P) * lin.Direction().XYZ());
|
||||
grad.SetXYZ(P.XYZ() - PP);
|
||||
Standard_Real N = grad.Magnitude();
|
||||
if(N>1e-14) { grad.Divide(N); }
|
||||
else { grad.SetCoord(0.0,0.0,0.0); }
|
||||
if (N > 1e-14)
|
||||
{
|
||||
grad.Divide(N);
|
||||
}
|
||||
else
|
||||
{
|
||||
grad.SetCoord(0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Sphere: // sphere
|
||||
case GeomAbs_Sphere: // sphere
|
||||
{
|
||||
gp_XYZ PP(P.XYZ());
|
||||
grad.SetXYZ((PP-lin.Location().XYZ()));
|
||||
grad.SetXYZ((PP - lin.Location().XYZ()));
|
||||
Standard_Real N = grad.Magnitude();
|
||||
if(N>1e-14) { grad.Divide(N); }
|
||||
else { grad.SetCoord(0.0,0.0,0.0); }
|
||||
if (N > 1e-14)
|
||||
{
|
||||
grad.Divide(N);
|
||||
}
|
||||
else
|
||||
{
|
||||
grad.SetCoord(0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cone: // cone
|
||||
case GeomAbs_Cone: // cone
|
||||
{
|
||||
Standard_Real U,V;
|
||||
ElSLib::ConeParameters(ax3,prm1,prm2,P,U,V);
|
||||
gp_Pnt Pp = ElSLib::ConeValue(U,V,ax3,prm1,prm2);
|
||||
gp_Vec D1u,D1v;
|
||||
ElSLib::ConeD1(U,V,ax3,prm1,prm2,Pp,D1u,D1v);
|
||||
grad=D1u.Crossed(D1v);
|
||||
if(ax3direc==Standard_False) {
|
||||
Standard_Real U, V;
|
||||
ElSLib::ConeParameters(ax3, prm1, prm2, P, U, V);
|
||||
gp_Pnt Pp = ElSLib::ConeValue(U, V, ax3, prm1, prm2);
|
||||
gp_Vec D1u, D1v;
|
||||
ElSLib::ConeD1(U, V, ax3, prm1, prm2, Pp, D1u, D1v);
|
||||
grad = D1u.Crossed(D1v);
|
||||
if (ax3direc == Standard_False)
|
||||
{
|
||||
grad.Reverse();
|
||||
}
|
||||
grad.Normalize();
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Torus: // torus
|
||||
case GeomAbs_Torus: // torus
|
||||
{
|
||||
gp_Pnt O, Pp, PT;
|
||||
//
|
||||
O = ax3.Location();
|
||||
gp_Vec OZ (ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O,P).Dot(ax3.Direction()))));
|
||||
gp_Vec OZ(ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O, P).Dot(ax3.Direction()))));
|
||||
//
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ?
|
||||
ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ()*prm1);
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ? ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ() * prm1);
|
||||
//
|
||||
grad.SetXYZ(P.XYZ() - PT.XYZ());
|
||||
Standard_Real N = grad.Magnitude();
|
||||
if(N>1e-14) { grad.Divide(N); }
|
||||
else { grad.SetCoord(0., 0., 0.); }
|
||||
if (N > 1e-14)
|
||||
{
|
||||
grad.Divide(N);
|
||||
}
|
||||
else
|
||||
{
|
||||
grad.SetCoord(0., 0., 0.);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{}
|
||||
default: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
return grad;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::ValAndGrad (const gp_Pnt& P,
|
||||
Standard_Real& Dist,
|
||||
gp_Vec& Grad) const
|
||||
void IntSurf_Quadric::ValAndGrad(const gp_Pnt& P, Standard_Real& Dist, gp_Vec& Grad) const
|
||||
{
|
||||
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane:
|
||||
{
|
||||
Dist = prm1*P.X() + prm2*P.Y() + prm3*P.Z() + prm4;
|
||||
Grad.SetCoord(prm1,prm2,prm3);
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane: {
|
||||
Dist = prm1 * P.X() + prm2 * P.Y() + prm3 * P.Z() + prm4;
|
||||
Grad.SetCoord(prm1, prm2, prm3);
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
case GeomAbs_Cylinder: {
|
||||
Dist = lin.Distance(P) - prm1;
|
||||
gp_XYZ PP(lin.Location().XYZ());
|
||||
PP.Add(ElCLib::Parameter(lin,P)*lin.Direction().XYZ());
|
||||
Grad.SetXYZ((P.XYZ()-PP));
|
||||
PP.Add(ElCLib::Parameter(lin, P) * lin.Direction().XYZ());
|
||||
Grad.SetXYZ((P.XYZ() - PP));
|
||||
Standard_Real N = Grad.Magnitude();
|
||||
if(N>1e-14) { Grad.Divide(N); }
|
||||
else { Grad.SetCoord(0.0,0.0,0.0); }
|
||||
if (N > 1e-14)
|
||||
{
|
||||
Grad.Divide(N);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grad.SetCoord(0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
case GeomAbs_Sphere: {
|
||||
Dist = lin.Location().Distance(P) - prm1;
|
||||
gp_XYZ PP(P.XYZ());
|
||||
Grad.SetXYZ((PP-lin.Location().XYZ()));
|
||||
Grad.SetXYZ((PP - lin.Location().XYZ()));
|
||||
Standard_Real N = Grad.Magnitude();
|
||||
if(N>1e-14) { Grad.Divide(N); }
|
||||
else { Grad.SetCoord(0.0,0.0,0.0); }
|
||||
if (N > 1e-14)
|
||||
{
|
||||
Grad.Divide(N);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grad.SetCoord(0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
case GeomAbs_Cone: {
|
||||
Standard_Real dist = lin.Distance(P);
|
||||
Standard_Real U,V;
|
||||
gp_Vec D1u,D1v;
|
||||
gp_Pnt Pp;
|
||||
ElSLib::ConeParameters(ax3,prm1,prm2,P,U,V);
|
||||
ElSLib::ConeD1(U,V,ax3,prm1,prm2,Pp,D1u,D1v);
|
||||
Standard_Real U, V;
|
||||
gp_Vec D1u, D1v;
|
||||
gp_Pnt Pp;
|
||||
ElSLib::ConeParameters(ax3, prm1, prm2, P, U, V);
|
||||
ElSLib::ConeD1(U, V, ax3, prm1, prm2, Pp, D1u, D1v);
|
||||
Standard_Real distp = lin.Distance(Pp);
|
||||
dist = (dist-distp)/prm3;
|
||||
Dist = dist;
|
||||
Grad=D1u.Crossed(D1v);
|
||||
if(ax3direc==Standard_False) {
|
||||
dist = (dist - distp) / prm3;
|
||||
Dist = dist;
|
||||
Grad = D1u.Crossed(D1v);
|
||||
if (ax3direc == Standard_False)
|
||||
{
|
||||
Grad.Reverse();
|
||||
}
|
||||
//-- lbr le 7 mars 96
|
||||
//-- Si le gardient est nul, on est sur l axe
|
||||
//-- et dans ce cas dist vaut 0
|
||||
//-- On peut donc renvoyer une valeur quelconque.
|
||||
if( Grad.X() > 1e-13
|
||||
|| Grad.Y() > 1e-13
|
||||
|| Grad.Z() > 1e-13) {
|
||||
//-- lbr le 7 mars 96
|
||||
//-- Si le gardient est nul, on est sur l axe
|
||||
//-- et dans ce cas dist vaut 0
|
||||
//-- On peut donc renvoyer une valeur quelconque.
|
||||
if (Grad.X() > 1e-13 || Grad.Y() > 1e-13 || Grad.Z() > 1e-13)
|
||||
{
|
||||
Grad.Normalize();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
case GeomAbs_Torus: {
|
||||
gp_Pnt O, Pp, PT;
|
||||
//
|
||||
O = ax3.Location();
|
||||
gp_Vec OZ (ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O,P).Dot(ax3.Direction()))));
|
||||
gp_Vec OZ(ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O, P).Dot(ax3.Direction()))));
|
||||
//
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ?
|
||||
ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ()*prm1);
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ? ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ() * prm1);
|
||||
//
|
||||
Dist = P.Distance(PT) - prm2;
|
||||
//
|
||||
Grad.SetXYZ(P.XYZ()-PT.XYZ());
|
||||
Grad.SetXYZ(P.XYZ() - PT.XYZ());
|
||||
Standard_Real N = Grad.Magnitude();
|
||||
if(N>1e-14) { Grad.Divide(N); }
|
||||
else { Grad.SetCoord(0., 0., 0.); }
|
||||
if (N > 1e-14)
|
||||
{
|
||||
Grad.Divide(N);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grad.SetCoord(0., 0., 0.);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{}
|
||||
default: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ============================================================
|
||||
gp_Pnt IntSurf_Quadric::Value(const Standard_Real U,
|
||||
const Standard_Real V) const
|
||||
{
|
||||
switch (typ) {
|
||||
|
||||
case GeomAbs_Plane:
|
||||
return ElSLib::PlaneValue(U,V,ax3);
|
||||
case GeomAbs_Cylinder:
|
||||
return ElSLib::CylinderValue(U,V,ax3,prm1);
|
||||
case GeomAbs_Sphere:
|
||||
return ElSLib::SphereValue(U,V,ax3,prm1);
|
||||
case GeomAbs_Cone:
|
||||
return ElSLib::ConeValue(U,V,ax3,prm1,prm2);
|
||||
case GeomAbs_Torus:
|
||||
return ElSLib::TorusValue(U,V,ax3,prm1,prm2);
|
||||
default:
|
||||
{
|
||||
gp_Pnt p(0,0,0);
|
||||
return(p);
|
||||
// ============================================================
|
||||
gp_Pnt IntSurf_Quadric::Value(const Standard_Real U, const Standard_Real V) const
|
||||
{
|
||||
switch (typ)
|
||||
{
|
||||
|
||||
case GeomAbs_Plane:
|
||||
return ElSLib::PlaneValue(U, V, ax3);
|
||||
case GeomAbs_Cylinder:
|
||||
return ElSLib::CylinderValue(U, V, ax3, prm1);
|
||||
case GeomAbs_Sphere:
|
||||
return ElSLib::SphereValue(U, V, ax3, prm1);
|
||||
case GeomAbs_Cone:
|
||||
return ElSLib::ConeValue(U, V, ax3, prm1, prm2);
|
||||
case GeomAbs_Torus:
|
||||
return ElSLib::TorusValue(U, V, ax3, prm1, prm2);
|
||||
default: {
|
||||
gp_Pnt p(0, 0, 0);
|
||||
return (p);
|
||||
}
|
||||
//break;
|
||||
// break;
|
||||
}
|
||||
// pop : pour NT
|
||||
// return gp_Pnt(0,0,0);
|
||||
// pop : pour NT
|
||||
// return gp_Pnt(0,0,0);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::D1(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V) const
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V) const
|
||||
{
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane:
|
||||
ElSLib::PlaneD1(U,V,ax3,P,D1U,D1V);
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
ElSLib::CylinderD1(U,V,ax3,prm1,P,D1U,D1V);
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
ElSLib::SphereD1(U,V,ax3,prm1,P,D1U,D1V);
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
ElSLib::ConeD1(U,V,ax3,prm1,prm2,P,D1U,D1V);
|
||||
break;
|
||||
case GeomAbs_Torus:
|
||||
ElSLib::TorusD1(U,V,ax3,prm1,prm2,P,D1U,D1V);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
ElSLib::PlaneD1(U, V, ax3, P, D1U, D1V);
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
ElSLib::CylinderD1(U, V, ax3, prm1, P, D1U, D1V);
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
ElSLib::SphereD1(U, V, ax3, prm1, P, D1U, D1V);
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
ElSLib::ConeD1(U, V, ax3, prm1, prm2, P, D1U, D1V);
|
||||
break;
|
||||
case GeomAbs_Torus:
|
||||
ElSLib::TorusD1(U, V, ax3, prm1, prm2, P, D1U, D1V);
|
||||
break;
|
||||
default: {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
gp_Vec IntSurf_Quadric::DN(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Vec IntSurf_Quadric::DN(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const
|
||||
{
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane:
|
||||
return ElSLib::PlaneDN(U,V,ax3,Nu,Nv);
|
||||
case GeomAbs_Cylinder:
|
||||
return ElSLib::CylinderDN(U,V,ax3,prm1,Nu,Nv);
|
||||
case GeomAbs_Sphere:
|
||||
return ElSLib::SphereDN(U,V,ax3,prm1,Nu,Nv);
|
||||
case GeomAbs_Cone:
|
||||
return ElSLib::ConeDN(U,V,ax3,prm1,prm2,Nu,Nv);
|
||||
case GeomAbs_Torus:
|
||||
return ElSLib::TorusDN(U,V,ax3,prm1,prm2,Nu,Nv);
|
||||
default:
|
||||
{
|
||||
gp_Vec v(0,0,0);
|
||||
return(v);
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
return ElSLib::PlaneDN(U, V, ax3, Nu, Nv);
|
||||
case GeomAbs_Cylinder:
|
||||
return ElSLib::CylinderDN(U, V, ax3, prm1, Nu, Nv);
|
||||
case GeomAbs_Sphere:
|
||||
return ElSLib::SphereDN(U, V, ax3, prm1, Nu, Nv);
|
||||
case GeomAbs_Cone:
|
||||
return ElSLib::ConeDN(U, V, ax3, prm1, prm2, Nu, Nv);
|
||||
case GeomAbs_Torus:
|
||||
return ElSLib::TorusDN(U, V, ax3, prm1, prm2, Nu, Nv);
|
||||
default: {
|
||||
gp_Vec v(0, 0, 0);
|
||||
return (v);
|
||||
}
|
||||
//break;
|
||||
// break;
|
||||
}
|
||||
// pop : pour NT
|
||||
// return gp_Vec(0,0,0);
|
||||
// pop : pour NT
|
||||
// return gp_Vec(0,0,0);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
gp_Vec IntSurf_Quadric::Normale(const Standard_Real U,
|
||||
const Standard_Real V) const
|
||||
gp_Vec IntSurf_Quadric::Normale(const Standard_Real U, const Standard_Real V) const
|
||||
{
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane:
|
||||
if(ax3direc)
|
||||
return ax3.Direction();
|
||||
else
|
||||
return ax3.Direction().Reversed();
|
||||
case GeomAbs_Cylinder:
|
||||
return Normale(Value(U,V));
|
||||
case GeomAbs_Sphere:
|
||||
return Normale(Value(U,V));
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
if (ax3direc)
|
||||
return ax3.Direction();
|
||||
else
|
||||
return ax3.Direction().Reversed();
|
||||
case GeomAbs_Cylinder:
|
||||
return Normale(Value(U, V));
|
||||
case GeomAbs_Sphere:
|
||||
return Normale(Value(U, V));
|
||||
case GeomAbs_Cone: {
|
||||
gp_Pnt P;
|
||||
gp_Vec D1u,D1v;
|
||||
ElSLib::ConeD1(U,V,ax3,prm1,prm2,P,D1u,D1v);
|
||||
if(D1u.Magnitude()<0.0000001) {
|
||||
gp_Vec Vn(0.0,0.0,0.0);
|
||||
return(Vn);
|
||||
gp_Vec D1u, D1v;
|
||||
ElSLib::ConeD1(U, V, ax3, prm1, prm2, P, D1u, D1v);
|
||||
if (D1u.Magnitude() < 0.0000001)
|
||||
{
|
||||
gp_Vec Vn(0.0, 0.0, 0.0);
|
||||
return (Vn);
|
||||
}
|
||||
return(D1u.Crossed(D1v));
|
||||
return (D1u.Crossed(D1v));
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
return Normale(Value(U,V));
|
||||
default:
|
||||
{
|
||||
gp_Vec v(0,0,0);
|
||||
return(v);
|
||||
}
|
||||
// break;
|
||||
case GeomAbs_Torus:
|
||||
return Normale(Value(U, V));
|
||||
default: {
|
||||
gp_Vec v(0, 0, 0);
|
||||
return (v);
|
||||
}
|
||||
// break;
|
||||
}
|
||||
// pop : pour NT
|
||||
// return gp_Vec(0,0,0);
|
||||
// pop : pour NT
|
||||
// return gp_Vec(0,0,0);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
gp_Vec IntSurf_Quadric::Normale (const gp_Pnt& P) const
|
||||
gp_Vec IntSurf_Quadric::Normale(const gp_Pnt& P) const
|
||||
{
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane:
|
||||
if(ax3direc)
|
||||
return ax3.Direction();
|
||||
else
|
||||
return ax3.Direction().Reversed();
|
||||
case GeomAbs_Cylinder:
|
||||
{
|
||||
if(ax3direc) {
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
if (ax3direc)
|
||||
return ax3.Direction();
|
||||
else
|
||||
return ax3.Direction().Reversed();
|
||||
case GeomAbs_Cylinder: {
|
||||
if (ax3direc)
|
||||
{
|
||||
return lin.Normal(P).Direction();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
gp_Dir D(lin.Normal(P).Direction());
|
||||
D.Reverse();
|
||||
return(D);
|
||||
return (D);
|
||||
}
|
||||
}
|
||||
case GeomAbs_Sphere:
|
||||
{
|
||||
if(ax3direc) {
|
||||
gp_Vec ax3P(ax3.Location(),P);
|
||||
case GeomAbs_Sphere: {
|
||||
if (ax3direc)
|
||||
{
|
||||
gp_Vec ax3P(ax3.Location(), P);
|
||||
return gp_Dir(ax3P);
|
||||
}
|
||||
else {
|
||||
gp_Vec Pax3(P,ax3.Location());
|
||||
else
|
||||
{
|
||||
gp_Vec Pax3(P, ax3.Location());
|
||||
return gp_Dir(Pax3);
|
||||
}
|
||||
}
|
||||
case GeomAbs_Cone:
|
||||
{
|
||||
Standard_Real U,V;
|
||||
ElSLib::ConeParameters(ax3,prm1,prm2,P,U,V);
|
||||
return Normale(U,V);
|
||||
case GeomAbs_Cone: {
|
||||
Standard_Real U, V;
|
||||
ElSLib::ConeParameters(ax3, prm1, prm2, P, U, V);
|
||||
return Normale(U, V);
|
||||
}
|
||||
case GeomAbs_Torus:
|
||||
{
|
||||
case GeomAbs_Torus: {
|
||||
gp_Pnt O, Pp, PT;
|
||||
//
|
||||
O = ax3.Location();
|
||||
gp_Vec OZ (ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O,P).Dot(ax3.Direction()))));
|
||||
gp_Vec OZ(ax3.Direction());
|
||||
Pp = P.Translated(OZ.Multiplied(-(gp_Vec(O, P).Dot(ax3.Direction()))));
|
||||
//
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ?
|
||||
ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ()*prm1);
|
||||
if (PT.SquareDistance(P) < 1e-14) {
|
||||
gp_Dir DOPp = (O.SquareDistance(Pp) < 1e-14) ? ax3.XDirection() : gp_Dir(gp_Vec(O, Pp));
|
||||
PT.SetXYZ(O.XYZ() + DOPp.XYZ() * prm1);
|
||||
if (PT.SquareDistance(P) < 1e-14)
|
||||
{
|
||||
return gp_Dir(OZ);
|
||||
}
|
||||
gp_Dir aD(ax3direc ? gp_Vec(PT, P) : gp_Vec(P, PT));
|
||||
return aD;
|
||||
}
|
||||
default:
|
||||
{
|
||||
gp_Vec v(0,0,0);
|
||||
return(v);
|
||||
default: {
|
||||
gp_Vec v(0, 0, 0);
|
||||
return (v);
|
||||
} // break;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void IntSurf_Quadric::Parameters (const gp_Pnt& P,
|
||||
Standard_Real& U,
|
||||
Standard_Real& V) const
|
||||
void IntSurf_Quadric::Parameters(const gp_Pnt& P, Standard_Real& U, Standard_Real& V) const
|
||||
{
|
||||
switch (typ) {
|
||||
case GeomAbs_Plane:
|
||||
ElSLib::PlaneParameters(ax3,P,U,V);
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
ElSLib::CylinderParameters(ax3,prm1,P,U,V);
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
ElSLib::SphereParameters(ax3,prm1,P,U,V);
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
ElSLib::ConeParameters(ax3,prm1,prm2,P,U,V);
|
||||
break;
|
||||
case GeomAbs_Torus:
|
||||
ElSLib::TorusParameters(ax3,prm1,prm2,P,U,V);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (typ)
|
||||
{
|
||||
case GeomAbs_Plane:
|
||||
ElSLib::PlaneParameters(ax3, P, U, V);
|
||||
break;
|
||||
case GeomAbs_Cylinder:
|
||||
ElSLib::CylinderParameters(ax3, prm1, P, U, V);
|
||||
break;
|
||||
case GeomAbs_Sphere:
|
||||
ElSLib::SphereParameters(ax3, prm1, P, U, V);
|
||||
break;
|
||||
case GeomAbs_Cone:
|
||||
ElSLib::ConeParameters(ax3, prm1, prm2, P, U, V);
|
||||
break;
|
||||
case GeomAbs_Torus:
|
||||
ElSLib::TorusParameters(ax3, prm1, prm2, P, U, V);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -37,97 +37,82 @@ class gp_Torus;
|
||||
class gp_Pnt;
|
||||
class gp_Vec;
|
||||
|
||||
|
||||
|
||||
class IntSurf_Quadric
|
||||
class IntSurf_Quadric
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_Quadric();
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_Quadric(const gp_Pln& P);
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_Quadric(const gp_Cylinder& C);
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_Quadric(const gp_Sphere& S);
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_Quadric(const gp_Cone& C);
|
||||
|
||||
|
||||
Standard_EXPORT IntSurf_Quadric(const gp_Torus& T);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Pln& P);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Cylinder& C);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Sphere& S);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Cone& C);
|
||||
|
||||
Standard_EXPORT void SetValue (const gp_Torus& T);
|
||||
|
||||
Standard_EXPORT Standard_Real Distance (const gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT gp_Vec Gradient (const gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT void ValAndGrad (const gp_Pnt& P, Standard_Real& Dist, gp_Vec& Grad) const;
|
||||
|
||||
GeomAbs_SurfaceType TypeQuadric() const;
|
||||
|
||||
gp_Pln Plane() const;
|
||||
|
||||
gp_Sphere Sphere() const;
|
||||
|
||||
gp_Cylinder Cylinder() const;
|
||||
|
||||
gp_Cone Cone() const;
|
||||
|
||||
gp_Torus Torus() const;
|
||||
|
||||
Standard_EXPORT gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
|
||||
|
||||
Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
|
||||
|
||||
Standard_EXPORT gp_Vec Normale (const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
Standard_EXPORT void Parameters (const gp_Pnt& P, Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
Standard_EXPORT gp_Vec Normale (const gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Pln& P);
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Cylinder& C);
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Sphere& S);
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Cone& C);
|
||||
|
||||
Standard_EXPORT void SetValue(const gp_Torus& T);
|
||||
|
||||
Standard_EXPORT Standard_Real Distance(const gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT gp_Vec Gradient(const gp_Pnt& P) const;
|
||||
|
||||
Standard_EXPORT void ValAndGrad(const gp_Pnt& P, Standard_Real& Dist, gp_Vec& Grad) const;
|
||||
|
||||
GeomAbs_SurfaceType TypeQuadric() const;
|
||||
|
||||
gp_Pln Plane() const;
|
||||
|
||||
gp_Sphere Sphere() const;
|
||||
|
||||
gp_Cylinder Cylinder() const;
|
||||
|
||||
gp_Cone Cone() const;
|
||||
|
||||
gp_Torus Torus() const;
|
||||
|
||||
Standard_EXPORT gp_Pnt Value(const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
Standard_EXPORT void D1(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& D1U,
|
||||
gp_Vec& D1V) const;
|
||||
|
||||
Standard_EXPORT gp_Vec DN(const Standard_Real U,
|
||||
const Standard_Real V,
|
||||
const Standard_Integer Nu,
|
||||
const Standard_Integer Nv) const;
|
||||
|
||||
Standard_EXPORT gp_Vec Normale(const Standard_Real U, const Standard_Real V) const;
|
||||
|
||||
Standard_EXPORT void Parameters(const gp_Pnt& P, Standard_Real& U, Standard_Real& V) const;
|
||||
|
||||
Standard_EXPORT gp_Vec Normale(const gp_Pnt& P) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
gp_Ax3 ax3;
|
||||
gp_Lin lin;
|
||||
gp_Ax3 ax3;
|
||||
gp_Lin lin;
|
||||
GeomAbs_SurfaceType typ;
|
||||
Standard_Real prm1;
|
||||
Standard_Real prm2;
|
||||
Standard_Real prm3;
|
||||
Standard_Real prm4;
|
||||
Standard_Boolean ax3direc;
|
||||
|
||||
|
||||
Standard_Real prm1;
|
||||
Standard_Real prm2;
|
||||
Standard_Real prm3;
|
||||
Standard_Real prm4;
|
||||
Standard_Boolean ax3direc;
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_Quadric.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_Quadric_HeaderFile
|
||||
|
@@ -18,38 +18,38 @@
|
||||
#include <gp_Cone.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
|
||||
inline GeomAbs_SurfaceType IntSurf_Quadric::TypeQuadric () const {
|
||||
inline GeomAbs_SurfaceType IntSurf_Quadric::TypeQuadric() const
|
||||
{
|
||||
|
||||
return typ;
|
||||
}
|
||||
|
||||
|
||||
inline gp_Pln IntSurf_Quadric::Plane () const {
|
||||
inline gp_Pln IntSurf_Quadric::Plane() const
|
||||
{
|
||||
|
||||
return gp_Pln(ax3);
|
||||
}
|
||||
|
||||
inline gp_Sphere IntSurf_Quadric::Sphere() const
|
||||
{
|
||||
|
||||
inline gp_Sphere IntSurf_Quadric::Sphere () const {
|
||||
|
||||
return gp_Sphere(ax3,prm1);
|
||||
return gp_Sphere(ax3, prm1);
|
||||
}
|
||||
|
||||
inline gp_Cylinder IntSurf_Quadric::Cylinder() const
|
||||
{
|
||||
|
||||
inline gp_Cylinder IntSurf_Quadric::Cylinder () const {
|
||||
|
||||
return gp_Cylinder(ax3,prm1);
|
||||
return gp_Cylinder(ax3, prm1);
|
||||
}
|
||||
|
||||
inline gp_Cone IntSurf_Quadric::Cone() const
|
||||
{
|
||||
|
||||
inline gp_Cone IntSurf_Quadric::Cone () const {
|
||||
|
||||
return gp_Cone(ax3,prm2,prm1);
|
||||
return gp_Cone(ax3, prm2, prm1);
|
||||
}
|
||||
|
||||
inline gp_Torus IntSurf_Quadric::Torus () const {
|
||||
inline gp_Torus IntSurf_Quadric::Torus() const
|
||||
{
|
||||
|
||||
return gp_Torus(ax3, prm1, prm2);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -12,18 +12,18 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IntSurf_QuadricTool.hxx>
|
||||
|
||||
Standard_Real IntSurf_QuadricTool::Tolerance (const IntSurf_Quadric& Q) {
|
||||
switch (Q.TypeQuadric()) {
|
||||
case GeomAbs_Sphere:
|
||||
return 2.e-6*Q.Sphere().Radius();
|
||||
case GeomAbs_Cylinder:
|
||||
return 2.e-6*Q.Cylinder().Radius();
|
||||
default:
|
||||
break;
|
||||
Standard_Real IntSurf_QuadricTool::Tolerance(const IntSurf_Quadric& Q)
|
||||
{
|
||||
switch (Q.TypeQuadric())
|
||||
{
|
||||
case GeomAbs_Sphere:
|
||||
return 2.e-6 * Q.Sphere().Radius();
|
||||
case GeomAbs_Cylinder:
|
||||
return 2.e-6 * Q.Cylinder().Radius();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return(1e-6);
|
||||
return (1e-6);
|
||||
}
|
||||
|
||||
|
@@ -25,52 +25,43 @@
|
||||
class IntSurf_Quadric;
|
||||
class gp_Vec;
|
||||
|
||||
|
||||
//! This class provides a tool on a quadric that can be
|
||||
//! used to instantiates the Walking algorithms (see
|
||||
//! package IntWalk) with a Quadric from IntSurf
|
||||
//! as implicit surface.
|
||||
class IntSurf_QuadricTool
|
||||
class IntSurf_QuadricTool
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Returns the value of the function.
|
||||
static Standard_Real Value (const IntSurf_Quadric& Quad, const Standard_Real X, const Standard_Real Y, const Standard_Real Z);
|
||||
|
||||
static Standard_Real Value(const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z);
|
||||
|
||||
//! Returns the gradient of the function.
|
||||
static void Gradient (const IntSurf_Quadric& Quad, const Standard_Real X, const Standard_Real Y, const Standard_Real Z, gp_Vec& V);
|
||||
|
||||
static void Gradient(const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
gp_Vec& V);
|
||||
|
||||
//! Returns the value and the gradient.
|
||||
static void ValueAndGradient (const IntSurf_Quadric& Quad, const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& Val, gp_Vec& Grad);
|
||||
|
||||
static void ValueAndGradient(const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
Standard_Real& Val,
|
||||
gp_Vec& Grad);
|
||||
|
||||
//! returns the tolerance of the zero of the implicit function
|
||||
Standard_EXPORT static Standard_Real Tolerance (const IntSurf_Quadric& Quad);
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT static Standard_Real Tolerance(const IntSurf_Quadric& Quad);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_QuadricTool.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_QuadricTool_HeaderFile
|
||||
|
@@ -15,31 +15,32 @@
|
||||
#include <IntSurf_Quadric.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
inline Standard_Real IntSurf_QuadricTool::Value (const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z) {
|
||||
inline Standard_Real IntSurf_QuadricTool::Value(const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z)
|
||||
{
|
||||
|
||||
return Quad.Distance(gp_Pnt(X,Y,Z));
|
||||
return Quad.Distance(gp_Pnt(X, Y, Z));
|
||||
}
|
||||
|
||||
inline void IntSurf_QuadricTool::Gradient (const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
gp_Vec& V) {
|
||||
inline void IntSurf_QuadricTool::Gradient(const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
gp_Vec& V)
|
||||
{
|
||||
|
||||
V = Quad.Gradient(gp_Pnt(X,Y,Z));
|
||||
V = Quad.Gradient(gp_Pnt(X, Y, Z));
|
||||
}
|
||||
|
||||
inline void IntSurf_QuadricTool::ValueAndGradient (const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
Standard_Real& Val,
|
||||
gp_Vec& V) {
|
||||
inline void IntSurf_QuadricTool::ValueAndGradient(const IntSurf_Quadric& Quad,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real Z,
|
||||
Standard_Real& Val,
|
||||
gp_Vec& V)
|
||||
{
|
||||
|
||||
Quad.ValAndGrad(gp_Pnt(X,Y,Z),Val,V);
|
||||
Quad.ValAndGrad(gp_Pnt(X, Y, Z), Val, V);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -22,5 +22,4 @@
|
||||
|
||||
typedef NCollection_Sequence<IntSurf_Couple> IntSurf_SequenceOfCouple;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -22,5 +22,4 @@
|
||||
|
||||
typedef NCollection_Sequence<IntSurf_InteriorPoint> IntSurf_SequenceOfInteriorPoint;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -22,5 +22,4 @@
|
||||
|
||||
typedef NCollection_Sequence<IntSurf_PathPoint> IntSurf_SequenceOfPathPoint;
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -17,12 +17,11 @@
|
||||
#ifndef _IntSurf_Situation_HeaderFile
|
||||
#define _IntSurf_Situation_HeaderFile
|
||||
|
||||
|
||||
enum IntSurf_Situation
|
||||
{
|
||||
IntSurf_Inside,
|
||||
IntSurf_Outside,
|
||||
IntSurf_Unknown
|
||||
IntSurf_Inside,
|
||||
IntSurf_Outside,
|
||||
IntSurf_Unknown
|
||||
};
|
||||
|
||||
#endif // _IntSurf_Situation_HeaderFile
|
||||
|
@@ -12,33 +12,32 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IntSurf_Transition.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
IntSurf_Transition::IntSurf_Transition (const Standard_Boolean Tangent,
|
||||
const IntSurf_TypeTrans Type):
|
||||
tangent(Tangent),
|
||||
typetra(Type),
|
||||
situat(IntSurf_Unknown),
|
||||
oppos(Standard_False)
|
||||
IntSurf_Transition::IntSurf_Transition(const Standard_Boolean Tangent, const IntSurf_TypeTrans Type)
|
||||
: tangent(Tangent),
|
||||
typetra(Type),
|
||||
situat(IntSurf_Unknown),
|
||||
oppos(Standard_False)
|
||||
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
IntSurf_Transition::IntSurf_Transition(const Standard_Boolean Tangent,
|
||||
const IntSurf_Situation Situ,
|
||||
const Standard_Boolean Oppos)
|
||||
: tangent(Tangent),
|
||||
typetra(IntSurf_Touch),
|
||||
situat(Situ),
|
||||
oppos(Oppos)
|
||||
{
|
||||
}
|
||||
|
||||
IntSurf_Transition::IntSurf_Transition (const Standard_Boolean Tangent,
|
||||
const IntSurf_Situation Situ,
|
||||
const Standard_Boolean Oppos):
|
||||
tangent(Tangent),
|
||||
typetra(IntSurf_Touch),
|
||||
situat(Situ),
|
||||
oppos(Oppos)
|
||||
{}
|
||||
|
||||
|
||||
IntSurf_Transition::IntSurf_Transition ():
|
||||
tangent(Standard_False),
|
||||
typetra(IntSurf_Undecided),
|
||||
situat(IntSurf_Unknown),
|
||||
oppos(Standard_False)
|
||||
{}
|
||||
IntSurf_Transition::IntSurf_Transition()
|
||||
: tangent(Standard_False),
|
||||
typetra(IntSurf_Undecided),
|
||||
situat(IntSurf_Unknown),
|
||||
oppos(Standard_False)
|
||||
{
|
||||
}
|
||||
|
@@ -25,48 +25,49 @@
|
||||
#include <IntSurf_TypeTrans.hxx>
|
||||
#include <IntSurf_Situation.hxx>
|
||||
|
||||
|
||||
//! Definition of the transition at the intersection
|
||||
//! between an intersection line and a restriction curve
|
||||
//! on a surface.
|
||||
class IntSurf_Transition
|
||||
class IntSurf_Transition
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Empty constructor. Creates an UNDECIDED transition.
|
||||
Standard_EXPORT IntSurf_Transition();
|
||||
|
||||
|
||||
//! Create a IN or OUT transition
|
||||
Standard_EXPORT IntSurf_Transition(const Standard_Boolean Tangent, const IntSurf_TypeTrans Type);
|
||||
|
||||
|
||||
//! Create a TOUCH transition.
|
||||
Standard_EXPORT IntSurf_Transition(const Standard_Boolean Tangent, const IntSurf_Situation Situ, const Standard_Boolean Oppos);
|
||||
|
||||
Standard_EXPORT IntSurf_Transition(const Standard_Boolean Tangent,
|
||||
const IntSurf_Situation Situ,
|
||||
const Standard_Boolean Oppos);
|
||||
|
||||
//! Set the values of an IN or OUT transition.
|
||||
void SetValue (const Standard_Boolean Tangent, const IntSurf_TypeTrans Type);
|
||||
|
||||
void SetValue(const Standard_Boolean Tangent, const IntSurf_TypeTrans Type);
|
||||
|
||||
//! Set the values of a TOUCH transition.
|
||||
void SetValue (const Standard_Boolean Tangent, const IntSurf_Situation Situ, const Standard_Boolean Oppos);
|
||||
|
||||
void SetValue(const Standard_Boolean Tangent,
|
||||
const IntSurf_Situation Situ,
|
||||
const Standard_Boolean Oppos);
|
||||
|
||||
//! Set the values of an UNDECIDED transition.
|
||||
void SetValue();
|
||||
|
||||
void SetValue();
|
||||
|
||||
//! Returns the type of Transition (in/out/touch/undecided)
|
||||
//! for the arc given by value. This the transition of
|
||||
//! the intersection line compared to the Arc of restriction,
|
||||
//! i-e when the function returns INSIDE for example, it
|
||||
//! means that the intersection line goes inside the
|
||||
//! part of plane limited by the arc of restriction.
|
||||
IntSurf_TypeTrans TransitionType() const;
|
||||
|
||||
IntSurf_TypeTrans TransitionType() const;
|
||||
|
||||
//! Returns TRUE if the point is tangent to the arc
|
||||
//! given by Value.
|
||||
//! An exception is raised if TransitionType returns UNDECIDED.
|
||||
Standard_Boolean IsTangent() const;
|
||||
|
||||
Standard_Boolean IsTangent() const;
|
||||
|
||||
//! Returns a significant value if TransitionType returns
|
||||
//! TOUCH. In this case, the function returns :
|
||||
//! INSIDE when the intersection line remains inside the Arc,
|
||||
@@ -74,8 +75,8 @@ public:
|
||||
//! UNKNOWN when the calsulus cannot give results.
|
||||
//! If TransitionType returns IN, or OUT, or UNDECIDED, a
|
||||
//! exception is raised.
|
||||
IntSurf_Situation Situation() const;
|
||||
|
||||
IntSurf_Situation Situation() const;
|
||||
|
||||
//! returns a significant value if TransitionType returns
|
||||
//! TOUCH.
|
||||
//! In this case, the function returns true when
|
||||
@@ -83,34 +84,16 @@ public:
|
||||
//! space.
|
||||
//! If TransitionType returns IN or OUT or UNDECIDED, an
|
||||
//! exception is raised.
|
||||
Standard_Boolean IsOpposite() const;
|
||||
|
||||
|
||||
|
||||
Standard_Boolean IsOpposite() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Standard_Boolean tangent;
|
||||
Standard_Boolean tangent;
|
||||
IntSurf_TypeTrans typetra;
|
||||
IntSurf_Situation situat;
|
||||
Standard_Boolean oppos;
|
||||
|
||||
|
||||
Standard_Boolean oppos;
|
||||
};
|
||||
|
||||
|
||||
#include <IntSurf_Transition.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _IntSurf_Transition_HeaderFile
|
||||
|
@@ -14,56 +14,62 @@
|
||||
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
|
||||
inline void IntSurf_Transition::SetValue (const Standard_Boolean Tangent,
|
||||
const IntSurf_TypeTrans Type) {
|
||||
inline void IntSurf_Transition::SetValue(const Standard_Boolean Tangent,
|
||||
const IntSurf_TypeTrans Type)
|
||||
{
|
||||
tangent = Tangent;
|
||||
typetra = Type;
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_Transition::SetValue (const Standard_Boolean Tangent,
|
||||
const IntSurf_Situation Situ,
|
||||
const Standard_Boolean Oppos) {
|
||||
inline void IntSurf_Transition::SetValue(const Standard_Boolean Tangent,
|
||||
const IntSurf_Situation Situ,
|
||||
const Standard_Boolean Oppos)
|
||||
{
|
||||
|
||||
tangent = Tangent;
|
||||
typetra = IntSurf_Touch;
|
||||
situat = Situ;
|
||||
oppos = Oppos;
|
||||
situat = Situ;
|
||||
oppos = Oppos;
|
||||
}
|
||||
|
||||
|
||||
inline void IntSurf_Transition::SetValue () {
|
||||
inline void IntSurf_Transition::SetValue()
|
||||
{
|
||||
|
||||
typetra = IntSurf_Undecided;
|
||||
}
|
||||
|
||||
|
||||
inline IntSurf_TypeTrans IntSurf_Transition::TransitionType () const {
|
||||
inline IntSurf_TypeTrans IntSurf_Transition::TransitionType() const
|
||||
{
|
||||
|
||||
return typetra;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntSurf_Transition::IsTangent() const
|
||||
{
|
||||
|
||||
inline Standard_Boolean IntSurf_Transition::IsTangent () const {
|
||||
|
||||
if (typetra == IntSurf_Undecided) {throw Standard_DomainError();}
|
||||
if (typetra == IntSurf_Undecided)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return tangent;
|
||||
}
|
||||
|
||||
inline IntSurf_Situation IntSurf_Transition::Situation() const
|
||||
{
|
||||
|
||||
inline IntSurf_Situation IntSurf_Transition::Situation () const {
|
||||
|
||||
if (typetra != IntSurf_Touch) {throw Standard_DomainError();}
|
||||
if (typetra != IntSurf_Touch)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return situat;
|
||||
}
|
||||
|
||||
inline Standard_Boolean IntSurf_Transition::IsOpposite() const
|
||||
{
|
||||
|
||||
inline Standard_Boolean IntSurf_Transition::IsOpposite () const {
|
||||
|
||||
if (typetra != IntSurf_Touch) {throw Standard_DomainError();}
|
||||
if (typetra != IntSurf_Touch)
|
||||
{
|
||||
throw Standard_DomainError();
|
||||
}
|
||||
return oppos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -17,13 +17,12 @@
|
||||
#ifndef _IntSurf_TypeTrans_HeaderFile
|
||||
#define _IntSurf_TypeTrans_HeaderFile
|
||||
|
||||
|
||||
enum IntSurf_TypeTrans
|
||||
{
|
||||
IntSurf_In,
|
||||
IntSurf_Out,
|
||||
IntSurf_Touch,
|
||||
IntSurf_Undecided
|
||||
IntSurf_In,
|
||||
IntSurf_Out,
|
||||
IntSurf_Touch,
|
||||
IntSurf_Undecided
|
||||
};
|
||||
|
||||
#endif // _IntSurf_TypeTrans_HeaderFile
|
||||
|
Reference in New Issue
Block a user