Пример #1
0
/*
   Makes mapping from real 3D coordinates, passed as coords array,
   to 2D terminal coordinates, then draws filled polygon
 */
void
filled_polygon_common(int points, struct coordinate GPHUGE * coords, TBOOLEAN fixed, double z)
{
    int i;
    double x, y;
    gpiPoint *icorners;
    icorners = gp_alloc(points * sizeof(gpiPoint), "filled_polygon3d corners");
    for (i = 0; i < points; i++) {
	if (fixed)
	    z = coords[i].z;
	map3d_xy_double(coords[i].x, coords[i].y, z, &x, &y);
	icorners[i].x = x;
	icorners[i].y = y;
    }
#ifdef EXTENDED_COLOR_SPECS
    if ((term->flags & TERM_EXTENDED_COLOR)) {
	icorners[0].spec.gray = -1;	/* force solid color */
    }
#endif
    if (default_fillstyle.fillstyle == FS_EMPTY)
	icorners->style = FS_OPAQUE;
    else
	icorners->style = style_from_fill(&default_fillstyle);
    term->filled_polygon(points, icorners);
    free(icorners);
}
Пример #2
0
/* Function to map from user 3D space to normalized 'camera' view
 * space, and from there directly to terminal coordinates */
void
map3d_xy(
    double x, double y, double z,
    int *xt, int *yt)
{
    double xtd, ytd;
    map3d_xy_double(x, y, z, &xtd, &ytd);
    *xt = xtd;
    *yt = ytd;
}
Пример #3
0
void
filled_quadrangle(gpdPoint * corners)
#endif
{
    int i;
    double x, y;
#ifndef EXTENDED_COLOR_SPECS
    gpiPoint icorners[4];
#endif
    for (i = 0; i < 4; i++) {
	map3d_xy_double(corners[i].x, corners[i].y, corners[i].z, &x, &y);
	icorners[i].x = x;
	icorners[i].y = y;
    }

    ifilled_quadrangle(icorners);
}
Пример #4
0
/*
   Makes mapping from real 3D coordinates, passed as coords array, but at z coordinate
   fixed (base_z, for instance) to 2D terminal coordinates, then draws filled polygon
 */
void
filled_polygon_3dcoords_zfixed(int points, struct coordinate GPHUGE * coords, double z)
{
    int i;
    double x, y;
    gpiPoint *icorners;
    icorners = gp_alloc(points * sizeof(gpiPoint), "filled_polygon_zfix corners");
    for (i = 0; i < points; i++) {
	map3d_xy_double(coords[i].x, coords[i].y, z, &x, &y);
	icorners[i].x = x;
	icorners[i].y = y;
    }
#ifdef EXTENDED_COLOR_SPECS
    if (supply_extended_color_specs) {
	icorners[0].spec.gray = -1;	/* force solid color */
    }
#endif
    if (default_fillstyle.fillstyle == FS_EMPTY)
	icorners->style = FS_OPAQUE;
    else
	icorners->style = style_from_fill(&default_fillstyle);
    term->filled_polygon(points, icorners);
    free(icorners);
}