BRL-CAD
Loading...
Searching...
No Matches
rhc.h
Go to the documentation of this file.
1/* R H C . H
2 * BRL-CAD
3 *
4 * Copyright (c) 1993-2026 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 rt_rhc */
21/** @{ */
22/** @file rt/primitives/rhc.h */
23
24#ifndef RT_PRIMITIVES_RHC_H
25#define RT_PRIMITIVES_RHC_H
26
27#include "common.h"
28#include "vmath.h"
29#include "rt/defines.h"
30
32
33/**
34 * Approximate a hyperbola with line segments.
35 *
36 * @param pts Linked list of points; must have at least two nodes on entry.
37 * @param r Rectangular half-width of the hyperbola.
38 * @param b Breadth (half-height) of the hyperbola.
39 * @param c Distance from the apex to the asymptote origin.
40 * @param dtol Maximum allowable chord-to-curve distance (mm).
41 * @param ntol Maximum allowable normal-deviation angle (radians); pass
42 * M_PI to ignore normal tolerance.
43 * @param min_abs Minimum absolute span (mm) below which subdivision stops,
44 * preventing runaway recursion from extremely tight tolerances.
45 *
46 * Recommended min_abs values:
47 * - 0.05 is a conservative default suitable for most CAD
48 * geometry. A full circle at this dtol requires ~300
49 * segments; finer values rarely produce visible improvement
50 * on typical display hardware.
51 * - 0.005 produces noticeably smoother curves on very small
52 * features but can multiply polygon counts by 10x or more.
53 * - Values below dtol have no additional effect until dtol
54 * itself pushes subdivision to segments shorter than min_abs.
55 * - SMALL_FASTF (~1e-37) disables the floor entirely, matching
56 * the deprecated rt_mk_hyperbola() function signature's
57 * behavior; use only when the geometry is known to be free
58 * of degenerate cases that could trigger unbounded recursion.
59 *
60 * @return Number of additional points inserted into @p pts.
61 */
63 fastf_t r,
64 fastf_t b,
65 fastf_t c,
69
70/**
71 * @deprecated use rt_mk_hyperbola() with an explicit min_abs argument.
72 * Preserves the original rt_mk_hyperbola behavior of trusting the caller's
73 * tolerances unconditionally (equivalent to min_abs = SMALL_FASTF).
74 */
76 fastf_t r,
77 fastf_t b,
78 fastf_t c,
81
82/** @} */
83
85
86#endif /* RT_PRIMITIVES_RHC_H */
87
88/*
89 * Local Variables:
90 * tab-width: 8
91 * mode: C
92 * indent-tabs-mode: t
93 * c-file-style: "stroustrup"
94 * End:
95 * ex: shiftwidth=4 tabstop=8
96 */
Definition dvec.h:74
Header file for the BRL-CAD common definitions.
#define DEPRECATED
Definition common.h:433
DEPRECATED int rt_mk_hyperbola_old(struct rt_pnt_node *pts, fastf_t r, fastf_t b, fastf_t c, fastf_t dtol, fastf_t ntol)
int rt_mk_hyperbola(struct rt_pnt_node *pts, fastf_t r, fastf_t b, fastf_t c, fastf_t dtol, fastf_t ntol, fastf_t min_abs)
double fastf_t
fastest 64-bit (or larger) floating point type
Definition vmath.h:333
fundamental vector, matrix, quaternion math macros