case GeomAbs_Torus: break;
default:
{
- IntPatch_PrmPrmIntersection interpp;
- interpp.Perform(S1,D1,TolArc,TolTang,myFleche,myUVMaxStep);
- if (interpp.IsDone())
- {
- done = Standard_True;
- tgte = Standard_False;
- empt = interpp.IsEmpty();
- const Standard_Integer nblm = interpp.NbLines();
- for (Standard_Integer i=1; i<=nblm; i++) slin.Append(interpp.Line(i));
- }
+ IntPatch_PrmPrmIntersection interpp;
+ interpp.Perform(S1,D1,TolArc,TolTang,myFleche,myUVMaxStep);
+ if (interpp.IsDone())
+ {
+ done = Standard_True;
+ tgte = Standard_False;
+ empt = interpp.IsEmpty();
+ const Standard_Integer nblm = interpp.NbLines();
+ for (Standard_Integer i=1; i<=nblm; i++) slin.Append(interpp.Line(i));
+ }
}
break;
}
for(Standard_Real U = S->FirstUParameter(); U <= S->LastUParameter(); U += DU)
{
for(Standard_Real V = S->FirstVParameter(); V <= S->LastVParameter(); V += DV)
- {
- S->D0(U,V,PUV);
+ {
+ S->D0(U,V,PUV);
const Standard_Real cXYZ = PUV.XYZ().Modulus();
- if(cXYZ > tMaxXYZ) { tMaxXYZ = cXYZ; ptMax = PUV; }
- if(cXYZ < tMinXYZ) { tMinXYZ = cXYZ; ptMin = PUV; }
- }
+ if(cXYZ > tMaxXYZ) { tMaxXYZ = cXYZ; ptMax = PUV; }
+ if(cXYZ < tMinXYZ) { tMinXYZ = cXYZ; ptMin = PUV; }
+ }
}
pMin = ptMin;
pMax = ptMax;
{
Standard_Real Umax = -1.e+100, Umin = 1.e+100, Vmax = -1.e+100, Vmin = 1.e+100, cU, cV;
if(ext1.IsDone())
- {
+ {
for(Standard_Integer i = 1; i <= ext1.NbExt(); i++)
{
- const Extrema_POnSurf & pons = ext1.Point(i);
- pons.Parameter(cU,cV);
- if(cU > Umax) Umax = cU;
- if(cU < Umin) Umin = cU;
- if(cV > Vmax) Vmax = cV;
- if(cV < Vmin) Vmin = cV;
+ const Extrema_POnSurf & pons = ext1.Point(i);
+ pons.Parameter(cU,cV);
+ if(cU > Umax) Umax = cU;
+ if(cU < Umin) Umin = cU;
+ if(cV > Vmax) Vmax = cV;
+ if(cV < Vmin) Vmin = cV;
}
- }
+ }
if(ext2.IsDone())
- {
+ {
for(Standard_Integer i = 1; i <= ext2.NbExt(); i++)
{
const Extrema_POnSurf & pons = ext2.Point(i);
if(cV > Vmax) Vmax = cV;
if(cV < Vmin) Vmin = cV;
}
- }
+ }
TP = Max(Abs(Umin),Max(Abs(Umax),Max(Abs(Vmin),Abs(Vmax))));
}
if(TP == 0.) { TrimS = InfSurf; return; }
if(Vinf && !Vsup){ TrimS = InfSurf->VTrim(-tp, InfSurf->LastVParameter(), 1.0e-7); IsTrimed = 1; }
if(!Vinf && Vsup){ TrimS = InfSurf->VTrim(InfSurf->FirstVParameter(), tp, 1.0e-7); IsTrimed = 1; }
if(IsTrimed)
- {
- TmpSS = TrimS;
- if(Uinf && Usup) TrimS = TmpSS->UTrim(-tp, tp, 1.0e-7);
- if(Uinf && !Usup) TrimS = TmpSS->UTrim(-tp, InfSurf->LastUParameter(), 1.0e-7);
- if(!Uinf && Usup) TrimS = TmpSS->UTrim(InfSurf->FirstUParameter(), tp, 1.0e-7);
- }
+ {
+ TmpSS = TrimS;
+ if(Uinf && Usup) TrimS = TmpSS->UTrim(-tp, tp, 1.0e-7);
+ if(Uinf && !Usup) TrimS = TmpSS->UTrim(-tp, InfSurf->LastUParameter(), 1.0e-7);
+ if(!Uinf && Usup) TrimS = TmpSS->UTrim(InfSurf->FirstUParameter(), tp, 1.0e-7);
+ }
else
- {
- if(Uinf && Usup) TrimS = InfSurf->UTrim(-tp, tp, 1.0e-7);
- if(Uinf && !Usup) TrimS = InfSurf->UTrim(-tp, InfSurf->LastUParameter(), 1.0e-7);
- if(!Uinf && Usup) TrimS = InfSurf->UTrim(InfSurf->FirstUParameter(), tp, 1.0e-7);
- }
+ {
+ if(Uinf && Usup) TrimS = InfSurf->UTrim(-tp, tp, 1.0e-7);
+ if(Uinf && !Usup) TrimS = InfSurf->UTrim(-tp, InfSurf->LastUParameter(), 1.0e-7);
+ if(!Uinf && Usup) TrimS = InfSurf->UTrim(InfSurf->FirstUParameter(), tp, 1.0e-7);
+ }
}
}
//================================================================================
Handle(Geom_Curve) gc = GS->UIso(U);
if(IsVP && (FirstV == 0.0 && LastV == (2.*M_PI))) I = gc;
else
- {
- Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstV,LastV);
- //szv:I = Handle(Geom_Curve)::DownCast(gtc);
- I = gtc;
- }
+ {
+ Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstV,LastV);
+ //szv:I = Handle(Geom_Curve)::DownCast(gtc);
+ I = gtc;
+ }
}
else//OffsetSurface
{
GeomAdaptor_Curve gac(gcbs);
const GeomAbs_CurveType GACT = gac.GetType();
if(IsVP || IsVC || GACT == GeomAbs_BSplineCurve || GACT == GeomAbs_BezierCurve || Abs(LastV - FirstV) < 1.e+5)
- {
- Handle(Geom_Curve) gc = gos->UIso(U);
- if(IsVP && (FirstV == 0.0 && LastV == (2*M_PI))) I = gc;
- else
+ {
+ Handle(Geom_Curve) gc = gos->UIso(U);
+ if(IsVP && (FirstV == 0.0 && LastV == (2*M_PI))) I = gc;
+ else
{
- Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstV,LastV);
- //szv:I = Handle(Geom_Curve)::DownCast(gtc);
- I = gtc;
- }
- }
+ Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstV,LastV);
+ //szv:I = Handle(Geom_Curve)::DownCast(gtc);
+ I = gtc;
+ }
+ }
else//Offset Line, Parab, Hyperb
- {
- Standard_Real VmTr, VMTr;
- if(GACT != GeomAbs_Hyperbola)
+ {
+ Standard_Real VmTr, VMTr;
+ if(GACT != GeomAbs_Hyperbola)
{
- if(FirstV >= 0. && LastV >= 0.){ VmTr = FirstV; VMTr = ((LastV - FirstV) > 1.e+4) ? (FirstV + 1.e+4) : LastV; }
- else if(FirstV < 0. && LastV < 0.){ VMTr = LastV; VmTr = ((FirstV - LastV) < -1.e+4) ? (LastV - 1.e+4) : FirstV; }
- else { VmTr = (FirstV < -1.e+4) ? -1.e+4 : FirstV; VMTr = (LastV > 1.e+4) ? 1.e+4 : LastV; }
- }
- else//Hyperbola
- {
- if(FirstV >= 0. && LastV >= 0.)
- {
- if(FirstV > 4.) return;
- VmTr = FirstV; VMTr = (LastV > 4.) ? 4. : LastV;
- }
- else if(FirstV < 0. && LastV < 0.)
- {
- if(LastV < -4.) return;
- VMTr = LastV; VmTr = (FirstV < -4.) ? -4. : FirstV;
- }
- else { VmTr = (FirstV < -4.) ? -4. : FirstV; VMTr = (LastV > 4.) ? 4. : LastV; }
- }
- //Make trimmed surface
- Handle(Geom_RectangularTrimmedSurface) rts = new Geom_RectangularTrimmedSurface(gos,VmTr,VMTr,Standard_True);
- I = rts->UIso(U);
- }
+ if(FirstV >= 0. && LastV >= 0.){ VmTr = FirstV; VMTr = ((LastV - FirstV) > 1.e+4) ? (FirstV + 1.e+4) : LastV; }
+ else if(FirstV < 0. && LastV < 0.){ VMTr = LastV; VmTr = ((FirstV - LastV) < -1.e+4) ? (LastV - 1.e+4) : FirstV; }
+ else { VmTr = (FirstV < -1.e+4) ? -1.e+4 : FirstV; VMTr = (LastV > 1.e+4) ? 1.e+4 : LastV; }
+ }
+ else//Hyperbola
+ {
+ if(FirstV >= 0. && LastV >= 0.)
+ {
+ if(FirstV > 4.) return;
+ VmTr = FirstV; VMTr = (LastV > 4.) ? 4. : LastV;
+ }
+ else if(FirstV < 0. && LastV < 0.)
+ {
+ if(LastV < -4.) return;
+ VMTr = LastV; VmTr = (FirstV < -4.) ? -4. : FirstV;
+ }
+ else { VmTr = (FirstV < -4.) ? -4. : FirstV; VMTr = (LastV > 4.) ? 4. : LastV; }
+ }
+ //Make trimmed surface
+ Handle(Geom_RectangularTrimmedSurface) rts = new Geom_RectangularTrimmedSurface(gos,VmTr,VMTr,Standard_True);
+ I = rts->UIso(U);
+ }
}
}
//================================================================================
Handle(Geom_Curve) gc = GS->VIso(V);
if(IsUP && (FirstU == 0.0 && LastU == (2*M_PI))) I = gc;
else
- {
- Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstU,LastU);
- //szv:I = Handle(Geom_Curve)::DownCast(gtc);
- I = gtc;
- }
+ {
+ Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstU,LastU);
+ //szv:I = Handle(Geom_Curve)::DownCast(gtc);
+ I = gtc;
+ }
}
else//OffsetSurface
{
GeomAdaptor_Curve gac(gcbs);
const GeomAbs_CurveType GACT = gac.GetType();
if(IsUP || IsUC || GACT == GeomAbs_BSplineCurve || GACT == GeomAbs_BezierCurve || Abs(LastU - FirstU) < 1.e+5)
- {
- Handle(Geom_Curve) gc = gos->VIso(V);
- if(IsUP && (FirstU == 0.0 && LastU == (2*M_PI))) I = gc;
- else
- {
- Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstU,LastU);
- //szv:I = Handle(Geom_Curve)::DownCast(gtc);
- I = gtc;
- }
- }
+ {
+ Handle(Geom_Curve) gc = gos->VIso(V);
+ if(IsUP && (FirstU == 0.0 && LastU == (2*M_PI))) I = gc;
+ else
+ {
+ Handle(Geom_TrimmedCurve) gtc = new Geom_TrimmedCurve(gc,FirstU,LastU);
+ //szv:I = Handle(Geom_Curve)::DownCast(gtc);
+ I = gtc;
+ }
+ }
else//Offset Line, Parab, Hyperb
- {
- Standard_Real UmTr, UMTr;
- if(GACT != GeomAbs_Hyperbola)
- {
- if(FirstU >= 0. && LastU >= 0.){ UmTr = FirstU; UMTr = ((LastU - FirstU) > 1.e+4) ? (FirstU + 1.e+4) : LastU; }
- else if(FirstU < 0. && LastU < 0.){ UMTr = LastU; UmTr = ((FirstU - LastU) < -1.e+4) ? (LastU - 1.e+4) : FirstU; }
- else { UmTr = (FirstU < -1.e+4) ? -1.e+4 : FirstU; UMTr = (LastU > 1.e+4) ? 1.e+4 : LastU; }
- }
- else//Hyperbola
- {
- if(FirstU >= 0. && LastU >= 0.)
- {
- if(FirstU > 4.) return;
- UmTr = FirstU; UMTr = (LastU > 4.) ? 4. : LastU;
- }
- else if(FirstU < 0. && LastU < 0.)
- {
- if(LastU < -4.) return;
- UMTr = LastU; UmTr = (FirstU < -4.) ? -4. : FirstU;
- }
- else { UmTr = (FirstU < -4.) ? -4. : FirstU; UMTr = (LastU > 4.) ? 4. : LastU; }
- }
- //Make trimmed surface
- Handle(Geom_RectangularTrimmedSurface) rts = new Geom_RectangularTrimmedSurface(gos,UmTr,UMTr,Standard_True);
- I = rts->VIso(V);
- }
+ {
+ Standard_Real UmTr, UMTr;
+ if(GACT != GeomAbs_Hyperbola)
+ {
+ if(FirstU >= 0. && LastU >= 0.){ UmTr = FirstU; UMTr = ((LastU - FirstU) > 1.e+4) ? (FirstU + 1.e+4) : LastU; }
+ else if(FirstU < 0. && LastU < 0.){ UMTr = LastU; UmTr = ((FirstU - LastU) < -1.e+4) ? (LastU - 1.e+4) : FirstU; }
+ else { UmTr = (FirstU < -1.e+4) ? -1.e+4 : FirstU; UMTr = (LastU > 1.e+4) ? 1.e+4 : LastU; }
+ }
+ else//Hyperbola
+ {
+ if(FirstU >= 0. && LastU >= 0.)
+ {
+ if(FirstU > 4.) return;
+ UmTr = FirstU; UMTr = (LastU > 4.) ? 4. : LastU;
+ }
+ else if(FirstU < 0. && LastU < 0.)
+ {
+ if(LastU < -4.) return;
+ UMTr = LastU; UmTr = (FirstU < -4.) ? -4. : FirstU;
+ }
+ else { UmTr = (FirstU < -4.) ? -4. : FirstU; UMTr = (LastU > 4.) ? 4. : LastU; }
+ }
+ //Make trimmed surface
+ Handle(Geom_RectangularTrimmedSurface) rts = new Geom_RectangularTrimmedSurface(gos,UmTr,UMTr,Standard_True);
+ I = rts->VIso(V);
+ }
}
}
//================================================================================
if(ICC.NbPoints() > 0 )
{
for(Standard_Integer ip = 1; ip <= ICC.NbPoints(); ip++)
- {
- gp_Pnt2d P = ICC.Point(ip);
- gp_Pnt P3d = ElCLib::To3d(gp_Ax2(puvS1,gp_Dir(DV)),P);
- SP.Append(P3d);
- }
+ {
+ gp_Pnt2d P = ICC.Point(ip);
+ gp_Pnt P3d = ElCLib::To3d(gp_Ax2(puvS1,gp_Dir(DV)),P);
+ SP.Append(P3d);
+ }
}
}
//================================================================================
case GeomAbs_Parabola:
{
if(Abs(Lst - Fst) > TrVal)
- {
- if(Fst >= 0. && Lst >= 0.)
+ {
+ if(Fst >= 0. && Lst >= 0.)
{
- NewFst = Fst;
- NewLst = ((Fst + TrVal) < Lst) ? (Fst + TrVal) : Lst;
- }
- if(Fst < 0. && Lst < 0.)
- {
- NewLst = Lst;
- NewFst = ((Lst - TrVal) > Fst) ? (Lst - TrVal) : Fst;
- }
- else
- {
- NewFst = (Fst < -TrVal) ? -TrVal : Fst;
- NewLst = (Lst > TrVal) ? TrVal : Lst;
- }
- NeedTr = Standard_True;
- }
- break;
+ NewFst = Fst;
+ NewLst = ((Fst + TrVal) < Lst) ? (Fst + TrVal) : Lst;
+ }
+ if(Fst < 0. && Lst < 0.)
+ {
+ NewLst = Lst;
+ NewFst = ((Lst - TrVal) > Fst) ? (Lst - TrVal) : Fst;
+ }
+ else
+ {
+ NewFst = (Fst < -TrVal) ? -TrVal : Fst;
+ NewLst = (Lst > TrVal) ? TrVal : Lst;
+ }
+ NeedTr = Standard_True;
+ }
+ break;
}
- case GeomAbs_Hyperbola:
+ case GeomAbs_Hyperbola:
{
if(Abs(Lst - Fst) > 10.)
- {
- if(Fst >= 0. && Lst >= 0.)
- {
- if(Fst > 4.) return;
- NewFst = Fst;
- NewLst = (Lst > 4.) ? 4. : Lst;
- }
- if(Fst < 0. && Lst < 0.)
- {
- if(Lst < -4.) return;
- NewLst = Lst;
- NewFst = (Fst < -4.) ? -4. : Fst;
- }
- else
- {
- NewFst = (Fst < -4.) ? -4. : Fst;
- NewLst = (Lst > 4.) ? 4. : Lst;
- }
- NeedTr = Standard_True;
- }
+ {
+ if(Fst >= 0. && Lst >= 0.)
+ {
+ if(Fst > 4.) return;
+ NewFst = Fst;
+ NewLst = (Lst > 4.) ? 4. : Lst;
+ }
+ if(Fst < 0. && Lst < 0.)
+ {
+ if(Lst < -4.) return;
+ NewLst = Lst;
+ NewFst = (Fst < -4.) ? -4. : Fst;
+ }
+ else
+ {
+ NewFst = (Fst < -4.) ? -4. : Fst;
+ NewLst = (Lst > 4.) ? 4. : Lst;
+ }
+ NeedTr = Standard_True;
+ }
break;
}
- default:
+ default:
break;
}
}
//================================================================================
//function: FUN_TrimBothSurf
-//================================================================================
+//================================================================================
static void FUN_TrimBothSurf(const Handle(Adaptor3d_HSurface)& S1,
const GeomAbs_SurfaceType& T1,
const Handle(Adaptor3d_HSurface)& S2,
if(TrmU1)
{
if(TrmV1)
- {
- Handle(Adaptor3d_HSurface) TS = NS1;
- NS1 = TS->UTrim(U1S1, U2S1, 1.0e-7);
- }
+ {
+ Handle(Adaptor3d_HSurface) TS = NS1;
+ NS1 = TS->UTrim(U1S1, U2S1, 1.0e-7);
+ }
else NS1 = S1->UTrim(U1S1, U2S1, 1.0e-7);
}
if(TrmU2)
{
if(TrmV2)
- {
- Handle(Adaptor3d_HSurface) TS = NS2;
- NS2 = TS->UTrim(U1S2, U2S2, 1.0e-7);
- }
+ {
+ Handle(Adaptor3d_HSurface) TS = NS2;
+ NS2 = TS->UTrim(U1S2, U2S2, 1.0e-7);
+ }
else NS2 = S2->UTrim(U1S2, U2S2, 1.0e-7);
}
}
//treatment of the cases with cone or torus
Standard_Boolean TreatAsBiParametric = Standard_False;
- Standard_Integer bImp = 0;
+ Standard_Integer bGeomGeom = 0;
//
if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone ||
typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) {
aCTType = aCTSurf->GetType();
bToCheck = Standard_False;
//
- if (aCTType == GeomAbs_Cone) {
- Standard_Real a1 = Abs(aCTSurf->Cone().SemiAngle());
+ if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone) {
+ const gp_Cone aCon1 = (aCTType == GeomAbs_Cone) ?
+ aCTSurf->Cone() : aGeomSurf->Cone();
+ Standard_Real a1 = Abs(aCon1.SemiAngle());
bToCheck = (a1 < 0.02) || (a1 > 1.55);
+ //
if (typs1 == typs2) {
- Standard_Real a2 = Abs(aGeomSurf->Cone().SemiAngle());
+ const gp_Cone aCon2 = aGeomSurf->Cone();
+ Standard_Real a2 = Abs(aCon2.SemiAngle());
bToCheck = bToCheck || (a2 < 0.02) || (a2 > 1.55);
//
if (a1 > 1.55 && a2 > 1.55) {//quasi-planes: if same domain, treat as canonic
- const gp_Cone aCon1 = aCTSurf->Cone();
- const gp_Cone aCon2 = aGeomSurf->Cone();
const gp_Ax1 A1 = aCon1.Axis(), A2 = aCon2.Axis();
if (A1.IsParallel(A2,Precision::Angular())) {
const gp_Pnt Apex1 = aCon1.Apex(), Apex2 = aCon2.Apex();
const gp_Pln Plan1( Apex1, A1.Direction() );
if (Plan1.Distance( Apex2 ) <= Precision::Confusion()) {
bToCheck = Standard_False;
- bImp = 1;
}
}
}
}
//
- aCTAx = aCTSurf->Cone().Axis();
+ TreatAsBiParametric = bToCheck;
+ if (aCTType == GeomAbs_Cone) {
+ aCTAx = aCon1.Axis();
+ }
}
- else {
- bToCheck = aCTSurf->Torus().MajorRadius() > aCTSurf->Torus().MinorRadius();
- if (bToCheck && (typs1 == typs2)) {
- bToCheck = aGeomSurf->Torus().MajorRadius() > aGeomSurf->Torus().MinorRadius();
+ //
+ if (typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) {
+ const gp_Torus aTor1 = (aCTType == GeomAbs_Torus) ?
+ aCTSurf->Torus() : aGeomSurf->Torus();
+ bToCheck = aTor1.MajorRadius() > aTor1.MinorRadius();
+ if (typs1 == typs2) {
+ const gp_Torus aTor2 = aGeomSurf->Torus();
+ bToCheck = aTor2.MajorRadius() > aTor2.MinorRadius();
+ }
+ //
+ if (aCTType == GeomAbs_Torus) {
+ aCTAx = aTor1.Axis();
}
- aCTAx = aCTSurf->Torus().Axis();
}
//
if (bToCheck) {
case GeomAbs_Plane: {
aGeomAx = aGeomSurf->Plane().Axis();
if (aCTType == GeomAbs_Cone) {
- bImp = 1;
+ bGeomGeom = 1;
if (Abs(aCTSurf->Cone().SemiAngle()) < 0.02) {
Standard_Real ps = Abs(aCTAx.Direction().Dot(aGeomAx.Direction()));
if(ps < 0.015) {
- bImp = 0;
+ bGeomGeom = 0;
}
}
}
if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) ||
(aCTAx.IsNormal(aGeomAx, Precision::Angular()) &&
(aGeomSurf->Plane().Distance(aCTAx.Location()) < Precision::Confusion()))) {
- bImp = 1;
+ bGeomGeom = 1;
}
}
bToCheck = Standard_False;
}
case GeomAbs_Sphere: {
if (aL1.Distance(aGeomSurf->Sphere().Location()) < Precision::Confusion()) {
- bImp = 1;
+ bGeomGeom = 1;
}
bToCheck = Standard_False;
break;
if (bToCheck) {
if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) &&
(aL1.Distance(aGeomAx.Location()) <= Precision::Confusion())) {
- bImp = 1;
+ bGeomGeom = 1;
}
}
//
- if (aCTType == GeomAbs_Cone) {
- TreatAsBiParametric = (bImp == 0);
+ if (bGeomGeom == 1) {
+ TreatAsBiParametric = Standard_False;
}
}
}
case GeomAbs_Cylinder:
case GeomAbs_Sphere:
case GeomAbs_Cone: ts1 = 1; break;
- case GeomAbs_Torus: ts1 = bImp; break;
+ case GeomAbs_Torus: ts1 = bGeomGeom; break;
default: break;
}
case GeomAbs_Cylinder:
case GeomAbs_Sphere:
case GeomAbs_Cone: ts2 = 1; break;
- case GeomAbs_Torus: ts2 = bImp; break;
+ case GeomAbs_Torus: ts2 = bGeomGeom; break;
default: break;
}
//
//
//treatment of the cases with cone or torus
Standard_Boolean TreatAsBiParametric = Standard_False;
- Standard_Integer bImp = 0;
+ Standard_Integer bGeomGeom = 0;
//
if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone ||
typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) {
aCTType = aCTSurf->GetType();
bToCheck = Standard_False;
//
- if (aCTType == GeomAbs_Cone) {
- Standard_Real a1 = Abs(aCTSurf->Cone().SemiAngle());
+ if (typs1 == GeomAbs_Cone || typs2 == GeomAbs_Cone) {
+ const gp_Cone aCon1 = (aCTType == GeomAbs_Cone) ?
+ aCTSurf->Cone() : aGeomSurf->Cone();
+ Standard_Real a1 = Abs(aCon1.SemiAngle());
bToCheck = (a1 < 0.02) || (a1 > 1.55);
+ //
if (typs1 == typs2) {
- Standard_Real a2 = Abs(aGeomSurf->Cone().SemiAngle());
+ const gp_Cone aCon2 = aGeomSurf->Cone();
+ Standard_Real a2 = Abs(aCon2.SemiAngle());
bToCheck = bToCheck || (a2 < 0.02) || (a2 > 1.55);
//
if (a1 > 1.55 && a2 > 1.55) {//quasi-planes: if same domain, treat as canonic
- const gp_Cone aCon1 = aCTSurf->Cone();
- const gp_Cone aCon2 = aGeomSurf->Cone();
const gp_Ax1 A1 = aCon1.Axis(), A2 = aCon2.Axis();
if (A1.IsParallel(A2,Precision::Angular())) {
const gp_Pnt Apex1 = aCon1.Apex(), Apex2 = aCon2.Apex();
const gp_Pln Plan1( Apex1, A1.Direction() );
if (Plan1.Distance( Apex2 ) <= Precision::Confusion()) {
bToCheck = Standard_False;
- bImp = 1;
}
}
}
}
//
- aCTAx = aCTSurf->Cone().Axis();
+ TreatAsBiParametric = bToCheck;
+ if (aCTType == GeomAbs_Cone) {
+ aCTAx = aCon1.Axis();
+ }
}
- else {
- bToCheck = aCTSurf->Torus().MajorRadius() > aCTSurf->Torus().MinorRadius();
- if (bToCheck && (typs1 == typs2)) {
- bToCheck = aGeomSurf->Torus().MajorRadius() > aGeomSurf->Torus().MinorRadius();
+ //
+ if (typs1 == GeomAbs_Torus || typs2 == GeomAbs_Torus) {
+ const gp_Torus aTor1 = (aCTType == GeomAbs_Torus) ?
+ aCTSurf->Torus() : aGeomSurf->Torus();
+ bToCheck = aTor1.MajorRadius() > aTor1.MinorRadius();
+ if (typs1 == typs2) {
+ const gp_Torus aTor2 = aGeomSurf->Torus();
+ bToCheck = aTor2.MajorRadius() > aTor2.MinorRadius();
+ }
+ //
+ if (aCTType == GeomAbs_Torus) {
+ aCTAx = aTor1.Axis();
}
- aCTAx = aCTSurf->Torus().Axis();
}
//
if (bToCheck) {
case GeomAbs_Plane: {
aGeomAx = aGeomSurf->Plane().Axis();
if (aCTType == GeomAbs_Cone) {
- bImp = 1;
+ bGeomGeom = 1;
if (Abs(aCTSurf->Cone().SemiAngle()) < 0.02) {
Standard_Real ps = Abs(aCTAx.Direction().Dot(aGeomAx.Direction()));
if(ps < 0.015) {
- bImp = 0;
+ bGeomGeom = 0;
}
}
}
if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) ||
(aCTAx.IsNormal(aGeomAx, Precision::Angular()) &&
(aGeomSurf->Plane().Distance(aCTAx.Location()) < Precision::Confusion()))) {
- bImp = 1;
+ bGeomGeom = 1;
}
}
bToCheck = Standard_False;
}
case GeomAbs_Sphere: {
if (aL1.Distance(aGeomSurf->Sphere().Location()) < Precision::Confusion()) {
- bImp = 1;
+ bGeomGeom = 1;
}
bToCheck = Standard_False;
break;
if (bToCheck) {
if (aCTAx.IsParallel(aGeomAx, Precision::Angular()) &&
(aL1.Distance(aGeomAx.Location()) <= Precision::Confusion())) {
- bImp = 1;
+ bGeomGeom = 1;
}
}
//
- if (aCTType == GeomAbs_Cone) {
- TreatAsBiParametric = (bImp == 0);
+ if (bGeomGeom == 1) {
+ TreatAsBiParametric = Standard_False;
}
}
}
case GeomAbs_Cylinder:
case GeomAbs_Sphere:
case GeomAbs_Cone: ts1 = 1; break;
- case GeomAbs_Torus: ts1 = bImp; break;
+ case GeomAbs_Torus: ts1 = bGeomGeom; break;
default: break;
}
case GeomAbs_Cylinder:
case GeomAbs_Sphere:
case GeomAbs_Cone: ts2 = 1; break;
- case GeomAbs_Torus: ts2 = bImp; break;
+ case GeomAbs_Torus: ts2 = bGeomGeom; break;
default: break;
}
//
IntPatch_PrmPrmIntersection interpp;
interpp.Perform(S1,D1,S2,D2,U1,V1,U2,V2,TolArc,TolTang,myFleche,myUVMaxStep);
if (interpp.IsDone())
- {
+ {
done = Standard_True;
tgte = Standard_False;
empt = interpp.IsEmpty();
//void IntPatch_Intersection__MAJ_R(Handle_Adaptor2d_HCurve2d *R1,
-// Handle_Adaptor2d_HCurve2d *R2,
-// int *NR1,
-// int *NR2,
-// Standard_Integer nbR1,
-// Standard_Integer nbR2,
-// const IntPatch_Point& VTX)
+// Handle_Adaptor2d_HCurve2d *R2,
+// int *NR1,
+// int *NR2,
+// Standard_Integer nbR1,
+// Standard_Integer nbR2,
+// const IntPatch_Point& VTX)
void IntPatch_Intersection__MAJ_R(Handle_Adaptor2d_HCurve2d *,
- Handle_Adaptor2d_HCurve2d *,
- int *,
- int *,
- Standard_Integer ,
- Standard_Integer ,
- const IntPatch_Point& )
+ Handle_Adaptor2d_HCurve2d *,
+ int *,
+ int *,
+ Standard_Integer ,
+ Standard_Integer ,
+ const IntPatch_Point& )
{
/*
if(VTX.IsOnDomS1()) {
//-- long unsigned ptr= *((long unsigned *)(((Handle_Standard_Transient *)(&(VTX.ArcOnS1())))));
for(Standard_Integer i=0; i<nbR1;i++) {
if(VTX.ArcOnS1()==R1[i]) {
- NR1[i]++;
- printf("\n ******************************");
- return;
+ NR1[i]++;
+ printf("\n ******************************");
+ return;
}
}
printf("\n R Pas trouvee (IntPatch)\n");
//void IntPatch_Intersection::Dump(const Standard_Integer Mode,
void IntPatch_Intersection::Dump(const Standard_Integer ,
- const Handle(Adaptor3d_HSurface)& S1,
- const Handle(Adaptor3d_TopolTool)& D1,
- const Handle(Adaptor3d_HSurface)& S2,
- const Handle(Adaptor3d_TopolTool)& D2) const
+ const Handle(Adaptor3d_HSurface)& S1,
+ const Handle(Adaptor3d_TopolTool)& D1,
+ const Handle(Adaptor3d_HSurface)& S2,
+ const Handle(Adaptor3d_TopolTool)& D2) const
{
//-- ----------------------------------------------------------------------
else if(IType == IntPatch_Restriction) {
nbr++;
Handle(IntPatch_RLine)& rlin =
- *((Handle(IntPatch_RLine) *)&line);
+ *((Handle(IntPatch_RLine) *)&line);
if(rlin->IsArcOnS1()) nbr1++;
if(rlin->IsArcOnS2()) nbr2++;
}
else if(IType == IntPatch_Analytic) nba++;
- else { nbg++;
- if(IType == IntPatch_Lin) nbgl++;
- else if(IType == IntPatch_Circle) nbgc++;
- else if(IType == IntPatch_Parabola) nbgp++;
- else if(IType == IntPatch_Hyperbola) nbgh++;
- else if(IType == IntPatch_Ellipse) nbge++;
- }
+ else {
+ nbg++;
+ if(IType == IntPatch_Lin) nbgl++;
+ else if(IType == IntPatch_Circle) nbgc++;
+ else if(IType == IntPatch_Parabola) nbgp++;
+ else if(IType == IntPatch_Hyperbola) nbgh++;
+ else if(IType == IntPatch_Ellipse) nbge++;
+ }
}
printf("\nDUMP_INT:Lines:%2d Wlin:%2d Restr:%2d(On1:%2d On2:%2d) Ana:%2d Geom:%2d(L:%2d C:%2d E:%2d H:%2d P:%2d)",
- nbl,nbw,nbr,nbr1,nbr2,nba,nbg,nbgl,nbgc,nbge,nbgh,nbgp);
+ nbl,nbw,nbr,nbr1,nbr2,nba,nbg,nbgl,nbgc,nbge,nbgh,nbgp);
IntPatch_LineConstructor LineConstructor(2);
nbllc++;
const Handle(IntPatch_Line)& LineK = LineConstructor.Line(k);
if (LineK->ArcType() == IntPatch_Analytic) {
- Handle(IntPatch_ALine)& alin =
- *((Handle(IntPatch_ALine) *)&LineK);
- nbvtx=alin->NbVertex();
- nbva+=nbvtx; nba++;
- for(v=1;v<=nbvtx;v++) {
- IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,alin->Vertex(v));
- }
+ Handle(IntPatch_ALine)& alin =
+ *((Handle(IntPatch_ALine) *)&LineK);
+ nbvtx=alin->NbVertex();
+ nbva+=nbvtx; nba++;
+ for(v=1;v<=nbvtx;v++) {
+ IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,alin->Vertex(v));
+ }
}
else if (LineK->ArcType() == IntPatch_Restriction) {
- Handle(IntPatch_RLine)& rlin =
- *((Handle(IntPatch_RLine) *)&LineK);
- nbvtx=rlin->NbVertex();
- nbvr+=nbvtx; nbr++;
- for(v=1;v<=nbvtx;v++) {
- IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,rlin->Vertex(v));
- }
+ Handle(IntPatch_RLine)& rlin =
+ *((Handle(IntPatch_RLine) *)&LineK);
+ nbvtx=rlin->NbVertex();
+ nbvr+=nbvtx; nbr++;
+ for(v=1;v<=nbvtx;v++) {
+ IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,rlin->Vertex(v));
+ }
}
else if (LineK->ArcType() == IntPatch_Walking) {
- Handle(IntPatch_WLine)& wlin =
- *((Handle(IntPatch_WLine) *)&LineK);
- nbvtx=wlin->NbVertex();
- nbvw+=nbvtx; nbw++;
- for(v=1;v<=nbvtx;v++) {
- IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,wlin->Vertex(v));
- }
+ Handle(IntPatch_WLine)& wlin =
+ *((Handle(IntPatch_WLine) *)&LineK);
+ nbvtx=wlin->NbVertex();
+ nbvw+=nbvtx; nbw++;
+ for(v=1;v<=nbvtx;v++) {
+ IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,wlin->Vertex(v));
+ }
}
else {
- Handle(IntPatch_GLine)& glin =
- *((Handle(IntPatch_GLine) *)&LineK);
- nbvtx=glin->NbVertex();
- nbvg+=nbvtx; nbg++;
- for(v=1;v<=nbvtx;v++) {
- IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,glin->Vertex(v));
- }
+ Handle(IntPatch_GLine)& glin =
+ *((Handle(IntPatch_GLine) *)&LineK);
+ nbvtx=glin->NbVertex();
+ nbvg+=nbvtx; nbg++;
+ for(v=1;v<=nbvtx;v++) {
+ IntPatch_Intersection__MAJ_R(R1,R2,NR1,NR2,nbR1,nbR2,glin->Vertex(v));
+ }
}
}
}
printf("\nDUMP_LC :Lines:%2d WLin:%2d Restr:%2d Ana:%2d Geom:%2d",
- nbllc,nbw,nbr,nba,nbg);
+ nbllc,nbw,nbr,nba,nbg);
printf("\nDUMP_LC :vtx :%2d r:%2d :%2d :%2d",
- nbvw,nbvr,nbva,nbvg);
+ nbvw,nbvr,nbva,nbvg);