Adjusting test cases at current state of OCCT master
[occt.git] / tests / bugs / mesh / bug26532
CommitLineData
127cc1f0 1puts "========"
2puts "OCC26532"
3puts "========"
4puts ""
5#######################################################################
6# Meshing of edge with minSize parameter leads to incorrect result
7#######################################################################
8
97d87ffa 9proc xyzList {List N A B} {
10 set ResultList {}
11 for {set i 1} {$i <= $N} {incr i} {
12 set tmpList {}
13 set x [lindex $List [expr ($A + 0 + $B*$i) ]]
14 set y [lindex $List [expr ($A + 1 + $B*$i) ]]
15 set z [lindex $List [expr ($A + 2 + $B*$i) ]]
16 #puts "i=$i x=$x y=$y z=$z"
17 lappend tmpList $x
18 lappend tmpList $y
19 lappend tmpList $z
20 lappend ResultList $tmpList
21 }
22 return $ResultList
23}
24
127cc1f0 25restore [locate_data_file bug26533_aal2.brep] a
26
27vinit
28vdisplay a
29vfit
30vdump ${imagedir}/${casename}_1.png
31
97d87ffa 32# 1
127cc1f0 33# with min size
34# => ugly curve
35vclear
36incmesh a 0.3 -min 0.06
37vdisplay a
38vdump ${imagedir}/${casename}_2.png
39
97d87ffa 40set log1 [dump a]
41
42regexp {Polygon3D with +([-0-9.+eE]+)} $log1 full Nodes1
43
44set Index1 [lsearch -exact $log1 "Polygon3D"]
45set Index1 [expr ($Index1 + 8)]
46set B 5
47
48set RL1 [xyzList $log1 $Nodes1 $Index1 $B]
49set Length1 [llength $RL1]
50
51# 2
127cc1f0 52# without min size
53# => nice curve
97d87ffa 54restore [locate_data_file bug26533_aal2.brep] a2
55vdisplay a2
127cc1f0 56vclear
97d87ffa 57incmesh a2 0.3
58vdisplay a2
127cc1f0 59vdump ${imagedir}/${casename}_3.png
97d87ffa 60
61set log2 [dump a2]
62
63regexp {Polygon3D with +([-0-9.+eE]+)} $log2 full Nodes2
64
65set Index2 [lsearch -exact $log2 "Polygon3D"]
66set Index2 [expr ($Index2 + 8)]
67
68set RL2 [xyzList $log2 $Nodes2 $Index2 $B]
69set Length2 [llength $RL2]
70
71# 3. Compare coordinates of Polygon3Dare
72
73set Tolerance 1.0e-07
74
75if {$Length1 != $Length2} {
76 puts "Error: Numbers of nodes are not equal"
77} else {
78 puts "OK: Numbers of nodes are equal"
79 set xyzBad 0
80 for {set i 0} {$i < $Length1} {incr i} {
81 set tmpList1 [lindex $RL1 $i]
82 set x1 [lindex $tmpList1 0]
83 set y1 [lindex $tmpList1 1]
84 set z1 [lindex $tmpList1 2]
85 #puts "x1=$x1 y1=$y1 z1=$z1"
86
87 set tmpList2 [lindex $RL2 $i]
88 set x2 [lindex $tmpList2 0]
89 set y2 [lindex $tmpList2 1]
90 set z2 [lindex $tmpList2 2]
91 #puts "x2=$x2 y2=$y2 z2=$z2"
92
93 set xBad 0
94 set yBad 0
95 set zBad 0
96
97 if { [expr abs($x1 - $x2)] > $Tolerance } {
98 set xBad 1
99 }
100 if { [expr abs($y1 - $y2)] > $Tolerance } {
101 set yBad 1
102 }
103 if { [expr abs($z1 - $z2)] > $Tolerance } {
104 set zBad 1
105 }
106 if { $xBad !=0 && $yBad !=0 && $zBad !=0 } {
107 set xyzBad 1
108 set j [expr ($i + 1)]
109 puts "Following coordinates are not equal:"
110 puts "i=$j x1=$x1 y1=$y1 z1=$z1"
111 puts "i=$j x2=$x2 y2=$y2 z2=$z2"
112 break
113 }
114
115 }
116 if { $xyzBad !=0 } {
117 puts "Error: Coordinates of Polygon3Dare are not equal"
118 } else {
119 puts "OK: Coordinates of Polygon3Dare are equal"
120 }
121}