0027015: Sewing returns invalid shape if some faces are nearly plane cones
[occt.git] / tests / bugs / modalg_6 / bug27190
CommitLineData
a09c8f3a 1puts "================"
2puts "OCC27190"
3puts "================"
4puts ""
5#######################################################################
6# IntPatch_ImpPrmIntersection algorithm does not split intersection curve by the seam-edge of the quadric
7#######################################################################
8
9set MaxTol 1.e-3
10set GoodNbCurv 11
11
fd0add65 12restore [locate_data_file bug27167_pipe.brep] a1
a09c8f3a 13pcylinder a2 100 300
14
15explode a1 f
16explode a2 f
17
18set log [bopcurves a1_2 a2_1 -2d]
19
20regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
21
22if {${Toler} > ${MaxTol}} {
23 puts "Error: Tolerance is too big!"
24}
25
26if {${NbCurv} != ${GoodNbCurv}} {
27 puts "Error: Curve Number is bad!"
28}
29
30set Period [dval 2*pi]
31
32for {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
62smallview
63don c_*
64fit
65
66checkview -screenshot -2d -path ${imagedir}/${test_image}.png