40 #include <visp3/core/vpConfig.h> 42 #ifndef DOXYGEN_SHOULD_SKIP_THIS 58 void free_Bound(Bound *bp)
60 Face *fp = bp->face.ptr;
61 Face *fend = fp + bp->face.nbr;
63 for (; fp < fend; fp++) {
64 if (fp->vertex.ptr != fp->vertex.tbl)
65 free((
char *)fp->vertex.ptr);
67 if (bp->face.ptr != NULL) {
68 free((
char *)bp->face.ptr);
71 if (bp->point.ptr != NULL) {
72 free((
char *)bp->point.ptr);
76 if (bp->normal.ptr != NULL) {
77 free((
char *)bp->normal.ptr);
78 bp->normal.ptr = NULL;
81 bp->is_display = FALSE;
90 void free_huge_Bound(Bound *bp)
101 void free_Bound_scene(Bound_scene *bsp)
103 Bound *bp = bsp->bound.ptr;
104 Bound *bend = bp + bsp->bound.nbr;
106 for (; bp < bend; bp++) {
109 if (bsp->name != NULL) {
110 free((
char *)bsp->name);
113 if (bsp->bound.ptr != NULL) {
114 free((
char *)bsp->bound.ptr);
115 bsp->bound.ptr = NULL;
129 void malloc_Bound(Bound *bp, Type type,
int polygonal, Index fn, Index pn)
131 static char proc_name[] =
"malloc_Bound";
133 if ((bp->face.nbr = fn) == 0)
135 else if ((bp->face.ptr = (Face *)malloc(fn *
sizeof(Face))) == NULL) {
140 if ((bp->point.nbr = pn) == 0)
141 bp->point.ptr = NULL;
142 else if ((bp->point.ptr = (Point3f *)malloc(pn *
sizeof(Point3f))) == NULL) {
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))) == NULL) {
158 bp->is_display = TRUE;
159 bp->is_polygonal = (unsigned)polygonal;
178 void malloc_huge_Bound(Bound *bp)
182 malloc_Bound(bp, (Type)BND_NULL, FALSE, FACE_NBR, POINT_NBR);
184 malloc_Bound(bp, (Type)BND_NULL, TRUE, FACE_NBR, POINT_NBR);
186 if ((bp->face.ptr->vertex.ptr = (Index *)malloc(FACE_NBR * VERTEX_NBR *
sizeof(Index))) == NULL) {
187 static char proc_name[] =
"malloc_Huge_Bound";
202 void malloc_Bound_scene(Bound_scene *bsp,
const char *name, Index bn)
204 static char proc_name[] =
"malloc_Bound_scene";
206 if ((bsp->name = (
char *)malloc((strlen(name) + 1) *
sizeof(
char))) == NULL) {
210 if ((bsp->bound.nbr = bn) == 0)
211 bsp->bound.ptr = NULL;
212 else if ((bsp->bound.ptr = (Bound *)malloc(bn *
sizeof(Bound))) == NULL) {
216 strcpy(bsp->name, name);