mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0021494: Intersection between cone and sphere fails
The condition (workaround), which forbid to return the intersection curve, has been removed.
This commit is contained in:
parent
32c408d76a
commit
9bc5f5850a
@ -601,26 +601,47 @@ Standard_Boolean IntCoSp(const IntSurf_Quadric& Quad1,
|
||||
|
||||
gp_Circ cirsol = inter.Circle(1);
|
||||
param = ElCLib::LineParameter(Co.Axis(),
|
||||
cirsol.Location());
|
||||
if (param >= paramapex) {
|
||||
|
||||
ElCLib::D1(0.,cirsol,ptref,Tgt);
|
||||
Standard_Real qwe = Tgt.DotCross(Quad2.Normale(ptref),
|
||||
Quad1.Normale(ptref));
|
||||
if(qwe> 0.000000001) {
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if(qwe< -0.000000001){
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else {
|
||||
trans1=trans2=IntSurf_Undecided;
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol,Standard_False,trans1,trans2);
|
||||
slin.Append(glig);
|
||||
cirsol.Location());
|
||||
ElCLib::D1(0., cirsol, ptref, Tgt);
|
||||
Standard_Real qwe = Tgt.DotCross(Quad2.Normale(ptref),
|
||||
Quad1.Normale(ptref));
|
||||
|
||||
if (param >= paramapex)
|
||||
{
|
||||
if (qwe > Precision::PConfusion())
|
||||
{
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if (qwe < -Precision::PConfusion())
|
||||
{
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
trans1 = trans2 = IntSurf_Undecided;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (qwe < -Precision::PConfusion())
|
||||
{
|
||||
trans1 = IntSurf_Out;
|
||||
trans2 = IntSurf_In;
|
||||
}
|
||||
else if (qwe > Precision::PConfusion())
|
||||
{
|
||||
trans1 = IntSurf_In;
|
||||
trans2 = IntSurf_Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
trans1 = trans2 = IntSurf_Undecided;
|
||||
}
|
||||
}
|
||||
Handle(IntPatch_GLine) glig = new IntPatch_GLine(cirsol, Standard_False, trans1, trans2);
|
||||
slin.Append(glig);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -28,3 +28,23 @@ proc CheckLoops {theCurve theCosMaxAngle {theNbPoints 1000.0}} {
|
||||
dset dz1 dz2
|
||||
}
|
||||
}
|
||||
|
||||
# General check of the result of geometrical intersection
|
||||
help CheckIntersectionResult { surf1 surf2 ListOfCurves NbPoints TolerS1 TolerS2 }
|
||||
proc CheckIntersectionResult {theSurf1 theSurf2 theListOfCurves theNbPoints theTolerS1 theTolerS2} {
|
||||
upvar #0 $theSurf1 s1
|
||||
upvar #0 $theSurf2 s2
|
||||
|
||||
foreach a $theListOfCurves {
|
||||
puts "** Check of $a **"
|
||||
upvar #0 $a aCurve
|
||||
bounds aCurve U1 U2
|
||||
|
||||
if {[dval U2-U1] < 1.0e-9} {
|
||||
puts "Error: Wrong range of $a"
|
||||
}
|
||||
|
||||
xdistcs aCurve s1 U1 U2 $theNbPoints $theTolerS1
|
||||
xdistcs aCurve s2 U1 U2 $theNbPoints $theTolerS2
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
puts "TODO OCC21494 ALL: Error: Intersection between cone and sphere fails"
|
||||
|
||||
puts "========"
|
||||
puts "OCC21494"
|
||||
puts "========"
|
||||
puts ""
|
||||
############################################
|
||||
# Intersection between cone and sphere fails
|
||||
############################################
|
||||
|
||||
pcone c 15 0 10
|
||||
psphere s 10
|
||||
explode c f
|
||||
explode s f
|
||||
mksurface sc c_1
|
||||
mksurface ss s_1
|
||||
|
||||
intersect i sc ss
|
||||
|
||||
if { [info exist i_1] == 0 } {
|
||||
puts "Error: Intersection between cone and sphere fails"
|
||||
}
|
32
tests/lowalgos/intss/bug21494_1
Normal file
32
tests/lowalgos/intss/bug21494_1
Normal file
@ -0,0 +1,32 @@
|
||||
puts "========"
|
||||
puts "OCC21494: Intersection between cone and sphere fails"
|
||||
puts "========"
|
||||
puts ""
|
||||
|
||||
pcone bc 15 0 10
|
||||
psphere bs 10
|
||||
explode bc f
|
||||
explode bs f
|
||||
|
||||
set log [bopcurves bc_1 bs_1 -2d]
|
||||
|
||||
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} $log full Toler NbCurv
|
||||
|
||||
if { ![regexp {1 point\(s\) found} $log full] } {
|
||||
puts "Error: Cone apex and Pole of sphere are excluded from the intersection result"
|
||||
}
|
||||
|
||||
if {$NbCurv != 1} {
|
||||
puts "Error: Please check NbCurves for intersector"
|
||||
}
|
||||
|
||||
if { $Toler > 2.0e-7} {
|
||||
puts "Error: Big tolerance value"
|
||||
}
|
||||
|
||||
smallview
|
||||
don c_* p_*
|
||||
fit
|
||||
disp bc bs
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}_3d.png
|
78
tests/lowalgos/intss/bug21494_2
Normal file
78
tests/lowalgos/intss/bug21494_2
Normal file
@ -0,0 +1,78 @@
|
||||
puts "========"
|
||||
puts "OCC21494"
|
||||
puts "========"
|
||||
puts ""
|
||||
############################################
|
||||
# Intersection between cone and sphere fails
|
||||
############################################
|
||||
|
||||
foreach a [directory res*] {unset $a}
|
||||
|
||||
set aGoodNbCurves 1
|
||||
|
||||
pcone c 15 0 10
|
||||
psphere s 10
|
||||
explode c f
|
||||
explode s f
|
||||
mksurface sc c_1
|
||||
mksurface ss s_1
|
||||
|
||||
intersect res sc ss
|
||||
|
||||
if { ![info exist res_p_1] } {
|
||||
puts "Error: Cone apex and Pole of sphere are excluded from the intersection result"
|
||||
}
|
||||
|
||||
set che [whatis res]
|
||||
set ind [string first "3d curve" $che]
|
||||
if {${ind} >= 0} {
|
||||
#Only variable "res" exists
|
||||
renamevar res res_1
|
||||
}
|
||||
|
||||
bclearobjects
|
||||
bcleartools
|
||||
|
||||
set CurvesList {}
|
||||
|
||||
set ic 1
|
||||
set AllowRepeat 1
|
||||
while { $AllowRepeat != 0 } {
|
||||
set che [whatis res_$ic]
|
||||
set ind [string first "3d curve" $che]
|
||||
if {${ind} < 0} {
|
||||
set AllowRepeat 0
|
||||
} else {
|
||||
lappend CurvesList res_$ic
|
||||
mkedge ee res_$ic
|
||||
baddobjects ee
|
||||
incr ic
|
||||
}
|
||||
}
|
||||
|
||||
set ic [expr $ic - 1]
|
||||
|
||||
if { $ic != $aGoodNbCurves } {
|
||||
puts "Error: $aGoodNbCurves curves is expected but $ic ones are found"
|
||||
} else {
|
||||
CheckIntersectionResult sc ss $CurvesList 100 2.0e-7 2.0e-7
|
||||
|
||||
if {$ic > 1} {
|
||||
bfillds
|
||||
bbuild result
|
||||
} elseif {$ic > 0} {
|
||||
mkedge result res_1
|
||||
}
|
||||
|
||||
# Check gaps between intersection curves
|
||||
checksection result -r 0
|
||||
checkmaxtol result -min_tol 2.0e-7
|
||||
|
||||
checknbshapes result -edge 1 -vertex 1
|
||||
}
|
||||
|
||||
smallview
|
||||
don result*
|
||||
fit
|
||||
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user