1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-13 14:27:08 +03:00

Compare commits

...

3 Commits

Author SHA1 Message Date
akaftasev
5d3ddec35d 0033639: Modeling Algorithms - Boolean torus cut cone failed
Avoid adding an apex of cone as singular pole, which is lying on torus surface
2024-06-06 14:45:35 +01:00
akaftasev
c726439750 0033541: Modeling Algorithms - Simple sphere cut from cylinder fails
Changed condition for combination of WLines into one.
WLine would be excluded from consideration for merging, if one of its middle points between vertices is out of domain (does not lie on both surfaces).
2024-05-20 16:22:09 +01:00
akaftasev
08cecf39d5 0033615: Modeling Algorithms - Partition algorithm creates unexpected vertices
This problem occurs because of obtaining 2 ALines which share same vertex on the seam edge.
There should be 2 different vertices with same(or almost the same) 3d parameters, but
with different UV parameters because of periodic surface.
Current fix allows to avoid the same vertices on seam edge and also checks the next vertex.
Added consideration of predicted next point to avoid skipping tha point which is not on seam edge.
Added test case for #33702
2024-05-20 11:37:08 +01:00
10 changed files with 112 additions and 7 deletions

View File

@@ -647,6 +647,26 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
{// Strictly equal!!!
break;
}
else if (aParameter + aStep < theLPar)
{
// Prediction of the next point
gp_Pnt aPnt3dNext;
gp_Vec aTg;
theALine->D1(aParameter + aStep, aPnt3dNext, aTg);
Standard_Real anU1 = 0.0, aV1 = 0.0, anU2 = 0.0, aV2 = 0.0;
myQuad1.Parameters(aPnt3dNext, anU1, aV1);
myQuad2.Parameters(aPnt3dNext, anU2, aV2);
IntSurf_PntOn2S aPOn2SNext;
aPOn2SNext.SetValue(aPnt3dNext, anU1, aV1, anU2, aV2);
if (aPOn2SNext.ValueOnSurface(0).SquareDistance(aRPT.ValueOnSurface(0)) > M_PI * M_PI ||
aPOn2SNext.ValueOnSurface(1).SquareDistance(aRPT.ValueOnSurface(1)) > M_PI * M_PI)
{
aPrevLPoint = aRPT;
aPrevParam = aParameter;
continue;
}
}
}
aPrePointExist = IntPatch_SPntNone;

View File

@@ -827,6 +827,16 @@ Standard_Boolean IntPatch_SpecialPoints::
return Standard_False;
}
if (theQSurf->GetType() == GeomAbs_Cone && thePSurf->GetType() == GeomAbs_Torus)
{
const gp_Pnt anApex = theQSurf->Cone().Apex();
Standard_Real aSqDist = anApex.SquareDistance(aPQuad);
if (aSqDist < aTol * aTol)
{
return Standard_False;
}
}
//Pole is an intersection point
//(lies in the quadric and the parametric surface)

View File

@@ -1728,7 +1728,6 @@ static Standard_Boolean IsNeedSkipWL(const Handle(IntPatch_WLine)& theWL,
{
Standard_Real aFirstp, aLastp;
Standard_Integer aNbVtx = theWL->NbVertex();
Standard_Boolean isNeedSkip = Standard_True;
for (Standard_Integer i = 1; i < aNbVtx; i++) {
aFirstp = theWL->Vertex (i).ParameterOnLine();
@@ -1739,14 +1738,13 @@ static Standard_Boolean IsNeedSkipWL(const Handle(IntPatch_WLine)& theWL,
const IntSurf_PntOn2S& aPmid = theWL->Point (pmid);
aPmid.Parameters (aU1, aV1, aU2, aV2);
if (!IsOutOfDomain (theBoxS1, theBoxS2, aPmid, theArrPeriods))
if (IsOutOfDomain (theBoxS1, theBoxS2, aPmid, theArrPeriods))
{
isNeedSkip = Standard_False;
break;
return Standard_True;
}
}
return isNeedSkip;
return Standard_False;
}
//=======================================================================

View File

@@ -0,0 +1,12 @@
puts "================================"
puts "0033541: Modeling Algorithms - Simple sphere cut from cylinder fails"
puts "================================"
puts ""
pcylinder c 1 1
psphere s 1
ttranslate s 1 1 1
bcut result c s
checknbshapes result -vertex 3 -edge 5 -wire 4 -face 4
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,22 @@
puts "================================"
puts "0033615: Modeling Algorithms - Partition algorithm creates unexpected vertices"
puts "================================"
puts ""
plane plane -5 0 4 -1 0 0
pcone cone plane 3 1 10
pcylinder cylinder 10 20
explode cylinder f
explode cone f
don cylinder_1 cone_1
axo;fit
bclearobjects
bcleartools
baddobjects cone_1
baddtools cylinder_1
bfillds
bbuild result
checknbshapes result -vertex 5 -edge 8 -wire 5 -face 4
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,15 @@
puts "================================"
puts " 0033639: Modeling Algorithms - Boolean torus cut cone incorrect"
puts "================================"
puts ""
ptorus t 750 250 360
pcone c 200 0 2000
trotate c 0 0 0 1 0 0 90
ttranslate c 0 1000 0
bcut result t c
checknbshapes result -vertex 8 -edge 13 -wire 5 -face 3
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,16 @@
puts "================================"
puts " 0033639: Modeling Algorithms - Boolean torus cut cone incorrect"
puts "================================"
puts ""
ptorus t 750 250 360
pcone c 500 0 2000
trotate c 0 0 0 1 0 0 90
ttranslate c 0 1000 0
trotate c 0 -1000 0 1 0 0 45
bcut result t c
checknbshapes result -vertex 4 -edge 7 -wire 3 -face 2
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
puts "================================"
puts "0033702: Modeling Algorithms - Regression: Intersection curve is not built between cone and cylinder"
puts "================================"
puts ""
restore [locate_data_file bug33702_ext.brep] ext
restore [locate_data_file bug33702_rev.brep] rev
bcut result ext rev
checknbshapes result -vertex 51 -edge 75 -wire 42 -face 30
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -17,7 +17,7 @@ fit
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} [bopcurves b1_5 b2_2 -2d] full Toler NbCurv
if { ${Toler} > 0.0004} {
if { ${Toler} > 0.002} {
puts "Error: bad tolerance of result"
}

View File

@@ -55,6 +55,6 @@ fit
checksection result -r 0
checkmaxtol result -min_tol 2.0e-7
checknbshapes result -edge 3 -vertex 3
checknbshapes result -edge 2 -vertex 2
checkview -screenshot -2d -path ${imagedir}/${test_image}.png