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"
62 Point2i *point2i = (Point2i *)NULL;
63 Point2i *listpoint2i = (Point2i *)NULL;
64 static int *rename_jlc = (
int *)NULL;
70 void open_display(
void)
72 if ((point2i = (Point2i *)malloc(POINT_NBR *
sizeof(Point2i))) == NULL ||
73 (listpoint2i = (Point2i *)malloc(50 *
sizeof(Point2i))) == NULL ||
74 (rename_jlc = (
int *)malloc(POINT_NBR *
sizeof(
int))) == NULL) {
75 static char proc_name[] =
"open_display";
85 void close_display(
void)
87 free((
char *)point2i);
88 free((
char *)listpoint2i);
89 free((
char *)rename_jlc);
90 point2i = (Point2i *)NULL;
91 listpoint2i = (Point2i *)NULL;
92 rename_jlc = (
int *)NULL;
115 void point_3D_2D(Point3f *p3, Index size,
int xsize,
int ysize, Point2i *p2)
117 Point3f *pend = p3 + size;
118 float xdiv2 = ((float)xsize) / (float)2.0;
119 float ydiv2 = ((float)ysize) / (float)2.0;
121 for (; p3 < pend; p3++, p2++) {
122 p2->x = (int)((1.0 + p3->x) * xdiv2);
123 p2->y = (int)((1.0 - p3->y) * ydiv2);
146 void set_Bound_face_display(Bound *bp, Byte b)
148 Face *fp = bp->face.ptr;
149 Face *fend = fp + bp->face.nbr;
150 Point3f *pp = bp->point.ptr;
152 for (; fp < fend; fp++) {
158 fp->is_visible = TRUE;
164 p2 = pp + *(
vp + fp->vertex.nbr - 1);
166 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x) >= (p1->x - p0->x) * (p2->z - p0->z));
171 fp->is_visible = ((p1->z - p0->z) * (p2->x - p0->x) <= (p1->x - p0->x) * (p2->z - p0->z));
176 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z) >= (p1->z - p0->z) * (p2->y - p0->y));
181 fp->is_visible = ((p1->y - p0->y) * (p2->z - p0->z) <= (p1->z - p0->z) * (p2->y - p0->y));
186 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y) >= (p1->y - p0->y) * (p2->x - p0->x));
191 fp->is_visible = ((p1->x - p0->x) * (p2->y - p0->y) <= (p1->y - p0->y) * (p2->x - p0->x));
205 void wireframe_Face(Face *fp, Point2i *pp)
209 Index *
vp = fp->vertex.ptr;
210 Index *vend =
vp + fp->vertex.nbr;
211 Point2i *cp = listpoint2i;
213 if (fp->vertex.nbr < 2)
215 if (fp->vertex.nbr > 50) {
216 printf(
"pb malloc listpoint2i (display.c)\n");
219 for (;
vp < vend;
vp++, cp++) {
220 SET_COORD2(*cp, pp[*
vp].x, pp[*
vp].y);
error that can be emitted by ViSP classes.