BRL-CAD
extrude.c
Go to the documentation of this file.
1 /* E X T R U D E . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2000-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 
21 /** @file libwdb/extrude.c
22  *
23  * Support for extrusion solids
24  *
25  */
26 
27 #include "common.h"
28 
29 #include <math.h>
30 #include <string.h>
31 #include "bio.h"
32 
33 #include "db.h"
34 #include "vmath.h"
35 #include "bn.h"
36 #include "rtgeom.h"
37 #include "raytrace.h"
38 #include "wdb.h"
39 
40 int
42  struct rt_wdb *fp,
43  const char *name,
44  const char *sketch_name,
45  const point_t V,
46  const vect_t h,
47  const vect_t u_vec,
48  const vect_t v_vec,
49  int keypoint)
50 {
51  struct rt_extrude_internal *extr;
52 
53  BU_ALLOC(extr, struct rt_extrude_internal);
54  extr->magic = RT_EXTRUDE_INTERNAL_MAGIC;
55  extr->sketch_name = bu_strdup(sketch_name);
56  VMOVE(extr->V, V);
57  VMOVE(extr->h, h);
58  VMOVE(extr->u_vec, u_vec);
59  VMOVE(extr->v_vec, v_vec);
60  extr->keypoint = keypoint;
61  extr->skt = (struct rt_sketch_internal *)NULL;
62 
63  return wdb_export(fp, name, (void *)extr, ID_EXTRUDE, mk_conv2mm);
64 }
65 
66 
67 /*
68  * Local Variables:
69  * mode: C
70  * tab-width: 8
71  * indent-tabs-mode: t
72  * c-file-style: "stroustrup"
73  * End:
74  * ex: shiftwidth=4 tabstop=8
75  */
Definition: clone.c:90
Header file for the BRL-CAD common definitions.
int wdb_export(struct rt_wdb *wdbp, const char *name, void *gp, int id, double local2mm)
Definition: wdb.c:265
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
#define RT_EXTRUDE_INTERNAL_MAGIC
Definition: magic.h:94
double mk_conv2mm
Conversion factor to mm.
Definition: units.c:37
int mk_extrusion(struct rt_wdb *fp, const char *name, const char *sketch_name, const point_t V, const vect_t h, const vect_t u_vec, const vect_t v_vec, int keypoint)
Definition: extrude.c:41
#define ID_EXTRUDE
Solid of extrusion.
Definition: raytrace.h:485
#define bu_strdup(s)
Definition: str.h:71