38 #include <visp3/core/vpConfig.h>
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
56 void free_Bound (Bound *bp)
58 Face *fp = bp->face.ptr;
59 Face *fend = fp + bp->face.nbr;
61 for (; fp < fend; fp++) {
62 if (fp->vertex.ptr != fp->vertex.tbl)
63 free ((
char *) fp->vertex.ptr);
65 if (bp->face.ptr != NULL) {
66 free ((
char *) bp->face.ptr);
69 if (bp->point.ptr != NULL) {
70 free ((
char *) bp->point.ptr);
74 if (bp->normal.ptr != NULL) {
75 free ((
char *) bp->normal.ptr);
76 bp->normal.ptr = NULL;
79 bp->is_display = FALSE;
88 void free_huge_Bound (Bound *bp)
99 void free_Bound_scene (Bound_scene *bsp)
101 Bound *bp = bsp->bound.ptr;
102 Bound *bend = bp + bsp->bound.nbr;
104 for (; bp < bend; bp++) {
107 if (bsp->name != NULL) {
108 free ((
char *) bsp->name);
111 if (bsp->bound.ptr != NULL) {
112 free ((
char *) bsp->bound.ptr);
113 bsp->bound.ptr = NULL;
127 void malloc_Bound (Bound *bp, Type type,
int polygonal, Index fn, Index pn)
129 static char proc_name[] =
"malloc_Bound";
131 if ((bp->face.nbr = fn) == 0)
133 else if ((bp->face.ptr = (Face *) malloc (fn *
sizeof (Face)))
139 if ((bp->point.nbr = pn) == 0)
140 bp->point.ptr = NULL;
141 else if ((bp->point.ptr = (Point3f *) malloc (pn *
sizeof (Point3f)))
149 if ((bp->normal.nbr = (bp->is_polygonal ? 0 : pn)) == 0)
150 bp->normal.ptr = NULL;
151 else if ((bp->normal.ptr = (Vector *) malloc (pn *
sizeof (Vector)))
159 bp->is_display = TRUE;
160 bp->is_polygonal = (unsigned)polygonal;
179 void malloc_huge_Bound (Bound *bp)
183 malloc_Bound (bp, (Type) BND_NULL, FALSE, FACE_NBR, POINT_NBR);
185 malloc_Bound (bp, (Type) BND_NULL, TRUE, FACE_NBR, POINT_NBR);
187 if ((bp->face.ptr->vertex.ptr =
188 (Index *) malloc (FACE_NBR * VERTEX_NBR *
sizeof (Index))) == NULL) {
189 static char proc_name[] =
"malloc_Huge_Bound";
204 void malloc_Bound_scene (Bound_scene *bsp,
const char *name, Index bn)
206 static char proc_name[] =
"malloc_Bound_scene";
208 if ((bsp->name = (
char *) malloc ((strlen (name) + 1) *
sizeof (
char)))
213 if ((bsp->bound.nbr = bn) == 0)
214 bsp->bound.ptr = NULL;
215 else if ((bsp->bound.ptr = (Bound *) malloc (bn *
sizeof (Bound)))
220 strcpy (bsp->name, name);