40 #include <visp3/core/vpConfig.h> 42 #ifndef DOXYGEN_SHOULD_SKIP_THIS 46 #include "vpCoreDisplay.h" 47 #include "vpImstack.h" 49 #include "vpRfstack.h" 51 #include "vpVwstack.h" 61 Point2i *point2i = (Point2i *)NULL;
62 Point2i *listpoint2i = (Point2i *)NULL;
63 static int *rename_jlc = (
int *)NULL;
69 void open_display(
void)
71 if ((point2i = (Point2i *)malloc(POINT_NBR *
sizeof(Point2i))) == NULL ||
72 (listpoint2i = (Point2i *)malloc(50 *
sizeof(Point2i))) == NULL ||
73 (rename_jlc = (
int *)malloc(POINT_NBR *
sizeof(
int))) == NULL) {
74 static char proc_name[] =
"open_display";
84 void close_display(
void)
86 free((
char *)point2i);
87 free((
char *)listpoint2i);
88 free((
char *)rename_jlc);
89 point2i = (Point2i *)NULL;
90 listpoint2i = (Point2i *)NULL;
91 rename_jlc = (
int *)NULL;
114 void point_3D_2D(Point3f *p3, Index size,
int xsize,
int ysize, Point2i *p2)
116 Point3f *pend = p3 + size;
117 float xdiv2 = ((float)xsize) / (float)2.0;
118 float ydiv2 = ((float)ysize) / (float)2.0;
120 for (; p3 < pend; p3++, p2++) {
121 p2->x = (int)((1.0 + p3->x) * xdiv2);
122 p2->y = (int)((1.0 - p3->y) * ydiv2);
145 void set_Bound_face_display(Bound *bp, Byte b)
147 Face *fp = bp->face.ptr;
148 Face *fend = fp + bp->face.nbr;
149 Point3f *pp = bp->point.ptr;
151 for (; fp < fend; fp++) {
157 fp->is_visible = TRUE;
163 p2 = pp + *(vp + fp->vertex.nbr - 1);
165 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x) >= (p1->x - p0->x) * (p2->z - p0->z));
170 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x) <= (p1->x - p0->x) * (p2->z - p0->z));
175 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z) >= (p1->z - p0->z) * (p2->y - p0->y));
180 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z) <= (p1->z - p0->z) * (p2->y - p0->y));
185 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y) >= (p1->y - p0->y) * (p2->x - p0->x));
190 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y) <= (p1->y - p0->y) * (p2->x - p0->x));
204 void wireframe_Face(Face *fp, Point2i *pp)
208 Index *vp = fp->vertex.ptr;
209 Index *vend = vp + fp->vertex.nbr;
210 Point2i *cp = listpoint2i;
212 if (fp->vertex.nbr < 2)
214 if (fp->vertex.nbr > 50) {
215 printf(
"pb malloc listpoint2i (display.c)\n");
218 for (; vp < vend; vp++, cp++) {
219 SET_COORD2(*cp, pp[*vp].x, pp[*vp].y);