0025687: Visualization, XCAF - eliminate visual artifacts at the edges of faces
[occt.git] / tests / bugs / vis / bug24389
1 puts "============"
2 puts "CR24389"
3 puts "============"
4 puts ""
5 #######################################################################
6 #  Invalid hilight of AIS dimension line in local selection
7 #######################################################################
8
9 # ----------------------------------------------#
10 #  Check highlight of length dimension elements #
11 # ----------------------------------------------#
12
13 vinit View1
14 vtop
15
16 set anImage1 $imagedir/${casename}_1.png
17 set anImage2 $imagedir/${casename}_2.png
18 set anImage3 $imagedir/${casename}_3.png
19
20 # length
21
22 vpoint len_p1  0 0 0
23 vpoint len_p2 40 0 0
24 verase len_p1 len_p2
25
26 vdimension len1 -length -text 3d -plane xoy -flyout 20 -arrow external -label left -shapes len_p1 len_p2
27 vdimension len2 -length -text 3d -plane xoy -flyout -20 -arrow external -label right -shapes len_p1 len_p2
28
29 vpoint len_p3  0 20 0
30 vpoint len_p4 40 20 0
31 verase len_p3 len_p4
32
33 vdimension len3 -length -text 3d -plane xoy -flyout 20 -arrow internal -label hcenter -shapes len_p3 len_p4
34
35 # diameter
36
37 vpoint diam_p1  90 0   0
38 vpoint diam_p2 120 0   0
39 vpoint diam_p3 105 -15 0
40 verase diam_p1 diam_p2 diam_p3
41 vcircle diam_c1 diam_p1 diam_p2 diam_p3 0
42 vdimension diam1 -diameter -text 3d -plane xoy -arrow external -label left -shapes diam_c1
43
44 vpoint diam_p4  90 40 0
45 vpoint diam_p5 120 40 0
46 vpoint diam_p6 105 25 0
47 verase diam_p4 diam_p5 diam_p6
48 vcircle diam_c2 diam_p4 diam_p5 diam_p6 0
49 vdimension diam2 -diameter -text 3d -plane xoy -arrow external -label right -shapes diam_c2
50
51 vpoint diam_p7  80 -40 0
52 vpoint diam_p8 120 -40 0
53 vpoint diam_p9 100 -60 0
54 verase diam_p7 diam_p8 diam_p9
55 vcircle diam_c3 diam_p7 diam_p8 diam_p9 0
56 vdimension diam3 -diameter -text 3d -plane xoy -arrow external -label hcenter -flyout 30 -shapes diam_c3
57
58 # radius
59
60 vpoint rad_p1 140  -5 0
61 vpoint rad_p2 180 -45 0
62 vpoint rad_p3 220  -5 0
63 verase rad_p1 rad_p2 rad_p3
64 vcircle rad_c1 rad_p1 rad_p2 rad_p3 0
65 vdimension rad1 -radius -text 3d -plane xoy -arrow internal -label hcenter -flyout 0 -shapes rad_c1
66
67 vpoint rad_p4 180 -70 0
68 vpoint rad_p5 160 -90 0
69 vpoint rad_p6 140 -70 0
70 verase rad_p4 rad_p5 rad_p6
71 vcircle rad_c2 rad_p4 rad_p5 rad_p6 0
72 vdimension rad2 -radius -text 3d -plane xoy -arrow external -label left -shapes rad_c2
73
74 # angles
75
76 vpoint ang_p1 0  -50 0
77 vpoint ang_p2 25 -75 0
78 vpoint ang_p3 0  -100 0
79 verase ang_p1 ang_p2 ang_p3
80 vdimension ang1 -angle -text 3d -plane xoy -arrow internal -label hcenter -flyout 35 -shapes ang_p1 ang_p2 ang_p3
81
82 vpoint ang_p4   0 -120 0
83 vpoint ang_p5  30 -80  0
84 vpoint ang_p6  30 -120 0
85 verase ang_p4 ang_p5 ang_p6
86 vdimension ang2 -angle -text 3d -plane xoy -arrow external -label left -flyout 55 -shapes ang_p4 ang_p5 ang_p6
87
88 vpoint ang_p8  55 -120 0
89 vpoint ang_p9  55 -80  0
90 vpoint ang_p10 95 -120 0
91 verase ang_p8 ang_p9 ang_p10
92 vdimension ang3 -angle -text 3d -plane xoy -arrow external -label right -flyout 55 -shapes ang_p8 ang_p9 ang_p10
93
94 vpoint fit1 -75 0 0
95 vpoint fit2 235 0 0
96 vfit
97
98 # ----------------------------------------------------------------------------- #
99 #               Verify picking in neutral and local selections                  #
100 # ----------------------------------------------------------------------------- #
101
102 proc check_picking { pick check name } {
103   for {set i 0} {$i < [llength $pick]} {incr i} {
104   
105     set pick_x [lindex [lindex $pick $i] 0]
106     set pick_y [lindex [lindex $pick $i] 1]
107     set check_x [lindex $check 0]
108     set check_y [lindex $check 1]
109     
110     vmoveto $pick_x $pick_y
111     set res [checkcolor $check_x $check_y 0 1 1]
112     
113     if { $res != 1 } {
114       puts "Error : Highlighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
115     }
116   }
117 }
118
119 proc check_cross_picking { pick object name } {
120
121   vselmode 0 1
122
123   for {set i 1} {$i < 3} {incr i} {
124     
125     vselmode $object $i 1
126
127     for {set j 1} {$j < 3} {incr j} {
128
129       set pick_idx_i [expr "[llength $pick] - 2 + $i - 1"]
130       set pick_idx_j [expr "[llength $pick] - 2 + $j - 1"]
131
132       set pick_x [lindex [lindex $pick $pick_idx_i] 0]
133       set pick_y [lindex [lindex $pick $pick_idx_i] 1]
134       set check_x [lindex [lindex $pick $pick_idx_j] 0]
135       set check_y [lindex [lindex $pick $pick_idx_j] 1]
136       
137       vmoveto $pick_x $pick_y
138       
139       if {$i == $j} {
140         set res [checkcolor $check_x $check_y 0 1 1]
141         if { $res != 1 } {
142           puts "Error : No local hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
143         }
144       } else {
145         set res [checkcolor $check_x $check_y 0 0 0]
146         if { $res != 1 } {
147           puts "Error : Unwanted hilighting of $name at pick coordinates ($pick_x, $pick_y) check coordinates ($check_x, $check_y)"
148         }
149       }
150     }
151     vselmode $object $i 0
152   }
153   vselmode 0 1
154 }
155
156 # pick coord { [flyout], dimension line, text }
157
158 # check sensitives "len1"
159 set pick_coord { { 99 133 } { 106 124 } { 76 131 } }
160 set check_coord { 125 124 }
161 check_picking $pick_coord $check_coord "length dimension (len1)"
162 check_cross_picking $pick_coord len1 "length dimension (len1)"
163
164 # check sensitives "len2"
165 set pick_coord { { 99 167 } { 127 176 } { 185 183 } }
166 set check_coord { 112 176 }
167 check_picking $pick_coord $check_coord "length dimension (len2)"
168 check_cross_picking $pick_coord len2 "length dimension (len2)"
169
170 # check sensitives "len3"
171 set pick_coord { { 99 114 } { 110 98 } { 131 105 } }
172 set check_coord { 152 109 }
173 check_picking $pick_coord $check_coord "length dimension (len3)"
174 check_cross_picking $pick_coord len3 "length dimension (len3)"
175
176 # check sensitives "diam1"
177 set pick_coord { { 247 150 } { 194 157 } }
178 set check_coord { 236 150 }
179 check_picking $pick_coord $check_coord "diameter dimension (diam1)"
180 check_cross_picking $pick_coord diam1 "diameter dimension (diam1)"
181
182 # check sensitives "diam2"
183 set pick_coord { { 221 98 } { 305 105 } }
184 set check_coord { 238 98 }
185 check_picking $pick_coord $check_coord "diameter dimension (diam2)"
186 check_cross_picking $pick_coord diam2 "diameter dimension (diam2)"
187
188 # check sensitives "diam3"
189 set pick_coord { { 204 225 } { 268 242 } { 243 249 } }
190 set check_coord { 204 233 }
191 check_picking $pick_coord $check_coord "diameter dimension (diam3)"
192 check_cross_picking $pick_coord diam3 "diameter dimension (diam3)"
193
194 # check sensitives "rad1"
195 set pick_coord { { 287 157 } { 326 165 } }
196 set check_coord { 287 157 }
197 check_picking $pick_coord $check_coord "radius dimension (rad1)"
198 check_cross_picking $pick_coord rad1 "radius dimension (rad1)"
199
200 # check sensitives "rad2"
201 set pick_coord { { 320 242 } { 383 249 } }
202 set check_coord { 340 242 }
203 check_picking $pick_coord $check_coord "radius dimension (rad2)"
204 check_cross_picking $pick_coord rad2 "radius dimension (rad2)"
205
206 # check sensitives "ang1"
207 set pick_coord { { 112 268 } { 96 220 } { 80 250 } }
208 set check_coord { 96 220 }
209 check_picking $pick_coord $check_coord "angle dimension (ang1)"
210 check_cross_picking $pick_coord ang1 "angle dimension (ang1)"
211
212 # check sensitives "ang2"
213 set pick_coord { { 139 301 } { 152 327 } { 65 297 } }
214 set check_coord { 108 320 }
215 check_picking $pick_coord $check_coord "angle dimension (ang2)"
216 check_cross_picking $pick_coord ang2 "angle dimension (ang2)"
217
218 # check sensitives "ang3"
219 set pick_coord { { 171 304 } { 199 321 } { 252 285 } }
220 set check_coord { 191 324 }
221 check_picking $pick_coord $check_coord "angle dimension (ang3)"
222 check_cross_picking $pick_coord ang3 "angle dimension (ang3)"
223
224 # --------------------------------------------------- #
225 #               Dump selected images                  #
226 # --------------------------------------------------- #
227
228 set xmin -500
229 set xmax  500
230 set ymin -500
231 set ymax  500
232 set shift 0
233
234 vselmode 0 1
235 vselect $xmin $ymin $xmax $ymax $shift
236 vdump $anImage1
237
238 vselect 0 0 0 0 0
239 vselmode 1 1
240 vselect $xmin $ymin $xmax $ymax $shift
241 vdump $anImage2
242
243 vselect 0 0 0 0 0
244 vselmode 0 1
245 vselmode 2 1
246 vselect $xmin $ymin $xmax $ymax $shift
247 vdump $anImage3