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