BRL-CAD
clip.h
Go to the documentation of this file.
1/* C L I P . H
2 * BRL-CAD
3 *
4 * Copyright (c) 2004-2023 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
21/*----------------------------------------------------------------------*/
22/** @addtogroup bg_clip
23 *
24 * Clipping functions for comment geometric operations needed when drawing
25 * wireframes in a view window.
26 */
27/** @{ */
28/** @file clip.h */
29
30#ifndef BG_CLIP_H
31#define BG_CLIP_H
32
33#include "common.h"
34#include "vmath.h"
35#include "bg/defines.h"
36
37__BEGIN_DECLS
38
39/**
40 * @brief
41 * Clip a 2-D integer line seg against the size of the display
42 */
43BG_EXPORT extern int bg_lseg_clip(fastf_t *xp1, fastf_t *yp1, fastf_t *xp2, fastf_t *yp2, fastf_t clip_min, fastf_t clip_max);
44
45
46/**
47 * @brief
48 * Clip a line segment against a rectangular parallelepiped (RPP).
49 *
50 * The RPP has faces parallel to the coordinate planes and is defined
51 * by a minimum point and a maximum point.
52 *
53 * FIXME: the function name implies this takes a point,dir for a,b but
54 * it actually takes a line segment going from points a to b!
55 *
56 * Returns -
57 * 0 if ray does not hit RPP,
58 * !0 if ray hits RPP.
59 *
60 * Implicit Return -
61 * if !0 was returned, "a" and "b" have been clipped to the RPP.
62 */
63BG_EXPORT extern int bg_ray_vclip(point_t a, point_t b, fastf_t *min_pt, fastf_t *max_pt);
64
65__END_DECLS
66
67#endif /* BG_CLIP_H */
68
69/** @} */
70
71/*
72 * Local Variables:
73 * mode: C
74 * tab-width: 8
75 * indent-tabs-mode: t
76 * c-file-style: "stroustrup"
77 * End:
78 * ex: shiftwidth=4 tabstop=8
79 */
Header file for the BRL-CAD common definitions.
int bg_lseg_clip(fastf_t *xp1, fastf_t *yp1, fastf_t *xp2, fastf_t *yp2, fastf_t clip_min, fastf_t clip_max)
Clip a 2-D integer line seg against the size of the display.
int bg_ray_vclip(point_t a, point_t b, fastf_t *min_pt, fastf_t *max_pt)
Clip a line segment against a rectangular parallelepiped (RPP).
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:330
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Definition: vmath.h:351
fundamental vector, matrix, quaternion math macros