42 #include <visp3/core/vpConfig.h>
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 #include "vpCoreDisplay.h"
52 #include "vpImstack.h"
53 #include "vpRfstack.h"
54 #include "vpVwstack.h"
64 Point2i *point2i = (Point2i *) NULL;
65 Point2i *listpoint2i = (Point2i *) NULL;
66 static int *rename_jlc = (
int *) NULL;
73 void open_display (
void)
75 if ((point2i = (Point2i *) malloc (POINT_NBR*
sizeof (Point2i))) == NULL
76 || (listpoint2i = (Point2i *) malloc (50*
sizeof (Point2i))) == NULL
77 || (rename_jlc = (
int *) malloc (POINT_NBR *
sizeof (
int))) == NULL)
79 static char proc_name[] =
"open_display";
89 void close_display (
void)
91 free ((
char *) point2i);
92 free ((
char *) listpoint2i);
93 free ((
char *) rename_jlc);
94 point2i = (Point2i *) NULL;
95 listpoint2i = (Point2i *) NULL;
96 rename_jlc = (
int *) NULL;
119 void point_3D_2D (Point3f *p3, Index size,
int xsize,
int ysize, Point2i *p2)
121 Point3f *pend = p3 + size;
122 float xdiv2 = ((float) xsize) / (float)2.0;
123 float ydiv2 = ((float) ysize) / (float)2.0;
125 for (; p3 < pend; p3++, p2++) {
126 p2->x = (int) ((1.0 + p3->x) * xdiv2);
127 p2->y = (int) ((1.0 - p3->y) * ydiv2);
150 void set_Bound_face_display (Bound *bp, Byte b)
152 Face *fp = bp->face.ptr;
153 Face *fend = fp + bp->face.nbr;
154 Point3f *pp = bp->point.ptr;
156 for (; fp < fend; fp++) {
162 fp->is_visible = TRUE;
163 if (b == IS_INSIDE)
continue;
167 p2 = pp + *(vp + fp->vertex.nbr - 1);
169 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x)
170 >= (p1->x - p0->x) * (p2->z - p0->z));
172 if (! fp->is_visible)
continue;
174 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x)
175 <= (p1->x - p0->x) * (p2->z - p0->z));
177 if (! fp->is_visible)
continue;
179 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z)
180 >= (p1->z - p0->z) * (p2->y - p0->y));
182 if (! fp->is_visible)
continue;
184 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z)
185 <= (p1->z - p0->z) * (p2->y - p0->y));
187 if (! fp->is_visible)
continue;
189 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y)
190 >= (p1->y - p0->y) * (p2->x - p0->x));
192 if (! fp->is_visible)
continue;
194 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y)
195 <= (p1->y - p0->y) * (p2->x - p0->x));
210 void wireframe_Face (Face *fp, Point2i *pp)
214 Index *vp = fp->vertex.ptr;
215 Index *vend = vp + fp->vertex.nbr;
216 Point2i *cp = listpoint2i;
218 if (fp->vertex.nbr < 2)
return;
219 if (fp->vertex.nbr > 50)
221 printf(
"pb malloc listpoint2i (display.c)\n");
return;
223 for (; vp < vend; vp++, cp++) {
224 SET_COORD2(*cp, pp[*vp].x, pp[*vp].y);