0025624: Visualization - selection is incorrect in perspective mode in a specific...
[occt.git] / tests / bugs / vis / bug25265
1 puts "============"
2 puts "OCC25265"
3 puts "============"
4 puts ""
5 ####################################################################################
6 # Perspective projection - selecting front point of two.
7 # When trying to select front point of two (lying on Z-coordinate) in a perspective
8 # view, the back one is snapped and selected.
9 ####################################################################################
10
11 set select_x 204
12 set select_y 204
13
14 vinit View1
15 vsetdispmode 1
16 vcamera -persp
17
18 # Draw grid of points 7x7.
19 set j 0
20 for {set x 0} {$x<7} {incr x} {
21   for {set y 0} {$y<7} {incr y} {
22     vpoint $j $x $y 10
23     incr j
24   }
25 }
26   for {set x 0} {$x<7} {incr x} {
27   for {set y 0} {$y<7} {incr y} {
28     vpoint $j $x $y 0
29     incr j
30   }
31 }
32
33 # Prepare view.
34 vtop
35 vfit
36
37 vselect $select_x $select_y
38
39 set stat 0
40 set result [vstate]
41 set newlist {}
42 set ref_selected {24}
43 set asplit [split $result "\n"]
44 for {set i 0} {$i < [llength $ref_selected]} {incr i} {
45   lappend newlist [lindex [lindex $asplit $i] 0]
46 }
47 set newsorted [lsort $newlist]
48 set refsorted [lsort $ref_selected]
49 for {set i 0} {$i < [llength $refsorted]} {incr i} {
50   if {[lindex $refsorted $i] != [lindex $newsorted $i]} {
51     set stat 1
52     break
53   }
54 }
55
56 if {$stat == 1} {
57     puts "Error : Perspective selection is broken."
58 }
59
60 # Dump view.
61 set scale 48.20
62 set up_x  -0.09
63 set up_y   0.94
64 set up_z  -0.33
65 set at_x   3.03
66 set at_y   2.70
67 set at_z   5.10
68 set eye_x 16.40
69 set eye_y 10.98
70 set eye_z 24.59
71
72 vviewparams -scale $scale -up $up_x $up_y $up_z -at $at_x $at_y $at_z -eye $eye_x $eye_y $eye_z
73
74 set only_screen 1