aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/calcomp/ccppm.x
blob: bb6c783f1346ec0fc6e965d7ff25a4777a68dcba (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include <gki.h>
include <math.h>
include	"ccp.h"

define	DIAGSEP	(1.0 * g_plwsep / 0.7071068)	# dis at 40 degrees from plwsep

# CCP_POLYMARKER -- Draw a polymarker.  The polymarker is defined by the array
# of points P, consisting of successive (x,y) coordinate pairs.

procedure ccp_polymarker (p, npts)

short	p[ARB]			# points defining line
int	npts			# number of points, i.e., (x,y) pairs

pointer	pm
int	i, j, len_p
real	theta, x, y, tx, ty
include	"ccp.com"

begin
	if (npts <= 0)
	    return

	len_p = npts * 2

	# Keep track of the number of drawing instructions since the last frame
	# clear.
	g_ndraw = g_ndraw + 1

	# Update polymarker attributes if necessary.

	pm = CCP_PMAP(g_cc)

	if (CCP_LTYPE(g_cc) != PM_LTYPE(pm)) {
	    call ccp_linetype (PM_LTYPE(pm))
	    CCP_LTYPE(g_cc) = PM_LTYPE(pm)
	}
	if (CCP_WIDTH(g_cc) != PM_WIDTH(pm)) 
		CCP_WIDTH(g_cc) = PM_WIDTH(pm)

	if (CCP_COLOR(g_cc) != PM_COLOR(pm)) {
	    call ccp_color (PM_COLOR(pm))
	    CCP_COLOR(g_cc) = PM_COLOR(pm)
	}

	# Draw the polymarker.
	do i = 1, len_p, 2 {
	    # Draw the single point as a box with a diagonal
	    # through it.

	    theta = 0.5 * HALFPI
	    x = XTRAN(p[i])
	    y = YTRAN(p[i+1])
	    tx = x + DIAGSEP * cos (theta)
	    ty = y + DIAGSEP * sin (theta)
	    call plot (tx, ty, CCP_UP)
	    g_max_x = max (tx, g_max_x)

	    do j = 1, 4 {
		theta = theta + HALFPI
		tx = x + DIAGSEP * cos (theta)
		ty = y + DIAGSEP * sin (theta)
		call plot (tx, ty, CCP_DOWN)
	    }

	    # Fill in diagonal.
	    tx = x + DIAGSEP * cos (theta + PI)
	    ty = y + DIAGSEP * sin (theta + PI)
	    call plot (tx, ty, CCP_DOWN)
	}
end