0025952: Wrong intersection curve
[occt.git] / tests / lowalgos / intss / bug27190
1 puts "================"
2 puts "OCC27190"
3 puts "================"
4 puts ""
5 #######################################################################
6 # IntPatch_ImpPrmIntersection algorithm does not split intersection curve by the seam-edge of the quadric
7 #######################################################################
8
9 set MaxTol 1.e-3
10 set GoodNbCurv 11
11
12 restore [locate_data_file bug27167_pipe.brep] a1
13 pcylinder a2 100 300
14
15 explode a1 f
16 explode a2 f
17
18 set log [bopcurves a1_2 a2_1 -2d]
19
20 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
21
22 if {${Toler} > ${MaxTol}} {
23   puts "Error: Tolerance is too big!"
24 }
25
26 if {${NbCurv} != ${GoodNbCurv}} {
27   puts "Error: Curve Number is bad!"
28 }
29
30 set Period [dval 2*pi]
31
32 for {set i 1} {$i <= ${NbCurv}} {incr i} {
33   bounds c2d2_$i u1 u2
34   
35   2dcvalue c2d2_$i u1 x1 y
36   2dcvalue c2d2_$i u2 x2 y
37   
38   set X1 [dval x1/$Period]
39   set X2 [dval x2/$Period]
40   
41   # Example: x1 = 5.3*pi, x2 = 12.8*pi ==> [x1, x2] intersects seam
42   if { [expr abs($X1 - $X2) > 1.0] } {
43     puts "Error: c2d2_$i intersects seam (0.0 or $Period): x1=[dval x1], x2=[dval x2]"
44     continue;
45   }
46
47   set iX1 [expr floor($X1)]
48   set iX2 [expr floor($X2)]
49   
50   # Examples:
51   #   1. x1 = 5*pi/2, x2 = 3*pi ==> [x1, x2] does not intersect seam and
52   #     ($iX1 == $iX2 == 0). I.e. if ($iX1 == $iX2) then seam is not intersected.
53   #   2. x1 = 3*pi, x2 = 5*pi ==> [x1, x2] intersects seam and
54   #     ($iX1 == 1, $iX2 == 2) ==> ($iX1 != $iX2).
55   #   3. x1 = pi/4, x2 = 2*pi ==> [x1, x2] does not intersect seam and
56   #     ($iX1 == 0, $iX2 == 1) ==> ($iX1 != $iX2) and ($X2 == $iX2 = 1)
57   if { ($iX1 != $iX2) && ($X2 != $iX2) } {
58     puts "Error: c2d2_$i intersects seam (0.0 or $Period): x1=[dval x1], x2=[dval x2]"
59   }
60 }
61
62 smallview
63 don c_*
64 fit
65
66 checkview -screenshot -2d -path ${imagedir}/${test_image}.png