40 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpException.h>
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 void free_Bound(Bound *bp)
61 Face *fp = bp->face.ptr;
62 Face *fend = fp + bp->face.nbr;
64 for (; fp < fend; fp++) {
65 if (fp->vertex.ptr != fp->vertex.tbl)
66 free((
char *)fp->vertex.ptr);
68 if (bp->face.ptr != NULL) {
69 free((
char *)bp->face.ptr);
72 if (bp->point.ptr != NULL) {
73 free((
char *)bp->point.ptr);
77 if (bp->normal.ptr != NULL) {
78 free((
char *)bp->normal.ptr);
79 bp->normal.ptr = NULL;
82 bp->is_display = FALSE;
91 void free_huge_Bound(Bound *bp)
102 void free_Bound_scene(Bound_scene *bsp)
104 Bound *bp = bsp->bound.ptr;
105 Bound *bend = bp + bsp->bound.nbr;
107 for (; bp < bend; bp++) {
110 if (bsp->name != NULL) {
111 free((
char *)bsp->name);
114 if (bsp->bound.ptr != NULL) {
115 free((
char *)bsp->bound.ptr);
116 bsp->bound.ptr = NULL;
130 void malloc_Bound(Bound *bp, Type type,
int polygonal, Index fn, Index pn)
132 static char proc_name[] =
"malloc_Bound";
134 if ((bp->face.nbr = fn) == 0)
136 else if ((bp->face.ptr = (Face *)malloc(fn *
sizeof(Face))) == NULL) {
141 if ((bp->point.nbr = pn) == 0)
142 bp->point.ptr = NULL;
143 else if ((bp->point.ptr = (Point3f *)malloc(pn *
sizeof(Point3f))) == NULL) {
150 if ((bp->normal.nbr = (bp->is_polygonal ? 0 : pn)) == 0)
151 bp->normal.ptr = NULL;
152 else if ((bp->normal.ptr = (Vector *)malloc(pn *
sizeof(Vector))) == NULL) {
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 = (Index *)malloc(FACE_NBR * VERTEX_NBR *
sizeof(Index))) == NULL) {
188 static char proc_name[] =
"malloc_Huge_Bound";
203 void malloc_Bound_scene(Bound_scene *bsp,
const char *name, Index bn)
205 static char proc_name[] =
"malloc_Bound_scene";
207 if ((bsp->name = (
char *)malloc((strlen(name) + 1) *
sizeof(
char))) == NULL) {
211 if ((bsp->bound.nbr = bn) == 0)
212 bsp->bound.ptr = NULL;
213 else if ((bsp->bound.ptr = (Bound *)malloc(bn *
sizeof(Bound))) == NULL) {
217 strcpy(bsp->name, name);
error that can be emitted by ViSP classes.