BRL-CAD
obj_plot.c
Go to the documentation of this file.
1 /* O B J _ P L O T . 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_plot(struct bu_list *vhead, 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 (!vhead || !ip)
35  return -1;
36 
37  BU_CK_LIST_HEAD(vhead);
39  if (ttol) RT_CK_TESS_TOL(ttol);
40  if (tol) BN_CK_TOL(tol);
41 
42  id = ip->idb_minor_type;
43  if (id < 0)
44  return -2;
45 
46  ft = &OBJ[id];
47  if (!ft)
48  return -3;
49  if (!ft->ft_plot)
50  return -4;
51 
52  return ft->ft_plot(vhead, ip, ttol, tol, NULL);
53 }
54 
55 
56 /*
57  * Local Variables:
58  * mode: C
59  * tab-width: 8
60  * indent-tabs-mode: t
61  * c-file-style: "stroustrup"
62  * End:
63  * ex: shiftwidth=4 tabstop=8
64  */
int(* ft_plot)(struct bu_list *, struct rt_db_internal *, const struct rt_tess_tol *, const struct bn_tol *, const struct rt_view_info *)
Definition: raytrace.h:2096
Definition: list.h:118
Header file for the BRL-CAD common definitions.
int rt_obj_plot(struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
Definition: obj_plot.c:29
#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 idb_minor_type
ID_xxx.
Definition: raytrace.h:193
#define BU_CK_LIST_HEAD(_p)
Definition: list.h:142