BRL-CAD
cline_brep.cpp
Go to the documentation of this file.
1 /* C L I N E _ B R E P . C P P
2  * BRL-CAD
3  *
4  * Copyright (c) 2012-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 cline_brep.cpp
21  *
22  * Convert a FASTGEN4 CLINE element to b-rep form
23  *
24  */
25 
26 #include "common.h"
27 
28 #include "raytrace.h"
29 #include "rtgeom.h"
30 #include "brep.h"
31 
32 extern "C" {
33  int rt_cline_to_pipe(struct rt_pipe_internal *pipe, const struct rt_db_internal *ip);
34  void rt_pipe_brep(ON_Brep **b, struct rt_db_internal *ip, const struct bn_tol *tol);
35 }
36 
37 extern "C" void
38 rt_cline_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *tol)
39 {
40  struct rt_cline_internal *cip;
41  struct rt_pipe_internal *pip;
42 
44  cip = (struct rt_cline_internal *)ip->idb_ptr;
45  RT_CLINE_CK_MAGIC(cip);
46 
47  BU_ALLOC(pip, struct rt_pipe_internal);
48  rt_cline_to_pipe(pip, ip);
49 
50  struct rt_db_internal tmp_internal;
51  RT_DB_INTERNAL_INIT(&tmp_internal);
52  tmp_internal.idb_major_type = DB5_MAJORTYPE_BRLCAD;
53  tmp_internal.idb_ptr = (void *)pip;
54  tmp_internal.idb_minor_type = ID_PIPE;
55  tmp_internal.idb_meth = &OBJ[ID_PIPE];
56  rt_pipe_brep(b, &tmp_internal, tol);
57 
58  bu_free(pip, "pipe internal");
59 }
60 
61 
62 // Local Variables:
63 // tab-width: 8
64 // mode: C++
65 // c-basic-offset: 4
66 // indent-tabs-mode: t
67 // c-file-style: "stroustrup"
68 // End:
69 // ex: shiftwidth=4 tabstop=8
#define ID_PIPE
Pipe (wire) solid.
Definition: raytrace.h:473
Header file for the BRL-CAD common definitions.
int idb_major_type
Definition: raytrace.h:192
void rt_pipe_brep(ON_Brep **b, struct rt_db_internal *ip, const struct bn_tol *tol)
#define RT_CK_DB_INTERNAL(_p)
Definition: raytrace.h:207
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
#define RT_DB_INTERNAL_INIT(_p)
Definition: raytrace.h:199
const struct rt_functab * idb_meth
for ft_ifree(), etc.
Definition: raytrace.h:194
Support for uniform tolerances.
Definition: tol.h:71
int rt_cline_to_pipe(struct rt_pipe_internal *pipe, const struct rt_db_internal *ip)
Definition: cline.c:1106
void rt_cline_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *tol)
Definition: cline_brep.cpp:38
void * idb_ptr
Definition: raytrace.h:195
const struct rt_functab OBJ[]
Definition: table.c:159
int idb_minor_type
ID_xxx.
Definition: raytrace.h:193
void bu_free(void *ptr, const char *str)
Definition: malloc.c:328