BRL-CAD
PullbackCurve.h
Go to the documentation of this file.
1 /* P U L L B A C K C U R V E . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2009-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 /** @file step/PullbackCurve.h
21  *
22  * Pull an arbitrary model-space *curve* onto the given *surface* as a
23  * curve within the surface's domain when, for each point c = C(t) on
24  * the curve and the closest point s = S(u, v) on the surface, we have:
25  * distance(c, s) <= *tolerance*.
26  *
27  * The resulting 2-dimensional curve will be approximated using the
28  * following process:
29  *
30  * 1. Adaptively sample the 3d curve in the domain of the surface
31  * (ensure tolerance constraint). Sampling terminates when the
32  * following flatness criterion is met:
33  *
34  * given two parameters on the curve t1 and t2 (which map to points p1 and p2 on the curve)
35  * let m be a parameter randomly chosen near the middle of the interval [t1, t2]
36  * ____
37  *
38  * then the curve between t1 and t2 is flat if distance(C(m), p1p2) < flatness
39  *
40  * 2. Use the sampled points to perform a global interpolation using
41  * universal knot generation to build a B-Spline curve.
42  *
43  * 3. If the curve is a line or an arc (determined with openNURBS routines),
44  * return the appropriate ON_Curve subclass (otherwise, return an ON_NurbsCurve).
45  *
46  */
47 
48 #ifndef LIBBREP_PULLBACKCURVE_H
49 #define LIBBREP_PULLBACKCURVE_H
50 
51 #include "opennurbs.h"
52 
53 
54 namespace brlcad {
55  class SurfaceTree;
56 }
57 
58 
65 };
66 
67 #define PBC_TOL 0.000001
68 #define PBC_FROM_OFFSET 0.001
69 #define PBC_SEAM_TOL 0.001
70 
71 extern enum seam_direction seam_direction(ON_2dPoint uv1, ON_2dPoint uv2);
72 
73 extern ON_Curve*
74 refit_edge(const ON_BrepEdge* edge,
75  double tolerance);
76 
77 extern int
78 check_pullback_seam_bridge(const ON_Surface *surf, const ON_2dPoint &p1, const ON_2dPoint &p2);
79 
80 extern ON_Curve*
81 pullback_curve(const brlcad::SurfaceTree* surfacetree,
82  const ON_Curve* curve,
83  double tolerance = 1.0e-6,
84  double flatness = 1.0e-3);
85 
86 extern ON_Curve*
88  const brlcad::SurfaceTree* surfacetree,
89  const ON_Curve* curve,
90  double tolerance = 1.0e-6,
91  double flatness = 1.0e-3);
92 
93 extern bool
94 toUV(brlcad::SurfaceTree *surftree, const ON_Curve *curve, ON_2dPoint& out_pt, double t, double knudge, double within_distance_tol);
95 
96 #endif
97 
98 /*
99  * Local Variables:
100  * tab-width: 8
101  * mode: C
102  * indent-tabs-mode: t
103  * c-file-style: "stroustrup"
104  * End:
105  * ex: shiftwidth=4 tabstop=8
106  */
ON_Curve * pullback_curve(const brlcad::SurfaceTree *surfacetree, const ON_Curve *curve, double tolerance=1.0e-6, double flatness=1.0e-3)
ON_Curve * pullback_seam_curve(enum seam_direction seam_dir, const brlcad::SurfaceTree *surfacetree, const ON_Curve *curve, double tolerance=1.0e-6, double flatness=1.0e-3)
seam_direction
Definition: PullbackCurve.h:59
ON_Curve * refit_edge(const ON_BrepEdge *edge, double tolerance)
bool toUV(brlcad::SurfaceTree *surftree, const ON_Curve *curve, ON_2dPoint &out_pt, double t, double knudge, double within_distance_tol)
int check_pullback_seam_bridge(const ON_Surface *surf, const ON_2dPoint &p1, const ON_2dPoint &p2)