45 #include <visp/vpConfig.h>
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57 #include <visp/vpMy.h>
58 #include <visp/vpArit.h>
61 #include <visp/vpBound.h>
62 #include <visp/vpView.h>
63 #include <visp/vpImstack.h>
64 #include <visp/vpRfstack.h>
65 #include <visp/vpVwstack.h>
75 Point2i *point2i = (Point2i *) NULL;
76 Point2i *listpoint2i = (Point2i *) NULL;
77 static int *rename_jlc = (
int *) NULL;
84 void open_display (
void)
86 static char proc_name[] =
"open_display";
88 if ((point2i = (Point2i *) malloc (POINT_NBR*
sizeof (Point2i))) == NULL
89 || (listpoint2i = (Point2i *) malloc (50*
sizeof (Point2i))) == NULL
90 || (rename_jlc = (
int *) malloc (POINT_NBR *
sizeof (
int))) == NULL)
101 void close_display (
void)
103 free ((
char *) point2i);
104 free ((
char *) listpoint2i);
105 free ((
char *) rename_jlc);
106 point2i = (Point2i *) NULL;
107 listpoint2i = (Point2i *) NULL;
108 rename_jlc = (
int *) NULL;
131 void point_3D_2D (Point3f *p3, Index size,
int xsize,
int ysize, Point2i *p2)
133 Point3f *pend = p3 + size;
134 float xdiv2 = ((float) xsize) / (float)2.0;
135 float ydiv2 = ((float) ysize) / (float)2.0;
137 for (; p3 < pend; p3++, p2++) {
138 p2->x = (int) ((1.0 + p3->x) * xdiv2);
139 p2->y = (int) ((1.0 - p3->y) * ydiv2);
162 void set_Bound_face_display (Bound *bp, Byte b)
164 Face *fp = bp->face.ptr;
165 Face *fend = fp + bp->face.nbr;
166 Point3f *pp = bp->point.ptr;
168 for (; fp < fend; fp++) {
174 fp->is_visible = TRUE;
175 if (b == IS_INSIDE)
continue;
179 p2 = pp + *(vp + fp->vertex.nbr - 1);
181 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x)
182 >= (p1->x - p0->x) * (p2->z - p0->z));
184 if (! fp->is_visible)
continue;
186 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x)
187 <= (p1->x - p0->x) * (p2->z - p0->z));
189 if (! fp->is_visible)
continue;
191 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z)
192 >= (p1->z - p0->z) * (p2->y - p0->y));
194 if (! fp->is_visible)
continue;
196 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z)
197 <= (p1->z - p0->z) * (p2->y - p0->y));
199 if (! fp->is_visible)
continue;
201 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y)
202 >= (p1->y - p0->y) * (p2->x - p0->x));
204 if (! fp->is_visible)
continue;
206 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y)
207 <= (p1->y - p0->y) * (p2->x - p0->x));
222 void wireframe_Face (Face *fp, Point2i *pp)
226 Index *vp = fp->vertex.ptr;
227 Index *vend = vp + fp->vertex.nbr;
228 Point2i *cp = listpoint2i;
230 if (fp->vertex.nbr < 2)
return;
231 if (fp->vertex.nbr > 50)
233 printf(
"pb malloc listpoint2i (display.c)\n");
return;
235 for (; vp < vend; vp++, cp++) {
236 SET_COORD2(*cp, pp[*vp].x, pp[*vp].y);