0027986: Visualization - AIS_InteractiveContext::SetLocation() does not update dynami...
[occt.git] / tests / bugs / vis / bug25671
CommitLineData
f25b82d6 1puts "============"
2puts "CR25671"
3puts "============"
4puts ""
5#######################################################################
6# V3d_View::Convert doesn't work as expected in GRID active mode.
7#######################################################################
8pload VISUALIZATION
9vinit View1 w=400 h=400
10
11# 1. Synthetic case for detection with AIS_InteractiveContext::MoveTo
12set detect_x 197
13set detect_y 229
14
15set cylinder_r 5
16set cylinder_h 10
17set cylinder_xyz {100 0 0}
18
19vgrid c p -10 0 5 5 45
20pcylinder c $cylinder_r $cylinder_h
21ttranslate c {*}$cylinder_xyz
22vdisplay c
23vfit
24vmoveto $detect_x $detect_y
25checkcolor $detect_x $detect_y 0 1 1
26
27if { $stat != 1 } {
28 puts "Error : Detection does not work correctly with activated grid."
29}
30
31vgrid off
32vremove -all
33
34# 2.1 Quick test of coordinate conversion commands
35set view_scale 2.5
36set view_proj {0 1 0}
37set view_up {0 0 1}
38set view_eye {0.5 100.5 0.5}
39set view_at {0.5 0.5 0.5}
40set view_znear 0
41set view_zfar 150
42
43vviewparams -scale $view_scale -eye {*}$view_eye -at {*}$view_at -proj {*}$view_proj -up {*}$view_up
44vzrange $view_znear $view_zfar
45
46set vconvert_1_view [vconvert 1.0 view]
47set vconvert_1_win [vconvert 1.0 window]
48set vconvert_00_00_win [vconvert 0.0 0.0 window]
49set vconvert_200_200_view [vconvert 200 200 view]
50set vconvert_05_05_ray [vconvert 0.5 0.5 ray]
51set vconvert_200_200_model [vconvert 200 200]
52set vconvert_05_100_05_win [vconvert 0.5 100 0.5 window]
53
54checkreal "vconvert 1.0 view, view 1" [lindex $vconvert_1_view 2] 1.0 1e-7 0.0
55checkreal "vconvert 1.0 window, view 1" [lindex $vconvert_1_win 2] 1.0 1e-7 0.0
56checkreal "vconvert 0.0 0.0 window, view 1, Xp" [lindex $vconvert_00_00_win 2] 200.0 1.0 0.0
57checkreal "vconvert 0.0 0.0 window, view 1, Yp" [lindex $vconvert_00_00_win 3] 200.0 1.0 0.0
58checkreal "vconvert 200 200 view, view 1, Xv" [lindex $vconvert_200_200_view 2] 0.0 1e-7 0.0
59checkreal "vconvert 200 200 view, view 1, Yv" [lindex $vconvert_200_200_view 3] 0.0 1e-7 0.0
60checkreal "vconvert 0.5 0.5 ray, view 1, DX" [lindex $vconvert_05_05_ray 2] 0.0 1e-7 0.0
61checkreal "vconvert 0.5 0.5 ray, view 1, DY" [lindex $vconvert_05_05_ray 3] -1.0 1e-7 0.0
62checkreal "vconvert 0.5 0.5 ray, view 1, DZ" [lindex $vconvert_05_05_ray 4] 0.0 1e-7 0.0
63checkreal "vconvert 200 200, view 1, X" [lindex $vconvert_200_200_model 2] 0.5 1.0 0.0
64checkreal "vconvert 200 200, view 1, Y" [lindex $vconvert_200_200_model 3] 100.5 1.0 0.0
65checkreal "vconvert 200 200, view 1, Z" [lindex $vconvert_200_200_model 4] -0.5 1.0 0.0
66checkreal "vconvert 0.5 100 0.5 window, view 1, Xp" [lindex $vconvert_05_100_05_win 2] 200.0 1.0 0.0
67checkreal "vconvert 0.5 100 0.5 window, view 1, Yp" [lindex $vconvert_05_100_05_win 3] 199.0 1.0 0.0
68
69# 2.2 Quick test of coordinate conversion commands
70vgrid r 10 10 1 1 45
71
72set view_scale 49.504950495049506
73set view_proj {0 0 1}
74set view_up {0 1 0}
75set view_eye {25 5 125}
76set view_at {25 5 45}
77set view_znear 0
78set view_zfar 150
79
80vviewparams -scale $view_scale -eye {*}$view_eye -at {*}$view_at -proj {*}$view_proj -up {*}$view_up
c357e426 81vautozfit 0
f25b82d6 82vzrange $view_znear $view_zfar
83
84set vconvert_1_view [vconvert 1.0 view]
85set vconvert_1_win [vconvert 1.0 window]
86set vconvert_00_00_win [vconvert 0.0 0.0 window]
87set vconvert_200_200_view [vconvert 200 200 view]
88set vconvert_05_05_ray [vconvert 0.5 0.5 ray]
89set vconvert_200_200_model [vconvert 200 200]
90set vconvert_200_200_grid [vconvert 200 200 grid]
91set vconvert_25_5_35_win [vconvert 25.0 4.94 35.0 window]
92set vconvert_25_5_35_grid [vconvert 25.0 4.94 35.0 grid]
93
94checkreal "vconvert 1.0 view, view 2" [lindex $vconvert_1_view 2] 0.05 0.05 0.0
95checkreal "vconvert 1.0 window, view 2" [lindex $vconvert_1_win 2] 19.0 0.05 0.0
96checkreal "vconvert 0.0 0.0 window, view 2, Xp" [lindex $vconvert_00_00_win 2] 200.0 1.0 0.0
97checkreal "vconvert 0.0 0.0 window, view 2, Yp" [lindex $vconvert_00_00_win 3] 200.0 1.0 0.0
98checkreal "vconvert 200 200 view, view 2, Xv" [lindex $vconvert_200_200_view 2] 0.0 1e-7 0.0
99checkreal "vconvert 200 200 view, view 2, Yv" [lindex $vconvert_200_200_view 3] 0.0 1e-7 0.0
100checkreal "vconvert 0.5 0.5 ray, view 2, DX" [lindex $vconvert_05_05_ray 2] 0.0 1e-7 0.0
101checkreal "vconvert 0.5 0.5 ray, view 2, DY" [lindex $vconvert_05_05_ray 3] 0.0 1e-7 0.0
102checkreal "vconvert 0.5 0.5 ray, view 2, DZ" [lindex $vconvert_05_05_ray 4] -1.0 1e-7 0.0
103checkreal "vconvert 200 200, view 2, X" [lindex $vconvert_200_200_model 2] 25.0 0.05 0.0
104checkreal "vconvert 200 200, view 2, Y" [lindex $vconvert_200_200_model 3] 4.95 0.05 0.0
105checkreal "vconvert 200 200, view 2, Z" [lindex $vconvert_200_200_model 4] 125.0 0.05 0.0
106checkreal "vconvert 200 200 grid, view 2, X" [lindex $vconvert_200_200_grid 2] 25.486 0.05 0.0
107checkreal "vconvert 200 200 grid, view 2, Y" [lindex $vconvert_200_200_grid 3] 4.856 0.05 0.0
108checkreal "vconvert 200 200 grid, view 2, Z" [lindex $vconvert_200_200_grid 4] 0.0 0.05 0.0
109checkreal "vconvert 0.5 100 0.5 window, view 2, Xp" [lindex $vconvert_25_5_35_win 2] 200.0 1.0 0.0
110checkreal "vconvert 0.5 100 0.5 window, view 2, Yp" [lindex $vconvert_25_5_35_win 3] 200.0 1.0 0.0
111checkreal "vconvert 25 4.94 35 grid, view 2, X" [lindex $vconvert_25_5_35_grid 2] 25.486 0.05 0.0
112checkreal "vconvert 25 4.94 35 grid, view 2, Y" [lindex $vconvert_25_5_35_grid 3] 4.856 0.05 0.0
113checkreal "vconvert 25 4.94 35 grid, view 2, Z" [lindex $vconvert_25_5_35_grid 4] 0.0 0.05 0.0
114
115# do not save any image
5747059b 116checkview -screenshot -3d -path ${imagedir}/${test_image}.png