Blame src/pm3d.h

Packit 0986c0
/*
Packit 0986c0
 * $Id: pm3d.h,v 1.35 2016/11/05 21:21:07 sfeam Exp $
Packit 0986c0
 */
Packit 0986c0
Packit 0986c0
/* GNUPLOT - pm3d.h */
Packit 0986c0
Packit 0986c0
/*[
Packit 0986c0
 *
Packit 0986c0
 * Petr Mikulik, since December 1998
Packit 0986c0
 * Copyright: open source as much as possible
Packit 0986c0
 *
Packit 0986c0
 *
Packit 0986c0
 * What is here: #defines, global variables and declaration of routines for
Packit 0986c0
 * the pm3d plotting mode
Packit 0986c0
 *
Packit 0986c0
]*/
Packit 0986c0
Packit 0986c0
Packit 0986c0
/* avoid multiple includes */
Packit 0986c0
#ifdef HAVE_CONFIG_H
Packit 0986c0
#   include "config.h"
Packit 0986c0
#endif
Packit 0986c0
Packit 0986c0
#ifndef TERM_HELP
Packit 0986c0
Packit 0986c0
#ifndef PM3D_H
Packit 0986c0
#define PM3D_H
Packit 0986c0
Packit 0986c0
#include "axis.h"	/* only for NONLINEAR_AXES */
Packit 0986c0
#include "graph3d.h"	/* struct surface_points */
Packit 0986c0
Packit 0986c0
Packit 0986c0
Packit 0986c0
/****
Packit 0986c0
  Global options for pm3d algorithm (to be accessed by set / show)
Packit 0986c0
****/
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  where to plot pm3d: base or top (color map) or surface (color surface)
Packit 0986c0
  The string pm3d.where can be any combination of the #defines below.
Packit 0986c0
  For instance, "b" plot at botton only, "st" plots firstly surface, then top, etc.
Packit 0986c0
*/
Packit 0986c0
#define PM3D_AT_BASE	'b'
Packit 0986c0
#define PM3D_AT_TOP	't'
Packit 0986c0
#define PM3D_AT_SURFACE	's'
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  options for flushing scans (for pm3d.flush)
Packit 0986c0
  Note: new terminology compared to my pm3d program; in gnuplot it became
Packit 0986c0
  begin and right instead of left and right
Packit 0986c0
*/
Packit 0986c0
#define PM3D_FLUSH_BEGIN   'b'
Packit 0986c0
#define PM3D_FLUSH_END     'r'
Packit 0986c0
#define PM3D_FLUSH_CENTER  'c'
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  direction of taking the scans: forward = as the scans are stored in the
Packit 0986c0
  file; backward = opposite direction, i.e. like from the end of the file
Packit 0986c0
*/
Packit 0986c0
typedef enum {
Packit 0986c0
    PM3D_SCANS_AUTOMATIC,
Packit 0986c0
    PM3D_SCANS_FORWARD,
Packit 0986c0
    PM3D_SCANS_BACKWARD,
Packit 0986c0
    PM3D_DEPTH
Packit 0986c0
} pm3d_scandir;
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  clipping method:
Packit 0986c0
    PM3D_CLIP_1IN: all 4 points of the quadrangle must be defined and at least
Packit 0986c0
		   1 point of the quadrangle must be in the x and y ranges
Packit 0986c0
    PM3D_CLIP_4IN: all 4 points of the quadrangle must be in the x and y ranges
Packit 0986c0
*/
Packit 0986c0
#define PM3D_CLIP_1IN '1'
Packit 0986c0
#define PM3D_CLIP_4IN '4'
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  is pm3d plotting style implicit or explicit?
Packit 0986c0
*/
Packit 0986c0
typedef enum {
Packit 0986c0
    PM3D_EXPLICIT = 0,
Packit 0986c0
    PM3D_IMPLICIT = 1
Packit 0986c0
} PM3D_IMPL_MODE;
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  from which corner take the color?
Packit 0986c0
*/
Packit 0986c0
typedef enum {
Packit 0986c0
    /* keep the following order of PM3D_WHICHCORNER_C1 .. _C4 */
Packit 0986c0
    PM3D_WHICHCORNER_C1 = 0, 	/* corner 1: first scan, first point   */
Packit 0986c0
    PM3D_WHICHCORNER_C2 = 1, 	/* corner 2: first scan, second point  */
Packit 0986c0
    PM3D_WHICHCORNER_C3 = 2, 	/* corner 3: second scan, first point  */
Packit 0986c0
    PM3D_WHICHCORNER_C4 = 3,	/* corner 4: second scan, second point */
Packit 0986c0
    /* the rest can be in any order */
Packit 0986c0
    PM3D_WHICHCORNER_MEAN    = 4, /* average z-value from all 4 corners */
Packit 0986c0
    PM3D_WHICHCORNER_GEOMEAN = 5, /* geometrical mean of 4 corners */
Packit 0986c0
    PM3D_WHICHCORNER_HARMEAN = 6, /* harmonic mean of 4 corners */
Packit 0986c0
    PM3D_WHICHCORNER_MEDIAN  = 7, /* median of 4 corners */
Packit 0986c0
    PM3D_WHICHCORNER_RMS     = 8, /* root mean square of 4 corners*/
Packit 0986c0
    PM3D_WHICHCORNER_MIN     = 9, /* minimum of 4 corners */
Packit 0986c0
    PM3D_WHICHCORNER_MAX     = 10,/* maximum of 4 corners */
Packit 0986c0
    PM3D_COLOR_BY_NORMAL     = 11 /* derive color from surface normal (not currently used) */
Packit 0986c0
} PM3D_WHICH_CORNERS2COLOR;
Packit 0986c0
Packit 0986c0
/*
Packit 0986c0
  structure defining all properties of pm3d plotting mode
Packit 0986c0
  (except for the properties of the smooth color box, see color_box instead)
Packit 0986c0
*/
Packit 0986c0
typedef struct {
Packit 0986c0
  char where[7];	/* base, top, surface */
Packit 0986c0
  char flush;   	/* left, right, center */
Packit 0986c0
  char ftriangles;   	/* 0/1 (don't) draw flushing triangles */
Packit 0986c0
  char clip;		/* 1in, 4in */
Packit 0986c0
  pm3d_scandir direction;
Packit 0986c0
  PM3D_IMPL_MODE implicit;
Packit 0986c0
			/* 1: [default] draw ALL surfaces with pm3d
Packit 0986c0
			   0: only surfaces specified with 'with pm3d' */
Packit 0986c0
  PM3D_WHICH_CORNERS2COLOR which_corner_color;
Packit 0986c0
			/* default: average color from all 4 points */
Packit 0986c0
  int interp_i;		/* # of interpolation steps along scanline */
Packit 0986c0
  int interp_j;		/* # of interpolation steps between scanlines */
Packit 0986c0
  lp_style_type border;	/* LT_NODRAW to disable.  From `set pm3d border <linespec> */
Packit 0986c0
} pm3d_struct;
Packit 0986c0
Packit 0986c0
extern pm3d_struct pm3d;
Packit 0986c0
Packit 0986c0
typedef struct lighting_model {
Packit 0986c0
  double strength;	/* 0 = no lighting model; 1 = full shading */
Packit 0986c0
  double spec;		/* specular component 0-1 */
Packit 0986c0
  double ambient;	/* ambient component 0-1 */
Packit 0986c0
  double Phong;		/* Phong exponent */
Packit 0986c0
  int rot_z;		/* illumination angle */
Packit 0986c0
  int rot_x;		/* illumination angle */
Packit 0986c0
  TBOOLEAN fixed;	/* TRUE means the light does not rotate */
Packit 0986c0
} lighting_model;
Packit 0986c0
Packit 0986c0
extern lighting_model pm3d_shade;
Packit 0986c0
Packit 0986c0
/* Used to initialize `set pm3d border` */
Packit 0986c0
extern struct lp_style_type default_pm3d_border;
Packit 0986c0
Packit 0986c0
/* Used by routine filled_quadrangle() in color.c */
Packit 0986c0
extern struct lp_style_type pm3d_border_lp;
Packit 0986c0
extern TBOOLEAN track_pm3d_quadrangles;
Packit 0986c0
Packit 0986c0
#if defined(NONLINEAR_AXES) && (NONLINEAR_AXES > 0)
Packit 0986c0
#   define z2cb(z) (z)
Packit 0986c0
#else
Packit 0986c0
    /* The original routine, with log/unlog dance steps */
Packit 0986c0
#   define z2cb(z) z2cb_with_logs(z)
Packit 0986c0
#endif
Packit 0986c0
Packit 0986c0
Packit 0986c0
/****
Packit 0986c0
  Declaration of routines
Packit 0986c0
****/
Packit 0986c0
Packit 0986c0
int get_pm3d_at_option __PROTO((char *pm3d_where));
Packit 0986c0
void pm3d_depth_queue_clear __PROTO((void));
Packit 0986c0
void pm3d_depth_queue_flush __PROTO((void));
Packit 0986c0
void pm3d_reset __PROTO((void));
Packit 0986c0
void pm3d_draw_one __PROTO((struct surface_points* plots));
Packit 0986c0
void pm3d_add_quadrangle __PROTO((struct surface_points* plot, gpdPoint *corners));
Packit 0986c0
double z2cb_with_logs __PROTO((double z));
Packit 0986c0
double cb2gray __PROTO((double cb));
Packit 0986c0
void
Packit 0986c0
pm3d_rearrange_scan_array __PROTO((struct surface_points* this_plot,
Packit 0986c0
    struct iso_curve*** first_ptr, int* first_n, int* first_invert,
Packit 0986c0
    struct iso_curve*** second_ptr, int* second_n, int* second_invert));
Packit 0986c0
Packit 0986c0
void set_plot_with_palette __PROTO((int plot_num, int plot_mode));
Packit 0986c0
Packit 0986c0
TBOOLEAN is_plot_with_palette __PROTO((void));
Packit 0986c0
TBOOLEAN is_plot_with_colorbox __PROTO((void));
Packit 0986c0
Packit 0986c0
#endif /* PM3D_H */
Packit 0986c0
Packit 0986c0
#endif /* TERM_HELP */
Packit 0986c0
Packit 0986c0
/* eof pm3d.h */