40 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpException.h>
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60 void free_Bound(Bound *bp)
62 Face *fp = bp->face.ptr;
63 Face *fend = fp + bp->face.nbr;
65 for (; fp < fend; fp++) {
66 if (fp->vertex.ptr != fp->vertex.tbl)
67 free((
char *)fp->vertex.ptr);
69 if (bp->face.ptr != NULL) {
70 free((
char *)bp->face.ptr);
73 if (bp->point.ptr != NULL) {
74 free((
char *)bp->point.ptr);
78 if (bp->normal.ptr != NULL) {
79 free((
char *)bp->normal.ptr);
80 bp->normal.ptr = NULL;
83 bp->is_display = FALSE;
92 void free_huge_Bound(Bound *bp)
103 void free_Bound_scene(Bound_scene *bsp)
105 Bound *bp = bsp->bound.ptr;
106 Bound *bend = bp + bsp->bound.nbr;
108 for (; bp < bend; bp++) {
111 if (bsp->name != NULL) {
112 free((
char *)bsp->name);
115 if (bsp->bound.ptr != NULL) {
116 free((
char *)bsp->bound.ptr);
117 bsp->bound.ptr = NULL;
131 void malloc_Bound(Bound *bp, Type type,
int polygonal, Index fn, Index pn)
133 static char proc_name[] =
"malloc_Bound";
135 if ((bp->face.nbr = fn) == 0)
137 else if ((bp->face.ptr = (Face *)malloc(fn *
sizeof(Face))) == NULL) {
142 if ((bp->point.nbr = pn) == 0)
143 bp->point.ptr = NULL;
144 else if ((bp->point.ptr = (Point3f *)malloc(pn *
sizeof(Point3f))) == NULL) {
151 if ((bp->normal.nbr = (bp->is_polygonal ? 0 : pn)) == 0)
152 bp->normal.ptr = NULL;
153 else if ((bp->normal.ptr = (Vector *)malloc(pn *
sizeof(Vector))) == NULL) {
160 bp->is_display = TRUE;
161 bp->is_polygonal = (unsigned)polygonal;
180 void malloc_huge_Bound(Bound *bp)
184 malloc_Bound(bp, (Type)BND_NULL, FALSE, FACE_NBR, POINT_NBR);
186 malloc_Bound(bp, (Type)BND_NULL, TRUE, FACE_NBR, POINT_NBR);
188 if ((bp->face.ptr->vertex.ptr = (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))) == NULL) {
212 if ((bsp->bound.nbr = bn) == 0)
213 bsp->bound.ptr = NULL;
214 else if ((bsp->bound.ptr = (Bound *)malloc(bn *
sizeof(Bound))) == NULL) {
218 strcpy(bsp->name, name);
error that can be emitted by ViSP classes.