blob: add322b46dc22598ed94952947202703f9facadc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <gio.h>
include <gki.h>
include "gtr.h"
# GRC_SCRTONDC -- Coordinate transformation from screen coordinates to NDC
# coordinates. Screen coordinates physically address the device screen and
# range from 0 to 1 in either axis. NDC coordinates also range from 0 to 1
# in either axis but differ from screen coordinates when the workstation
# transformation is non unitary. The workstation transformation parameters
# are cached in the GTR common. We assume that GTR_INIT has already been
# called to initialize the common for a graphics stream.
procedure grc_scrtondc (sx, sy, mx, my)
real sx, sy # screen coordinates (input)
real mx, my # NDC coordinates (output)
include "gtr.com"
begin
if (wstranset == YES) {
mx = ((sx * GKI_MAXNDC - xorigin) / xscale + mx1) / GKI_MAXNDC
my = ((sy * GKI_MAXNDC - yorigin) / yscale + my1) / GKI_MAXNDC
} else {
mx = sx
my = sy
}
end
# GRC_NDCTOSCR -- Coordinate transformation from NDC coordinates to screen
# coordinates.
procedure grc_ndctoscr (mx, my, sx, sy)
real mx, my # NDC coordinates (input)
real sx, sy # screen coordinates (output)
include "gtr.com"
begin
if (wstranset == YES) {
sx = ((mx * GKI_MAXNDC - mx1) * xscale + xorigin) / GKI_MAXNDC
sy = ((my * GKI_MAXNDC - my1) * yscale + yorigin) / GKI_MAXNDC
} else {
sx = mx
sy = my
}
end
|