mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0024305: New option in BRepOffsetAPI_MakePipeShell algorithm: the swept shell with varying width of section bounded by auxiliary spine
Test case for issue CR24305
This commit is contained in:
@@ -80,6 +80,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_HCur
|
||||
gp_Vec To, B;
|
||||
myTrimmed->D1(Param, P, To);//point et derivee au parametre Param sur myCurve
|
||||
myTrimG->D0(tG, PG);// point au parametre tG sur myGuide
|
||||
myCurPointOnGuide = PG;
|
||||
|
||||
gp_Vec n (P, PG); // vecteur definissant la normale
|
||||
|
||||
@@ -118,6 +119,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_HCur
|
||||
|
||||
myTrimmed->D2(Param, P, To, DTo);
|
||||
myTrimG->D1(tG, PG, TG);
|
||||
myCurPointOnGuide = PG;
|
||||
|
||||
gp_Vec n (P, PG), dn;
|
||||
Standard_Real Norm = n.Magnitude();
|
||||
@@ -188,6 +190,7 @@ GeomFill_GuideTrihedronAC::GeomFill_GuideTrihedronAC(const Handle(Adaptor3d_HCur
|
||||
|
||||
myTrimmed->D3(Param, P, To, DTo, D2To);
|
||||
myTrimG->D2(tG, PG, TG, DTG);
|
||||
myCurPointOnGuide = PG;
|
||||
|
||||
Standard_Real NTo = To.Magnitude();
|
||||
Standard_Real N2To = To.SquareMagnitude();
|
||||
|
@@ -278,6 +278,8 @@ is
|
||||
Param2 : Real)
|
||||
is static;
|
||||
|
||||
ComputeAutomaticLaw(me; ParAndRad : out HArray1OfPnt2d from TColgp)
|
||||
returns PipeError from GeomFill;
|
||||
|
||||
fields
|
||||
myLaw : TrihedronWithGuide from GeomFill; -- loi de triedre
|
||||
|
@@ -44,7 +44,6 @@
|
||||
#include <Adaptor3d_HSurface.hxx>
|
||||
|
||||
#include <IntCurveSurface_IntersectionPoint.hxx>
|
||||
#include <IntCurveSurface_HInter.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <GeomAdaptor.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
@@ -62,6 +61,9 @@
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
|
||||
#include <Extrema_ExtCS.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
|
||||
#if DRAW
|
||||
static Standard_Integer Affich = 0;
|
||||
#include <Approx_Curve3d.hxx>
|
||||
@@ -228,13 +230,12 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
Standard_Integer ii, Deg;
|
||||
Standard_Boolean isconst, israt=Standard_False;
|
||||
Standard_Real t, v,w, OldAngle=0, Angle, DeltaG, DeltaU, Diff;
|
||||
Standard_Real CurAngle = PrecAngle, a1, a2;
|
||||
Standard_Real CurAngle = PrecAngle, a1/*, a2*/;
|
||||
gp_Pnt2d p1,p2;
|
||||
Handle(Geom_SurfaceOfRevolution) Revol; // surface de revolution
|
||||
Handle(GeomAdaptor_HSurface) Pl; // = Revol
|
||||
Handle(Geom_TrimmedCurve) S;
|
||||
IntCurveSurface_IntersectionPoint PInt; // intersection guide/Revol
|
||||
IntCurveSurface_HInter Int;
|
||||
Handle(TColStd_HArray1OfInteger) Mult;
|
||||
Handle(TColStd_HArray1OfReal) Knots, Weights;
|
||||
Handle(TColgp_HArray1OfPnt) Poles;
|
||||
@@ -338,13 +339,18 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
(Handle(Geom_Curve)::DownCast(mySection->Copy()), Uf, Ul);
|
||||
}
|
||||
S->Transform(Transfo);
|
||||
|
||||
|
||||
// Surface de revolution
|
||||
Revol = new(Geom_SurfaceOfRevolution) (S, Ax);
|
||||
|
||||
Pl = new (GeomAdaptor_HSurface)(Revol);
|
||||
Int.Perform(myGuide, Pl); // intersection surf. revol / guide
|
||||
if (Int.NbPoints() == 0) {
|
||||
GeomAdaptor_Surface GArevol(Revol);
|
||||
Extrema_ExtCS DistMini(myGuide->Curve(), GArevol,
|
||||
Precision::Confusion(), Precision::Confusion());
|
||||
Extrema_POnCurv Pc;
|
||||
Extrema_POnSurf Ps;
|
||||
Standard_Real theU = 0., theV = 0.;
|
||||
|
||||
if (!DistMini.IsDone() || DistMini.NbExt() == 0) {
|
||||
#if DEB
|
||||
cout <<"LocationGuide : Pas d'intersection"<<endl;
|
||||
TraceRevol(t, U, myLaw, mySec, myCurve, Trans);
|
||||
@@ -370,7 +376,9 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
SOS = Standard_True;
|
||||
math_Vector RR(1,3);
|
||||
Result.Root(RR);
|
||||
PInt.SetValues(P, RR(2), RR(3), RR(1), IntCurveSurface_Out);
|
||||
PInt.SetValues(P, RR(2), RR(3), RR(1), IntCurveSurface_Out);
|
||||
theU = PInt.U();
|
||||
theV = PInt.V();
|
||||
}
|
||||
else {
|
||||
#if DEB
|
||||
@@ -385,22 +393,30 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
}
|
||||
else { // on prend le point d'intersection
|
||||
// d'angle le plus proche de P
|
||||
PInt = Int.Point(1);
|
||||
a1 = PInt.U();
|
||||
|
||||
Standard_Real MinDist = RealLast();
|
||||
Standard_Integer jref = 0;
|
||||
for (Standard_Integer j = 1; j <= DistMini.NbExt(); j++)
|
||||
{
|
||||
Standard_Real aDist = DistMini.SquareDistance(j);
|
||||
if (aDist < MinDist)
|
||||
{
|
||||
MinDist = aDist;
|
||||
jref = j;
|
||||
}
|
||||
}
|
||||
MinDist = Sqrt(MinDist);
|
||||
DistMini.Points(jref, Pc, Ps);
|
||||
|
||||
Ps.Parameter(theU, theV);
|
||||
a1 = theU;
|
||||
|
||||
InGoodPeriod (CurAngle, 2*M_PI, a1);
|
||||
Standard_Real Dmin = Abs(a1-CurAngle);
|
||||
for (Standard_Integer jj=2;jj<=Int.NbPoints();jj++) {
|
||||
a2 = Int.Point(jj).U();
|
||||
InGoodPeriod (CurAngle, 2*M_PI, a2);
|
||||
if (Abs(a2-CurAngle) < Dmin) {
|
||||
PInt = Int.Point(jj);
|
||||
Dmin = Abs(a2-CurAngle);
|
||||
}//if
|
||||
}//for
|
||||
}//else
|
||||
|
||||
// Controle de w
|
||||
w = PInt.W();
|
||||
w = Pc.Parameter();
|
||||
|
||||
if (ii>1) {
|
||||
Diff = w - myPoles2d->Value(1, ii-1).Y();
|
||||
if (Abs(Diff) > DeltaG) {
|
||||
@@ -419,7 +435,8 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
#endif
|
||||
}
|
||||
//Recadrage de l'angle.
|
||||
Angle = PInt.U();
|
||||
Angle = theU;
|
||||
|
||||
if (ii > 1) {
|
||||
Diff = Angle - OldAngle;
|
||||
if (Abs(Diff) > M_PI) {
|
||||
@@ -435,7 +452,8 @@ static void InGoodPeriod(const Standard_Real Prec,
|
||||
|
||||
|
||||
//Recadrage du V
|
||||
v = PInt.V();
|
||||
v = theV;
|
||||
|
||||
if (ii > 1) {
|
||||
if (uperiodic) {
|
||||
InGoodPeriod (myPoles2d->Value(2, ii-1).Y(), UPeriod, v);
|
||||
@@ -1442,3 +1460,40 @@ void GeomFill_LocationGuide::SetOrigine(const Standard_Real Param1,
|
||||
OrigParam2 = Param2;
|
||||
}
|
||||
|
||||
//==================================================================
|
||||
//Function : ComputeAutomaticLaw
|
||||
//Purpose :
|
||||
//==================================================================
|
||||
GeomFill_PipeError GeomFill_LocationGuide::ComputeAutomaticLaw(Handle(TColgp_HArray1OfPnt2d)& ParAndRad) const
|
||||
{
|
||||
gp_Pnt P;
|
||||
gp_Vec T,N,B;
|
||||
Standard_Integer ii;
|
||||
Standard_Real t;
|
||||
|
||||
GeomFill_PipeError theStatus = GeomFill_PipeOk;
|
||||
|
||||
Standard_Real f = myCurve->FirstParameter();
|
||||
Standard_Real l = myCurve->LastParameter();
|
||||
|
||||
ParAndRad = new TColgp_HArray1OfPnt2d(1, myNbPts);
|
||||
for (ii = 1; ii <= myNbPts; ii++)
|
||||
{
|
||||
t = Standard_Real(myNbPts - ii)*f + Standard_Real(ii - 1)*l;
|
||||
t /= (myNbPts-1);
|
||||
myCurve->D0(t, P);
|
||||
Standard_Boolean Ok = myLaw->D0(t, T, N, B);
|
||||
if (!Ok)
|
||||
{
|
||||
theStatus = myLaw->ErrorStatus();
|
||||
return theStatus;
|
||||
}
|
||||
gp_Pnt PointOnGuide = myLaw->CurrentPointOnGuide();
|
||||
Standard_Real CurWidth = P.Distance(PointOnGuide);
|
||||
|
||||
gp_Pnt2d aParamWithRadius(t, CurWidth);
|
||||
ParAndRad->SetValue(ii, aParamWithRadius);
|
||||
}
|
||||
|
||||
return theStatus;
|
||||
}
|
||||
|
@@ -29,7 +29,8 @@ inherits TrihedronLaw from GeomFill
|
||||
|
||||
uses
|
||||
HCurve from Adaptor3d,
|
||||
Real from Standard
|
||||
Real from Standard,
|
||||
Pnt from gp
|
||||
|
||||
raises
|
||||
OutOfRange, NotImplemented
|
||||
@@ -45,9 +46,15 @@ is
|
||||
Param2 : Real)
|
||||
is deferred;
|
||||
|
||||
CurrentPointOnGuide(me)
|
||||
---Purpose: Returns the current point on guide
|
||||
-- found by D0, D1 or D2.
|
||||
returns Pnt from gp;
|
||||
|
||||
fields
|
||||
myGuide : HCurve from Adaptor3d is protected;
|
||||
myTrimG : HCurve from Adaptor3d is protected;
|
||||
myCurPointOnGuide : Pnt from gp is protected;
|
||||
|
||||
end TrihedronWithGuide;
|
||||
|
||||
|
@@ -28,4 +28,12 @@ Handle(Adaptor3d_HCurve) GeomFill_TrihedronWithGuide::Guide()const
|
||||
return myGuide;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CurrentPointOnGuide
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt GeomFill_TrihedronWithGuide::CurrentPointOnGuide() const
|
||||
{
|
||||
return myCurPointOnGuide;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user