BRL-CAD
obj_vshot.c
Go to the documentation of this file.
1 /* O B J _ V S H 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 #include "raytrace.h"
24 
25 
26 int
27 rt_obj_vshot(struct soltab *stp[], struct xray *rp[], struct seg *segp, int n, struct application *ap)
28 {
29  int i;
30  int id;
31  const struct rt_functab *ft;
32 
33  if (!stp || !rp || n < 1)
34  return -1;
35 
36  for (i = 0; i < n; i++) {
37  if (stp[i]) RT_CK_SOLTAB(stp[i]);
38  if (rp[i]) RT_CK_RAY(rp[i]);
39  }
40  if (segp) RT_CK_SEG(segp);
41  if (ap) RT_CK_APPLICATION(ap);
42 
43  /* should be improved, verify homogeneous collection */
44  id = stp[0]->st_id;
45  if (id < 0)
46  return -2;
47 
48  ft = &OBJ[id];
49  if (!ft)
50  return -3;
51  if (!ft->ft_vshot)
52  return -4;
53 
54  ft->ft_vshot(stp, rp, segp, n, ap);
55  return 0;
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  */
void(* ft_vshot)(struct soltab *[], struct xray *[], struct seg *, int, struct application *)
Definition: raytrace.h:2107
#define RT_CK_APPLICATION(_p)
Definition: raytrace.h:1675
Definition: raytrace.h:215
#define RT_CK_SEG(_p)
Definition: raytrace.h:377
Definition: raytrace.h:368
Header file for the BRL-CAD common definitions.
#define RT_CK_RAY(_p)
Definition: raytrace.h:224
int rt_obj_vshot(struct soltab *stp[], struct xray *rp[], struct seg *segp, int n, struct application *ap)
Definition: obj_vshot.c:27
const struct rt_functab OBJ[]
Definition: table.c:159
#define RT_CK_SOLTAB(_p)
Definition: raytrace.h:453
int st_id
Solid ident.
Definition: raytrace.h:431