File: clip.h

package info (click to toggle)
yorick 2.2.03%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,620 kB
  • ctags: 9,317
  • sloc: ansic: 85,521; sh: 1,665; cpp: 1,282; lisp: 1,234; makefile: 1,034; fortran: 19
file content (67 lines) | stat: -rw-r--r-- 1,953 bytes parent folder | download | duplicates (6)
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
/*
 * $Id: clip.h,v 1.1 2005-09-18 22:04:25 dhmunro Exp $
 * Routines to perform floating point clipping operations.
 */
/* Copyright (c) 2005, The Regents of the University of California.
 * All rights reserved.
 * This file is part of yorick (http://yorick.sourceforge.net).
 * Read the accompanying LICENSE file for details.
 */
/*
    Interface routines:

    *** include "clip.h" to define xClip, yClip ***
    int nc;
    ClipSetup(xmin, xmax, ymin, ymax);

       *** to draw an open curve, use ***
    if (ClipBegin(x, y, n, 0)) DrawPolyline(x, y, n);
    else while (nc=ClipMore()) DrawPolyline(xClip, yClip, nc);

       *** to draw a closed curve, use ***
    if (ClipBegin(x, y, n, 1)) DrawPolygon(x, y, n);
    else while (nc=ClipMore()) DrawPolyline(xClip, yClip, nc);

       *** to draw a set of unconnected points, use ***
    if (nc=ClipPoints(x, y, n)) DrawPolymarker(xClip, yClip, nc);

       *** to draw a closed filled curve, use ***
    if (nc=ClipFilled(x, y, n)) DrawFilledPolygon(xClip, yClip, nc);

       *** to draw a disjoint segments, use ***
    if (nc=ClipDisjoint(x0, y0, x1, y1, n))
       DrawDisjoint(xClip, yClip, xClip1, yClip1, nc);
 */

#ifndef CLIP_H
#define CLIP_H

#ifndef GIST_H
#ifndef SINGLE_P
typedef double GpReal;
#else
typedef float GpReal;
#endif
#endif

extern GpReal *xClip, *yClip, *xClip1, *yClip1;

extern void ClipFreeWS(void);

extern void ClipSetup(GpReal xmn, GpReal xmx, GpReal ymn, GpReal ymx);

extern int ClipBegin(const GpReal* xx, const GpReal* yy, int nn, int clsd);

extern int ClipMore(void);

extern int ClipPoints(const GpReal* xx, const GpReal* yy, int nn);

extern int ClipFilled(const GpReal* xx, const GpReal* yy, int nn);

extern int ClipDisjoint(const GpReal* x0, const GpReal* y0,
                        const GpReal* x1, const GpReal* y1, int nn);

extern int ClipTest(const GpReal* xx, const GpReal* yy, int nn, int clsd,
                    const GpReal* box);

#endif