BRL-CAD
sph_brep.cpp
Go to the documentation of this file.
1 /* S P H _ B R E P . C P P
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-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 sph_brep.cpp
21  *
22  * Convert sph to b-rep
23  *
24  */
25 
26 #include "common.h"
27 
28 #include "raytrace.h"
29 #include "rtgeom.h"
30 #include "wdb.h"
31 #include "bn.h"
32 
33 #include "opennurbs_sphere.h"
34 
35 extern "C" void
36 rt_sph_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
37 {
38  struct rt_ell_internal *tip;
39 
41  tip = (struct rt_ell_internal *)ip->idb_ptr;
42  RT_ELL_CK_MAGIC(tip);
43 
44  ON_Sphere sph(tip->v, MAGNITUDE(tip->a));
45 
46  ON_Brep *sph_brep = ON_BrepSphere(sph);
47  **b = *sph_brep;
48  delete sph_brep;
49 }
50 
51 
52 // Local Variables:
53 // tab-width: 8
54 // mode: C++
55 // c-basic-offset: 4
56 // indent-tabs-mode: t
57 // c-file-style: "stroustrup"
58 // End:
59 // ex: shiftwidth=4 tabstop=8
Header file for the BRL-CAD common definitions.
void rt_sph_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
Definition: sph_brep.cpp:36
#define RT_CK_DB_INTERNAL(_p)
Definition: raytrace.h:207
Support for uniform tolerances.
Definition: tol.h:71
void * idb_ptr
Definition: raytrace.h:195