mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0031361: Modeling algorithms - An exception arise when building tube
* Add status flag to GeomFill_Pipe * Add myIsPerform flag to GeomFill_Pipe * Add checking vectors in GeomFill_CorrectedFrenet * Add boolean return to SetCurve virtual methods * Add test case
This commit is contained in:
parent
e3fd3d83da
commit
b2ec2f5d42
@ -66,12 +66,14 @@ GeomFill_ConstantBiNormal::GeomFill_ConstantBiNormal(const gp_Dir& BiNormal) : B
|
||||
return copy;
|
||||
}
|
||||
|
||||
void GeomFill_ConstantBiNormal::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_ConstantBiNormal::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
Standard_Boolean isOK = Standard_False;
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
frenet->SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
isOK = frenet->SetCurve(C);
|
||||
}
|
||||
return isOK;
|
||||
}
|
||||
|
||||
Standard_Boolean GeomFill_ConstantBiNormal::D0(const Standard_Real Param,gp_Vec& Tangent,gp_Vec& Normal,gp_Vec& BiNormal)
|
||||
|
@ -45,7 +45,9 @@ public:
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
//! Computes Triedrhon on curve at parameter <Param>
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
|
||||
|
@ -337,34 +337,36 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
|
||||
return copy;
|
||||
}
|
||||
|
||||
void GeomFill_CorrectedFrenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_CorrectedFrenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
if (! C.IsNull())
|
||||
{
|
||||
frenet->SetCurve(C);
|
||||
|
||||
GeomAbs_CurveType type;
|
||||
type = C->GetType();
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case GeomAbs_Circle:
|
||||
case GeomAbs_Ellipse:
|
||||
case GeomAbs_Hyperbola:
|
||||
case GeomAbs_Parabola:
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
// No probleme isFrenet
|
||||
isFrenet = Standard_True;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
// We have to search singularities
|
||||
isFrenet = Standard_True;
|
||||
Init();
|
||||
}
|
||||
{
|
||||
// No probleme isFrenet
|
||||
isFrenet = Standard_True;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
// We have to search singularities
|
||||
isFrenet = Standard_True;
|
||||
Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
return isFrenet;
|
||||
}
|
||||
|
||||
|
||||
@ -438,16 +440,20 @@ Handle(GeomFill_TrihedronLaw) GeomFill_CorrectedFrenet::Copy() const
|
||||
TLaw = EvolAroundT;
|
||||
//OCC78
|
||||
Standard_Integer iEnd = SeqPoles.Length();
|
||||
HArrPoles = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrAngle = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrTangent = new TColgp_HArray1OfVec(1, iEnd);
|
||||
HArrNormal = new TColgp_HArray1OfVec(1, iEnd);
|
||||
for(i = 1; i <= iEnd; i++){
|
||||
HArrPoles->ChangeValue(i) = SeqPoles(i);
|
||||
HArrAngle->ChangeValue(i) = SeqAngle(i);
|
||||
HArrTangent->ChangeValue(i) = SeqTangent(i);
|
||||
HArrNormal->ChangeValue(i) = SeqNormal(i);
|
||||
};
|
||||
if (iEnd != 0)
|
||||
{
|
||||
HArrPoles = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrAngle = new TColStd_HArray1OfReal(1, iEnd);
|
||||
HArrTangent = new TColgp_HArray1OfVec(1, iEnd);
|
||||
HArrNormal = new TColgp_HArray1OfVec(1, iEnd);
|
||||
for (i = 1; i <= iEnd; i++) {
|
||||
HArrPoles->ChangeValue(i) = SeqPoles(i);
|
||||
HArrAngle->ChangeValue(i) = SeqAngle(i);
|
||||
HArrTangent->ChangeValue(i) = SeqTangent(i);
|
||||
HArrNormal->ChangeValue(i) = SeqNormal(i);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#ifdef DRAW
|
||||
if (Affich) {
|
||||
@ -612,7 +618,7 @@ Standard_Real GeomFill_CorrectedFrenet::CalcAngleAT(const gp_Vec& Tangent, const
|
||||
Standard_Real angle;
|
||||
gp_Vec Normal_rot, cross;
|
||||
angle = Tangent.Angle(prevTangent);
|
||||
if (Abs(angle) > Precision::Angular()) {
|
||||
if (Abs(angle) > Precision::Angular() && Abs(angle) < M_PI - Precision::Angular()) {
|
||||
cross = Tangent.Crossed(prevTangent).Normalized();
|
||||
Normal_rot = Normal + sin(angle)*cross.Crossed(Normal) +
|
||||
(1 - cos(angle))*cross.Crossed(cross.Crossed(Normal));
|
||||
|
@ -52,7 +52,9 @@ public:
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of frenet law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void SetInterval (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
|
||||
|
||||
|
@ -63,11 +63,11 @@ Handle(GeomFill_LocationLaw) GeomFill_CurveAndTrihedron::Copy() const
|
||||
//Function: SetCurve
|
||||
//Purpose :
|
||||
//==================================================================
|
||||
void GeomFill_CurveAndTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_CurveAndTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = C;
|
||||
myLaw->SetCurve(C);
|
||||
return myLaw->SetCurve(C);
|
||||
}
|
||||
|
||||
const Handle(Adaptor3d_Curve)& GeomFill_CurveAndTrihedron::GetCurve() const
|
||||
|
@ -52,7 +52,9 @@ public:
|
||||
|
||||
Standard_EXPORT GeomFill_CurveAndTrihedron(const Handle(GeomFill_TrihedronLaw)& Trihedron);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;
|
||||
|
||||
|
@ -61,33 +61,36 @@ Handle(GeomFill_TrihedronLaw) GeomFill_DiscreteTrihedron::Copy() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GeomFill_DiscreteTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_DiscreteTrihedron::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
if (! C.IsNull())
|
||||
{
|
||||
GeomAbs_CurveType type;
|
||||
type = C->GetType();
|
||||
switch (type) {
|
||||
switch (type)
|
||||
{
|
||||
case GeomAbs_Circle:
|
||||
case GeomAbs_Ellipse:
|
||||
case GeomAbs_Hyperbola:
|
||||
case GeomAbs_Parabola:
|
||||
case GeomAbs_Line:
|
||||
{
|
||||
// No problem
|
||||
myUseFrenet = Standard_True;
|
||||
myFrenet->SetCurve(C);
|
||||
break;
|
||||
}
|
||||
{
|
||||
// No problem
|
||||
myUseFrenet = Standard_True;
|
||||
myFrenet->SetCurve(C);
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
myUseFrenet = Standard_False;
|
||||
// We have to fill <myKnots> and <myTrihedrons>
|
||||
Init();
|
||||
break;
|
||||
}
|
||||
{
|
||||
myUseFrenet = Standard_False;
|
||||
// We have to fill <myKnots> and <myTrihedrons>
|
||||
Init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return myUseFrenet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -51,7 +51,9 @@ public:
|
||||
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
//! compute Trihedron on curve at parameter <Param>
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
|
||||
|
@ -117,7 +117,7 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void GeomFill_Frenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_Frenet::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
GeomFill_TrihedronLaw::SetCurve(C);
|
||||
if (! C.IsNull()) {
|
||||
@ -141,6 +141,7 @@ Handle(GeomFill_TrihedronLaw) GeomFill_Frenet::Copy() const
|
||||
}
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -47,7 +47,9 @@ public:
|
||||
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of frenet law
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
//! compute Triedrhon on curve at parameter <Param>
|
||||
Standard_EXPORT virtual Standard_Boolean D0 (const Standard_Real Param, gp_Vec& Tangent, gp_Vec& Normal, gp_Vec& BiNormal) Standard_OVERRIDE;
|
||||
|
@ -292,7 +292,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curv
|
||||
//function : SetCurve
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GeomFill_GuideTrihedronAC::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_GuideTrihedronAC::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = C;
|
||||
@ -301,6 +301,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curv
|
||||
L = myCurveAC->GetLength();
|
||||
// CorrectOrient(myGuide);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,9 @@ public:
|
||||
|
||||
Standard_EXPORT GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_Curve)& guide);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
|
@ -197,10 +197,11 @@ GeomFill_GuideTrihedronPlan::GeomFill_GuideTrihedronPlan (const Handle(Adaptor3d
|
||||
//function : SetCurve
|
||||
//purpose : calculation of trihedron
|
||||
//=======================================================================
|
||||
void GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_GuideTrihedronPlan::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
if (!myCurve.IsNull()) Init();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -48,7 +48,9 @@ public:
|
||||
|
||||
Standard_EXPORT GeomFill_GuideTrihedronPlan(const Handle(Adaptor3d_Curve)& theGuide);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& thePath) Standard_OVERRIDE;
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& thePath) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const Standard_OVERRIDE;
|
||||
|
||||
|
@ -105,13 +105,14 @@ GeomFill_LocationDraft::GeomFill_LocationDraft
|
||||
//Purpose : Calcul des poles sur la surfaces d'arret (intersection
|
||||
// entre la generatrice et la surface en myNbPts points de la section)
|
||||
//==================================================================
|
||||
void GeomFill_LocationDraft::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_LocationDraft::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = C;
|
||||
myLaw->SetCurve(C);
|
||||
Standard_Boolean isOK = myLaw->SetCurve(C);
|
||||
|
||||
Prepare();
|
||||
return isOK;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
|
@ -46,7 +46,9 @@ public:
|
||||
|
||||
Standard_EXPORT void SetAngle (const Standard_Real Angle);
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! calculation of poles on locking surfaces (the intersection between the generatrixand the surface at the cross - section points myNbPts)
|
||||
//! @return Standard_True in case if execution end correctly
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;
|
||||
|
||||
|
@ -537,7 +537,7 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
//Purpose : Calcul des poles sur la surface d'arret (intersection
|
||||
// courbe guide / surface de revolution en myNbPts points)
|
||||
//==================================================================
|
||||
void GeomFill_LocationGuide::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_LocationGuide::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
Standard_Real LastAngle;
|
||||
myCurve = C;
|
||||
@ -550,6 +550,7 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
|
||||
if (rotation) SetRotation(myPoles2d->Value(1,1).X(), LastAngle);
|
||||
}
|
||||
return myStatus == GeomFill_PipeOk;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
|
@ -56,7 +56,9 @@ public:
|
||||
|
||||
Standard_EXPORT void EraseRotation();
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
//! calculating poles on a surface (courbe guide / the surface of rotation in points myNbPts)
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const Standard_OVERRIDE;
|
||||
|
||||
|
@ -38,9 +38,8 @@ class GeomFill_LocationLaw : public Standard_Transient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C) = 0;
|
||||
//! initialize curve of location law
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C) = 0;
|
||||
|
||||
Standard_EXPORT virtual const Handle(Adaptor3d_Curve)& GetCurve() const = 0;
|
||||
|
||||
|
@ -205,7 +205,7 @@ static Standard_Boolean CheckSense(const TColGeom_SequenceOfCurve& Seq1,
|
||||
//purpose : constructor with no parameters.
|
||||
//=======================================================================
|
||||
|
||||
GeomFill_Pipe::GeomFill_Pipe() : myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
GeomFill_Pipe::GeomFill_Pipe() : myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@ -218,7 +218,7 @@ GeomFill_Pipe::GeomFill_Pipe() : myIsDone(Standard_False),myExchUV(Standard_Fals
|
||||
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Standard_Real Radius)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, Radius);
|
||||
@ -232,7 +232,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& FirstSect,
|
||||
const GeomFill_Trihedron Option)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, FirstSect, Option);
|
||||
@ -246,7 +246,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom2d_Curve)& Path,
|
||||
const Handle(Geom_Surface)& Support,
|
||||
const Handle(Geom_Curve)& FirstSect)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, Support, FirstSect);
|
||||
@ -260,7 +260,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom2d_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& FirstSect,
|
||||
const Handle(Geom_Curve)& LastSect)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, FirstSect, LastSect);
|
||||
@ -274,7 +274,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const TColGeom_SequenceOfCurve& NSections)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path, NSections);
|
||||
@ -288,7 +288,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& Curve1,
|
||||
const gp_Dir& Direction)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False), myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False), myKPart(Standard_False)
|
||||
{
|
||||
Init(Path, Curve1, Direction);
|
||||
}
|
||||
@ -301,7 +301,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& Curve1,
|
||||
const Handle(Geom_Curve)& Curve2,
|
||||
const Standard_Real Radius)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Handle(GeomAdaptor_Curve) AdpPath =
|
||||
@ -324,7 +324,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Adaptor3d_Curve)& Path,
|
||||
const Handle(Adaptor3d_Curve)& Curve1,
|
||||
const Handle(Adaptor3d_Curve)& Curve2,
|
||||
const Standard_Real Radius)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
{
|
||||
Init();
|
||||
Init(Path,Curve1,Curve2,Radius);
|
||||
@ -344,7 +344,7 @@ GeomFill_Pipe::GeomFill_Pipe(const Handle(Geom_Curve)& Path,
|
||||
const Handle(Geom_Curve)& FirstSect,
|
||||
const Standard_Boolean byACR,
|
||||
const Standard_Boolean rotat)
|
||||
: myIsDone(Standard_False),myExchUV(Standard_False),myKPart(Standard_False)
|
||||
: myStatus(GeomFill_PipeNotOk), myExchUV(Standard_False),myKPart(Standard_False)
|
||||
// Path : trajectoire
|
||||
// Guide : courbe guide
|
||||
// FirstSect : section
|
||||
@ -751,31 +751,37 @@ void GeomFill_Pipe::Init(const Handle(Geom_Curve)& Path,
|
||||
|
||||
if (!TLaw.IsNull()) {
|
||||
myLoc = new (GeomFill_CurveAndTrihedron) (TLaw);
|
||||
myLoc->SetCurve(myAdpPath);
|
||||
TColGeom_SequenceOfCurve SeqC;
|
||||
TColStd_SequenceOfReal SeqP;
|
||||
SeqC.Clear();
|
||||
SeqP.Clear();
|
||||
// sequence des sections
|
||||
GeomFill_SectionPlacement Pl1(myLoc, FirstSect);
|
||||
Pl1.Perform(first,Precision::Confusion());
|
||||
SeqC.Append(Pl1.Section(Standard_False));
|
||||
GeomFill_SectionPlacement Pl2(myLoc, LastSect);
|
||||
Pl2.Perform(first,Precision::Confusion());
|
||||
SeqC.Append(Pl2.Section(Standard_False));
|
||||
// sequence des parametres associes
|
||||
SeqP.Append(first);
|
||||
SeqP.Append(last);
|
||||
|
||||
// verification de l'orientation
|
||||
TColGeom_SequenceOfCurve NewSeq;
|
||||
if (CheckSense(SeqC,NewSeq)) SeqC = NewSeq;
|
||||
if (!(myLoc->SetCurve(myAdpPath)))
|
||||
{
|
||||
myStatus = GeomFill_ImpossibleContact;
|
||||
return;
|
||||
}
|
||||
|
||||
// creation de la NSections
|
||||
Standard_Real deb,fin;
|
||||
deb = SeqC.First()->FirstParameter();
|
||||
fin = SeqC.First()->LastParameter();
|
||||
mySec = new (GeomFill_NSections) (SeqC,SeqP,deb,fin,first,last);
|
||||
TColGeom_SequenceOfCurve SeqC;
|
||||
TColStd_SequenceOfReal SeqP;
|
||||
SeqC.Clear();
|
||||
SeqP.Clear();
|
||||
// sequence of sections
|
||||
GeomFill_SectionPlacement Pl1(myLoc, FirstSect);
|
||||
Pl1.Perform(first, Precision::Confusion());
|
||||
SeqC.Append(Pl1.Section(Standard_False));
|
||||
GeomFill_SectionPlacement Pl2(myLoc, LastSect);
|
||||
Pl2.Perform(first, Precision::Confusion());
|
||||
SeqC.Append(Pl2.Section(Standard_False));
|
||||
// sequence of associated parameters
|
||||
SeqP.Append(first);
|
||||
SeqP.Append(last);
|
||||
|
||||
// orientation verification
|
||||
TColGeom_SequenceOfCurve NewSeq;
|
||||
if (CheckSense(SeqC, NewSeq)) SeqC = NewSeq;
|
||||
|
||||
// creation of the NSections
|
||||
Standard_Real deb, fin;
|
||||
deb = SeqC.First()->FirstParameter();
|
||||
fin = SeqC.First()->LastParameter();
|
||||
mySec = new (GeomFill_NSections) (SeqC, SeqP, deb, fin, first, last);
|
||||
}
|
||||
}
|
||||
|
||||
@ -831,6 +837,11 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
|
||||
const Standard_Integer DegMax,
|
||||
const Standard_Integer NbMaxSegment)
|
||||
{
|
||||
if (myStatus == GeomFill_ImpossibleContact)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GeomAbs_Shape TheConti;
|
||||
switch (Conti) {
|
||||
case GeomAbs_C0:
|
||||
@ -884,7 +895,7 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
|
||||
App.UDegree(),
|
||||
App.VDegree());
|
||||
myError = App.MaxErrorOnSurf();
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
//else {
|
||||
// throw Standard_ConstructionError("GeomFill_Pipe::Perform : Cannot make a surface");
|
||||
@ -898,7 +909,7 @@ void GeomFill_Pipe::Perform(const Standard_Real Tol,
|
||||
if (Sweep.IsDone()) {
|
||||
mySurface = Sweep.Surface();
|
||||
myError = Sweep.ErrorOnSurface();
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
//else {
|
||||
// throw Standard_ConstructionError("GeomFill_Pipe::Perform : Cannot make a surface");
|
||||
@ -975,7 +986,7 @@ Standard_Boolean GeomFill_Pipe::KPartT4()
|
||||
myAdpPath->FirstParameter(),
|
||||
myAdpPath->LastParameter());
|
||||
Ok = Standard_True; //C'est bien un cylindre
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
// ----------- Cas du tore ----------------------------------
|
||||
else if (myAdpPath->GetType() == GeomAbs_Circle &&
|
||||
@ -1038,7 +1049,7 @@ Standard_Boolean GeomFill_Pipe::KPartT4()
|
||||
myAdpPath->FirstParameter(),myAdpPath->LastParameter(),VV1,VV2);
|
||||
myExchUV = Standard_True;
|
||||
Ok = Standard_True;
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
|
||||
return Ok;
|
||||
@ -1137,6 +1148,6 @@ void GeomFill_Pipe::ApproxSurf(const Standard_Boolean WithParameters) {
|
||||
App.VDegree());
|
||||
Standard_Real t2d;
|
||||
App.TolReached(myError, t2d);
|
||||
myIsDone = Standard_True;
|
||||
myStatus = GeomFill_PipeOk;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <GeomFill_Trihedron.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <TColGeom_SequenceOfCurve.hxx>
|
||||
#include <GeomFill_PipeError.hxx>
|
||||
|
||||
class Geom_Surface;
|
||||
class GeomFill_LocationLaw;
|
||||
@ -249,7 +250,11 @@ public:
|
||||
//! Returns whether approximation was done.
|
||||
Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
//! Returns execution status
|
||||
GeomFill_PipeError GetStatus() const
|
||||
{
|
||||
return myStatus;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@ -271,8 +276,7 @@ private:
|
||||
|
||||
Standard_EXPORT Standard_Boolean KPartT4();
|
||||
|
||||
|
||||
Standard_Boolean myIsDone;
|
||||
GeomFill_PipeError myStatus;//!< Execution status
|
||||
Standard_Real myRadius;
|
||||
Standard_Real myError;
|
||||
Handle(Adaptor3d_Curve) myAdpPath;
|
||||
@ -285,8 +289,6 @@ private:
|
||||
Standard_Boolean myExchUV;
|
||||
Standard_Boolean myKPart;
|
||||
Standard_Boolean myPolynomial;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -70,6 +70,5 @@ inline Standard_Real GeomFill_Pipe::ErrorOnSurf() const
|
||||
//=======================================================================
|
||||
inline Standard_Boolean GeomFill_Pipe::IsDone() const
|
||||
{
|
||||
return myIsDone;
|
||||
return myStatus == GeomFill_PipeOk;
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,11 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(GeomFill_TrihedronLaw,Standard_Transient)
|
||||
|
||||
void GeomFill_TrihedronLaw::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
Standard_Boolean GeomFill_TrihedronLaw::SetCurve(const Handle(Adaptor3d_Curve)& C)
|
||||
{
|
||||
myCurve = C;
|
||||
myTrimmed = myCurve;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
|
@ -34,8 +34,9 @@ class GeomFill_TrihedronLaw : public Standard_Transient
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT virtual void SetCurve (const Handle(Adaptor3d_Curve)& C);
|
||||
//! initialize curve of trihedron law
|
||||
//! @return Standard_True
|
||||
Standard_EXPORT virtual Standard_Boolean SetCurve (const Handle(Adaptor3d_Curve)& C);
|
||||
|
||||
Standard_EXPORT virtual Handle(GeomFill_TrihedronLaw) Copy() const = 0;
|
||||
|
||||
|
@ -237,8 +237,8 @@ static Standard_Integer tuyau (Draw_Interpretor& di,
|
||||
|
||||
Pipe.Perform(1.e-4, Standard_False, Cont);
|
||||
if (!Pipe.IsDone()) {
|
||||
di << "GeomFill_Pipe cannot make a surface\n";
|
||||
return 1;
|
||||
di << "Error: GeomFill_Pipe cannot make a surface\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real Accuracy = Pipe.ErrorOnSurf();
|
||||
|
11
tests/bugs/modalg_7/bug31361
Normal file
11
tests/bugs/modalg_7/bug31361
Normal file
@ -0,0 +1,11 @@
|
||||
puts "================================================="
|
||||
puts "0031361: Modeling algorithms - A crash arise when building tube"
|
||||
puts "================================================="
|
||||
puts ""
|
||||
|
||||
puts "REQUIRED ALL: Error: GeomFill_Pipe cannot make a surface"
|
||||
|
||||
circle c1 0 0 0 10
|
||||
circle c2 0 100 0 10
|
||||
beziercurve curve 4 0 0 0 100 0 0 100 100 0 0 100 0
|
||||
tuyau t curve c1 c2
|
Loading…
x
Reference in New Issue
Block a user