BRL-CAD
marker.c
Go to the documentation of this file.
1 /* M A R K E R . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup plot */
21 /** @{ */
22 /** @file libbn/marker.c
23  *
24  * This routine places a specified character (either from
25  * the ASCII set, or one of the 5 special marker characters)
26  * centered about the current pen position (instead of above & to
27  * the right of the current position, as characters usually go).
28  * Calling sequence:
29  *
30  @code
31  * char c is the character to be used for a marker,
32  * or one of the following special markers -
33  * 1 = plus
34  * 2 = an "x"
35  * 3 = a triangle
36  * 4 = a square
37  * 5 = an hourglass
38  @endcode
39  *
40  * Originally written on August 04, 1978
41  *
42  */
43 /** @} */
44 
45 #include "common.h"
46 
47 #include <stdio.h>
48 #include <string.h>
49 
50 #include "vmath.h"
51 #include "plot3.h"
52 
53 void
54 tp_2marker(FILE *fp, register int c, double x, double y, double scale)
55 {
56  char mark_str[4];
57 
58  mark_str[0] = (char)c;
59  mark_str[1] = '\0';
60 
61  /* Draw the marker */
62  tp_2symbol( fp, mark_str,
63  (x - scale*0.5), (y - scale*0.5),
64  scale, 0.0 );
65 }
66 
67 void
68 PL_FORTRAN(f2mark, F2MARK)(FILE **fp, int *c, float *x, float*y, float *scale)
69 {
70  tp_2marker( *fp, *c, *x, *y, *scale );
71 }
72 
73 void
74 tp_3marker(FILE *fp, register int c, double x, double y, double z, double scale)
75 {
76  char mark_str[4];
77  mat_t mat;
78  vect_t p;
79 
80  mark_str[0] = (char)c;
81  mark_str[1] = '\0';
82  MAT_IDN( mat );
83  VSET( p, x - scale*0.5, y - scale*0.5, z );
84  tp_3symbol( fp, mark_str, p, mat, scale );
85 }
86 
87 void
88 PL_FORTRAN(f3mark, F3MARK)(FILE **fp, int *c, float *x, float *y, float *z, float *scale)
89 {
90  tp_3marker( *fp, *c, *x, *y, *z, *scale );
91 }
92 
93 /** @} */
94 /*
95  * Local Variables:
96  * mode: C
97  * tab-width: 8
98  * indent-tabs-mode: t
99  * c-file-style: "stroustrup"
100  * End:
101  * ex: shiftwidth=4 tabstop=8
102  */
void PL_FORTRAN(f2mark, F2MARK)
Definition: marker.c:68
#define VSET(a, b, c, d)
Definition: color.c:53
Header file for the BRL-CAD common definitions.
void tp_2marker(FILE *fp, register int c, double x, double y, double scale)
Definition: marker.c:54
void tp_2symbol(FILE *fp, char *string, double x, double y, double scale, double theta)
Definition: symbol.c:123
void tp_3marker(FILE *fp, register int c, double x, double y, double z, double scale)
Definition: marker.c:74
void tp_3symbol(FILE *fp, char *string, fastf_t *origin, fastf_t *rot, double scale)
Definition: symbol.c:51