BRL-CAD
obj_tess.c
Go to the documentation of this file.
1 /* O B J _ T E S S . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2010-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 #include "common.h"
22 
23 
24 #include "bn.h"
25 #include "raytrace.h"
26 
27 
28 int
29 rt_obj_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
30 {
31  int id;
32  const struct rt_functab *ft;
33 
34  if (!r || !ip)
35  return -1;
36 
37  if (*r) NMG_CK_REGION(*r);
38  if (m) NMG_CK_MODEL(m);
40  if (ttol) RT_CK_TESS_TOL(ttol);
41  if (tol) BN_CK_TOL(tol);
42 
43  id = ip->idb_minor_type;
44  if (id < 0)
45  return -2;
46 
47  ft = &OBJ[id];
48  if (!ft)
49  return -3;
50  if (!ft->ft_tessellate)
51  return -4;
52 
53  return ft->ft_tessellate(r, m, ip, ttol, tol);
54 }
55 
56 
57 /*
58  * Local Variables:
59  * mode: C
60  * tab-width: 8
61  * indent-tabs-mode: t
62  * c-file-style: "stroustrup"
63  * End:
64  * ex: shiftwidth=4 tabstop=8
65  */
int rt_obj_tess(struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
Definition: obj_tess.c:29
Header file for the BRL-CAD common definitions.
#define RT_CK_DB_INTERNAL(_p)
Definition: raytrace.h:207
#define RT_CK_TESS_TOL(_p)
Definition: raytrace.h:184
Support for uniform tolerances.
Definition: tol.h:71
#define BN_CK_TOL(_p)
Definition: tol.h:82
const struct rt_functab OBJ[]
Definition: table.c:159
int(* ft_tessellate)(struct nmgregion **, struct model *, struct rt_db_internal *, const struct rt_tess_tol *, const struct bn_tol *)
Definition: raytrace.h:2114
int idb_minor_type
ID_xxx.
Definition: raytrace.h:193