BRL-CAD
ebm.c
Go to the documentation of this file.
1 /* E B M . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1994-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 libwdb/ebm.c
21  *
22  */
23 
24 #include "common.h"
25 
26 #include <string.h>
27 #include "bio.h"
28 
29 #include "vmath.h"
30 #include "bn.h"
31 #include "rtgeom.h"
32 #include "raytrace.h"
33 #include "wdb.h"
34 #include "db.h"
35 
36 
37 int
38 mk_ebm(struct rt_wdb *fp, const char *name, const char *file, size_t xdim, size_t ydim, fastf_t tallness, const matp_t mat)
39  /* name of file containing bitmap */
40  /* X dimension of file (w cells) */
41  /* Y dimension of file (n cells) */
42  /* Z extrusion height (mm) */
43  /* convert local coords to model space */
44 {
45  struct rt_ebm_internal *ebm;
46 
47  BU_ALLOC(ebm, struct rt_ebm_internal);
48  ebm->magic = RT_EBM_INTERNAL_MAGIC;
49  bu_strlcpy(ebm->file, file, RT_EBM_NAME_LEN);
50  ebm->xdim = xdim;
51  ebm->ydim = ydim;
52  ebm->tallness = tallness;
53  MAT_COPY(ebm->mat, mat);
54 
55  return wdb_export(fp, name, (void *)ebm, ID_EBM, mk_conv2mm);
56 }
57 
58 
59 /*
60  * Local Variables:
61  * mode: C
62  * tab-width: 8
63  * indent-tabs-mode: t
64  * c-file-style: "stroustrup"
65  * End:
66  * ex: shiftwidth=4 tabstop=8
67  */
Definition: clone.c:90
Header file for the BRL-CAD common definitions.
#define RT_EBM_INTERNAL_MAGIC
Definition: magic.h:89
int wdb_export(struct rt_wdb *wdbp, const char *name, void *gp, int id, double local2mm)
Definition: wdb.c:265
#define ID_EBM
Extruded bitmap solid.
Definition: raytrace.h:470
#define BU_ALLOC(_ptr, _type)
Definition: malloc.h:223
#define bu_strlcpy(dst, src, size)
Definition: str.h:60
double mk_conv2mm
Conversion factor to mm.
Definition: units.c:37
int mk_ebm(struct rt_wdb *fp, const char *name, const char *file, size_t xdim, size_t ydim, fastf_t tallness, const matp_t mat)
Definition: ebm.c:38
double fastf_t
Definition: defines.h:300