40 #include <visp3/core/vpConfig.h>
41 #include <visp3/core/vpException.h>
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
47 #include "vpCoreDisplay.h"
48 #include "vpImstack.h"
50 #include "vpRfstack.h"
52 #include "vpVwstack.h"
63 Point2i *point2i = (Point2i *)NULL;
64 Point2i *listpoint2i = (Point2i *)NULL;
65 static int *rename_jlc = (
int *)NULL;
71 void open_display(
void)
73 if ((point2i = (Point2i *)malloc(POINT_NBR *
sizeof(Point2i))) == NULL ||
74 (listpoint2i = (Point2i *)malloc(50 *
sizeof(Point2i))) == NULL ||
75 (rename_jlc = (
int *)malloc(POINT_NBR *
sizeof(
int))) == NULL) {
76 static char proc_name[] =
"open_display";
86 void close_display(
void)
88 free((
char *)point2i);
89 free((
char *)listpoint2i);
90 free((
char *)rename_jlc);
91 point2i = (Point2i *)NULL;
92 listpoint2i = (Point2i *)NULL;
93 rename_jlc = (
int *)NULL;
116 void point_3D_2D(Point3f *p3, Index size,
int xsize,
int ysize, Point2i *p2)
118 Point3f *pend = p3 + size;
119 float xdiv2 = ((float)xsize) / (float)2.0;
120 float ydiv2 = ((float)ysize) / (float)2.0;
122 for (; p3 < pend; p3++, p2++) {
123 p2->x = (int)((1.0 + p3->x) * xdiv2);
124 p2->y = (int)((1.0 - p3->y) * ydiv2);
147 void set_Bound_face_display(Bound *bp, Byte b)
149 Face *fp = bp->face.ptr;
150 Face *fend = fp + bp->face.nbr;
151 Point3f *pp = bp->point.ptr;
153 for (; fp < fend; fp++) {
159 fp->is_visible = TRUE;
165 p2 = pp + *(vp + fp->vertex.nbr - 1);
167 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x) >= (p1->x - p0->x) * (p2->z - p0->z));
172 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x) <= (p1->x - p0->x) * (p2->z - p0->z));
177 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z) >= (p1->z - p0->z) * (p2->y - p0->y));
182 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z) <= (p1->z - p0->z) * (p2->y - p0->y));
187 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y) >= (p1->y - p0->y) * (p2->x - p0->x));
192 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y) <= (p1->y - p0->y) * (p2->x - p0->x));
206 void wireframe_Face(Face *fp, Point2i *pp)
210 Index *vp = fp->vertex.ptr;
211 Index *vend = vp + fp->vertex.nbr;
212 Point2i *cp = listpoint2i;
214 if (fp->vertex.nbr < 2)
216 if (fp->vertex.nbr > 50) {
217 printf(
"pb malloc listpoint2i (display.c)\n");
220 for (; vp < vend; vp++, cp++) {
221 SET_COORD2(*cp, pp[*vp].x, pp[*vp].y);
error that can be emitted by ViSP classes.