aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/glabax/glbverify.x
blob: 6666b06a68159f5c2c983ad850603686c332eb19 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<mach.h>
include	<gset.h>
include	<gio.h>
include	"glabax.h"

# GLB_VERIFY_LOG_SCALING -- Verify that log scaling makes sense, i.e., that
# the range covered by an axis compared to its distance from the origin is
# large enough to permit log scaling.  If log scaling is reasonable check if
# the window goes negative, and switch to ELOG scaling if such is the case.

procedure glb_verify_log_scaling (gp)

pointer	gp			# graphics descriptor
pointer	w

begin
	w  = GP_WCSPTR (gp, GP_WCS(gp))

	# Force ELOG scaling if any data <= 0.

	if (WCS_XTRAN(w) != LINEAR)
	    if (WCS_WX1(w) <= 0 || WCS_WX2(w) <= 0)
		WCS_XTRAN(w) = ELOG

	if (WCS_YTRAN(w) != LINEAR)
	    if (WCS_WY1(w) <= 0 || WCS_WY2(w) <= 0)
		WCS_YTRAN(w) = ELOG

	# Set the WCS state to modified even if it wasn't.  This is safe
	# and in any case the WCS is changed in the main glabax routine
	# shortly after we are called.

	GP_WCSSTATE(gp) = MODIFIED
end