![]() | ![]() | ![]() | [Insert name here] Reference Manual | ![]() |
---|
graphf —
struct GraphfAffine3D; struct GraphfPointScalar2D; void graphf_affine_3d_identity (GraphfAffine3D*); void graphf_affine_3d_transform (const GraphfAffine3D*, double *out, const double *in); void graphf_affine_3d_compose (GraphfAffine3D *out, const GraphfAffine3D *a, const GraphfAffine3D *b); enum Graphf2DMode; enum Graphf2DMarker; void graphf_3d_surface_line_init (Graphf3DSurfaceLine *line); void graphf_3d_surface_init (Graphf3DSurface *surface); enum GraphfOptionType; typedef GraphfColor; struct GraphfOption; void graphf_2d_plot_1_v (const char *label, unsigned n_points, const Graphf2DPoint *points, unsigned n_options, const GraphfOption *options); void graphf_2d_plot_1 (const char *label, unsigned n_points, const Graphf2DPoint *points, GraphfOptionType first_option, ...); void graphf_2d_plot_start (const char *label, GraphfOptionType first_option, ...); void graphf_2d_plot_start_v (const char *label, unsigned n_options, const GraphfOption *options); void graphf_2d_plot_points (unsigned n_points, const Graphf2DPoint *points, GraphfOptionType first_option, ...); void graphf_2d_plot_points_v (unsigned n_points, const Graphf2DPoint *points, unsigned n_options, const GraphfOption *options); void graphf_2d_plot_vector_field (unsigned n_points, const Graphf2DPointVector *points, GraphfOptionType first_option, ...); void graphf_2d_plot_vector_field_v (unsigned n_points, const Graphf2DPointVector *points, unsigned n_options, const GraphfOption *options); struct Graphf2DDataOffsets; void graphf_2d_plot_any_v (unsigned n_points, unsigned data_size, const void *data, const Graphf2DDataOffsets *offsets, unsigned n_options, const GraphfOption *options); void graphf_2d_plot_finish (void); void graphf_2d_data_offsets_init (Graphf2DDataOffsets *offsets); struct Graphf3DPoint; enum Graphf3DMarkerType; struct Graphf3DCamera; struct Graphf3DView; struct Graphf3DLight; enum Graphf3DLightType; void graphf_3d_plot_start (const char *label, GraphfOptionType first_option, ...); void graphf_3d_plot_start_v (const char *label, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_scatter_v (const Graphf3DPoint *data, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_heights_v (unsigned n_rows, unsigned n_cols, const double *data, double x_offset, double x_scale, double y_offset, double y_scale, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_heights (unsigned n_rows, unsigned n_cols, const double *data, double x_offset, double x_scale, double y_offset, double y_scale, GraphfOptionType first_options, ...); void graphf_3d_plot_grid_v (unsigned n_rows, unsigned n_cols, const Graphf3DPoint *data, double x_offset, double x_scale, double y_offset, double y_scale, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_finish (void); struct Graphf3DDataOffsets; void graphf_3d_data_offsets_init (Graphf3DDataOffsets *offsets); void graphf_3d_plot_any_v (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const void *data, const Graphf3DDataOffsets *offsets, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_any (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const void *data, const Graphf3DDataOffsets *offsets, GraphfOptionType first_option, ...); void graphf_3d_plot_surface_v (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const double *xyz_offset, const double *xyz_scale, unsigned axis, const void *data, const Graphf3DDataOffsets *offsets, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_surface (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const double *xyz_offset, const double *xyz_scale, unsigned axis, const void *data, const Graphf3DDataOffsets *offsets, GraphfOptionType first_option, ...); void graphf_3d_plot_point_surface_v (unsigned n_rows, unsigned n_cols, const Graphf3DPoint *data, unsigned n_options, const GraphfOption *options); void graphf_3d_plot_point_surface (unsigned n_rows, unsigned n_cols, const Graphf3DPoint *data, GraphfOptionType first_option, ...); void graphf_3d_view_init (Graphf3DView *view, const double *look_at, const double *forward, const double *upward, double distance, double focal_length, int is_perspective); void graphf_3d_view_rotate (Graphf3DView *view, const double *center_of_rot, const double *axis_and_mag, int camera_relative); void graphf_3d_view_move (Graphf3DView *view, const double *delta, int camera_relative); void graphf_3d_view_set_window (Graphf3DView *view, double x, double y, double width, double height); void graphf_3d_camera_world_to_local (const Graphf3DCamera *camera, double *out, const double *in); void graphf_3d_camera_world_to_local_vector (const Graphf3DCamera *camera, double *out, const double *in); void graphf_3d_camera_local_to_screen (const Graphf3DCamera *camera, double *out, const double *in, unsigned output_width, unsigned output_height); void graphf_3d_camera_xydepth_to_world (const Graphf3DCamera *camera, double *world_coord_out, double x, double y, double depth, double width, double height); void graphf_3d_camera_local_to_world (const Graphf3DCamera *camera, double *world_coord_out, const double *local_coords); void graphf_3d_camera_get_camera_relative_ray_from_pixel (const Graphf3DCamera *camera, double pixel_x, double pixel_y, double width, double height, double *ray_offset_out, double *ray_dir_out); void graphf_set_backend_path (const char *sh);
void graphf_affine_3d_transform (const GraphfAffine3D*, double *out, const double *in);
Param1: | |
out: | |
in: |
void graphf_affine_3d_compose (GraphfAffine3D *out, const GraphfAffine3D *a, const GraphfAffine3D *b);
out: | |
a: | |
b: |
typedef enum { GRAPHF_2D_MODE_LINE, GRAPHF_2D_MODE_SCATTER, GRAPHF_2D_MODE_SCALAR_FIELD, GRAPHF_2D_MODE_VECTOR_FIELD } Graphf2DMode;
typedef enum { /* points */ GRAPHF_2D_MARKER_NONE, GRAPHF_2D_MARKER_CROSSHAIR, GRAPHF_2D_MARKER_CIRCLE_HOLLOW, GRAPHF_2D_MARKER_CIRCLE_FILLED, GRAPHF_2D_MARKER_SQUARE, GRAPHF_2D_MARKER_EMPTY_CROSSHAIR, GRAPHF_2D_MARKER_DIAG_CROSSHAIR, GRAPHF_2D_MARKER_DIAG_CORNER_FRAME, /* scalar points */ GRAPHF_2D_SCALAR_STYLE_SYMMETRIC_X_LINE, GRAPHF_2D_SCALAR_STYLE_SYMMETRIC_X_LINE_WITH_HOLE, GRAPHF_2D_SCALAR_STYLE_TICKED_X_LINE, GRAPHF_2D_SCALAR_STYLE_SYMMETRIC_Y_LINE, GRAPHF_2D_SCALAR_STYLE_SYMMETRIC_Y_LINE_WITH_HOLE, GRAPHF_2D_SCALAR_STYLE_TICKED_Y_LINE, GRAPHF_2D_SCALAR_STYLE_BOX, GRAPHF_2D_SCALAR_STYLE_BOX_CORNERS, GRAPHF_2D_SCALAR_STYLE_CIRCLE_HOLLOW, GRAPHF_2D_SCALAR_STYLE_CIRCLE_FILLED, /* vector points */ GRAPHF_2D_VECTOR_STYLE_XY_LINES, GRAPHF_2D_VECTOR_STYLE_XY_LINES_WITH_HOLE, GRAPHF_2D_VECTOR_STYLE_ARROW, GRAPHF_2D_VECTOR_STYLE_ELLIPSE_HOLLOW, GRAPHF_2D_VECTOR_STYLE_ELLIPSE_FILLED } Graphf2DMarker;
typedef enum /* GraphfOptionType */ { /** [string] The label for the x-axis. */ GRAPHF_OPTION_2D_XLABEL=1, /** [string] The label for the y-axis. */ GRAPHF_OPTION_2D_YLABEL, /** [double] The left-hand X value. Defaults to the minimum x * in the dataset. */ GRAPHF_OPTION_2D_XMIN, /** [double] The lower Y value. Defaults to the minimum y * in the dataset. */ GRAPHF_OPTION_2D_YMIN, /** [double] The right-hand X value. Defaults to the maximum x * in the dataset. */ GRAPHF_OPTION_2D_XMAX, /** [double] The upper Y value. Defaults to the maximum y * in the dataset. */ GRAPHF_OPTION_2D_YMAX, /** [boolean] Whether to draw a horizontal grid under the graph. */ GRAPHF_OPTION_2D_GRID_HORIZ, /** [boolean] Whether to draw a vertical grid under the graph. */ GRAPHF_OPTION_2D_GRID_VERT, /** [double] Padding above the graphic. */ GRAPHF_OPTION_2D_PADDING_ABOVE_AREA, /** [double] Padding between the graphic and the lower labels. */ GRAPHF_OPTION_2D_PADDING_BELOW_AREA, /** [double] Padding between the graphic and the left-hand labels. */ GRAPHF_OPTION_2D_PADDING_LEFT_OF_AREA, /** [double] Padding right of the graphic. */ GRAPHF_OPTION_2D_PADDING_RIGHT_OF_AREA, /** [double] Vertical padding between the y-axis markers and label */ GRAPHF_OPTION_2D_PADDING_BETWEEN_LEFT_LABELS, /** [double] Horiz padding between the x-axis markers and label */ GRAPHF_OPTION_2D_PADDING_BETWEEN_BOTTOM_LABELS, /** [double] Padding left of the y-label. */ GRAPHF_OPTION_2D_PADDING_LEFT, /** [double] Padding under the x-label. */ GRAPHF_OPTION_2D_PADDING_BOTTOM, /* 2d dataset options */ /** [boolean] whether to connect the data */ GRAPHF_OPTION_2D_DATASET_CONNECT, /** [enum:Graphf2DDatasetMarker] the type of marker to render * at each point. (default is none). */ GRAPHF_OPTION_2D_DATASET_MARKER, /** [double] the size of the markers */ GRAPHF_OPTION_2D_DATASET_MARKER_SIZE, /** [color] the color of the markers */ GRAPHF_OPTION_2D_DATASET_COLOR, #define _GRAPHF_OPTION_2D_DATASET_FIRST GRAPHF_OPTION_2D_DATASET_CONNECT #define _GRAPHF_OPTION_2D_DATASET_LAST GRAPHF_OPTION_2D_DATASET_COLOR /** [color] background color of the image. */ GRAPHF_OPTION_3D_BACKGROUND_COLOR, /** [vector] the center of the scene, for computing standard views. */ GRAPHF_OPTION_3D_SET_SCENE_ORIGIN, /** [vector] size of the scene, for computing standard views. */ GRAPHF_OPTION_3D_SET_SCENE_SCALE, /** [no params] Add standard 4-views. */ GRAPHF_OPTION_3D_ADD_STANDARD_LIGHTS, /** [no params] Add standard 3 lights. */ GRAPHF_OPTION_3D_ADD_STANDARD_VIEWS, /** [array:Graphf3DLight] Add lights to the scene. */ GRAPHF_OPTION_3D_ADD_LIGHTS, /** [color] Ambient light color and intensity. */ GRAPHF_OPTION_3D_AMBIENT_LIGHT, /** [array:Graphf3DPlaneGridLines] Add floating (straight) lines. */ GRAPHF_OPTION_3D_VIEW_ADD_GRID, /** [data:GraphfAffine3D] Affine transformation to apply to the data * at the display layer (so it will also transform labels etc) */ GRAPHF_OPTION_3D_VIEW_AFFINE, /** [no params] Affine transformation to apply to the data * at the display layer (so it will also transform labels etc). * Scale so that the data fits in [-1,+1]^3. */ GRAPHF_OPTION_3D_VIEW_NORMALIZING_AFFINE, /** [array:Graphf3DSurfaceLines] Add line on the surface of the data. */ GRAPHF_OPTION_3D_DATASET_ADD_SURFACE_LINES, /** [array:Graphf3DSurfaces] Add surfaces to the data. */ GRAPHF_OPTION_3D_DATASET_ADD_SURFACES, /** [data:GraphfAffine3D] Affine transformation to apply to the data. */ GRAPHF_OPTION_3D_DATASET_AFFINE, /* options for describing markers for a scatterplot etc */ /** [color] data marker color. */ GRAPHF_OPTION_3D_DATASET_COLOR, #define _GRAPHF_OPTION_3D_DATASET_FIRST GRAPHF_OPTION_3D_DATASET_ADD_SURFACE_LINES #define _GRAPHF_OPTION_3D_DATASET_LAST GRAPHF_OPTION_3D_DATASET_COLOR /** [boolean] whether the height plot should draw lines. */ GRAPHF_OPTION_SURFACE_PLOT_DRAW_LINES, /** [boolean] whether the height plot should draw lines. */ GRAPHF_OPTION_SURFACE_PLOT_CHECKER, /** [boolean] whether to draw the grids on the non-perspective renderings */ GRAPHF_OPTION_SURFACE_PLOT_ORTHO_GRIDS, /** [int] separation between adjacent lines of constant x */ GRAPHF_OPTION_SURFACE_PLOT_X_SPACING, /** [int] separation between adjacent lines of constant y */ GRAPHF_OPTION_SURFACE_PLOT_Y_SPACING, /** [int] separation between adjacent lines of constant z */ GRAPHF_OPTION_SURFACE_PLOT_Z_SPACING, /** [color] line color for height plot */ GRAPHF_OPTION_SURFACE_PLOT_LINE_COLOR, /** [color] top color for surface in height plot */ GRAPHF_OPTION_SURFACE_PLOT_TOP_COLOR, /** [color] bottom color for surface in height plot */ GRAPHF_OPTION_SURFACE_PLOT_BOTTOM_COLOR, GRAPHF_N_OPTIONS } GraphfOptionType;
struct GraphfOption { GraphfOptionType type; unsigned num; double value; char *str; void *other; /* for large (flat) data ('num' gives byte count) */ };
void graphf_2d_plot_1_v (const char *label, unsigned n_points, const Graphf2DPoint *points, unsigned n_options, const GraphfOption *options);
label: | |
Param2: | |
points: | |
Param4: | |
options: |
void graphf_2d_plot_1 (const char *label, unsigned n_points, const Graphf2DPoint *points, GraphfOptionType first_option, ...);
label: | |
Param2: | |
points: | |
first_option: | |
...: |
void graphf_2d_plot_start (const char *label, GraphfOptionType first_option, ...);
label: | |
first_option: | |
...: |
void graphf_2d_plot_start_v (const char *label, unsigned n_options, const GraphfOption *options);
label: | |
Param2: | |
options: |
void graphf_2d_plot_points (unsigned n_points, const Graphf2DPoint *points, GraphfOptionType first_option, ...);
Param1: | |
points: | |
first_option: | |
...: |
void graphf_2d_plot_points_v (unsigned n_points, const Graphf2DPoint *points, unsigned n_options, const GraphfOption *options);
Param1: | |
points: | |
Param3: | |
options: |
void graphf_2d_plot_vector_field (unsigned n_points, const Graphf2DPointVector *points, GraphfOptionType first_option, ...);
Param1: | |
points: | |
first_option: | |
...: |
void graphf_2d_plot_vector_field_v (unsigned n_points, const Graphf2DPointVector *points, unsigned n_options, const GraphfOption *options);
Param1: | |
points: | |
Param3: | |
options: |
void graphf_2d_plot_any_v (unsigned n_points, unsigned data_size, const void *data, const Graphf2DDataOffsets *offsets, unsigned n_options, const GraphfOption *options);
Param1: | |
Param2: | |
data: | |
offsets: | |
Param5: | |
options: |
void graphf_2d_data_offsets_init (Graphf2DDataOffsets *offsets);
offsets: |
typedef enum { GRAPHF_3D_MARKER_CROSSHAIR, GRAPHF_3D_MARKER_EMPTY_CROSSHAIR, GRAPHF_3D_MARKER_ARROW } Graphf3DMarkerType;
struct Graphf3DCamera { double center[3]; double basis[3][3]; /* [0] is right, [1] is up, [2] is fw */ int is_perspective; /* For perspective cameras, aperature 1 fstop is the ratio ---------------, or ------------------------------ . distance 2 * focal-lengths-per-display For orthogonal cameras, fstop is the ratio world-units per display. */ double fstop; double clip_z; };
struct Graphf3DView { Graphf3DCamera camera; int is_righthanded; /* view data right-handed */ double screen_x_min; /* as fraction of width */ double screen_y_min; /* as fraction of height */ double screen_width; /* as fraction of width */ double screen_height; /* as fraction of height */ };
struct Graphf3DLight { Graphf3DLightType type; double dir[3]; unsigned color; };
void graphf_3d_plot_start (const char *label, GraphfOptionType first_option, ...);
label: | |
first_option: | |
...: |
void graphf_3d_plot_start_v (const char *label, unsigned n_options, const GraphfOption *options);
label: | |
Param2: | |
options: |
void graphf_3d_plot_scatter_v (const Graphf3DPoint *data, unsigned n_options, const GraphfOption *options);
data: | |
Param2: | |
options: |
void graphf_3d_plot_heights_v (unsigned n_rows, unsigned n_cols, const double *data, double x_offset, double x_scale, double y_offset, double y_scale, unsigned n_options, const GraphfOption *options);
Param1: | |
Param2: | |
data: | |
x_offset: | |
x_scale: | |
y_offset: | |
y_scale: | |
Param8: | |
options: |
void graphf_3d_plot_heights (unsigned n_rows, unsigned n_cols, const double *data, double x_offset, double x_scale, double y_offset, double y_scale, GraphfOptionType first_options, ...);
Param1: | |
Param2: | |
data: | |
x_offset: | |
x_scale: | |
y_offset: | |
y_scale: | |
first_options: | |
...: |
void graphf_3d_plot_grid_v (unsigned n_rows, unsigned n_cols, const Graphf3DPoint *data, double x_offset, double x_scale, double y_offset, double y_scale, unsigned n_options, const GraphfOption *options);
Param1: | |
Param2: | |
data: | |
x_offset: | |
x_scale: | |
y_offset: | |
y_scale: | |
Param8: | |
options: |
struct Graphf3DDataOffsets { /* offsets are in bytes */ int x, y, z; int vx, vy, vz; int value; int color; };
void graphf_3d_data_offsets_init (Graphf3DDataOffsets *offsets);
offsets: |
void graphf_3d_plot_any_v (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const void *data, const Graphf3DDataOffsets *offsets, unsigned n_options, const GraphfOption *options);
Param1: | |
Param2: | |
Param3: | |
Param4: | |
data: | |
offsets: | |
Param7: | |
options: |
void graphf_3d_plot_any (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const void *data, const Graphf3DDataOffsets *offsets, GraphfOptionType first_option, ...);
Param1: | |
Param2: | |
Param3: | |
Param4: | |
data: | |
offsets: | |
first_option: | |
...: |
void graphf_3d_plot_surface_v (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const double *xyz_offset, const double *xyz_scale, unsigned axis, const void *data, const Graphf3DDataOffsets *offsets, unsigned n_options, const GraphfOption *options);
Param1: | |
Param2: | |
Param3: | |
Param4: | |
xyz_offset: | |
xyz_scale: | |
Param7: | |
data: | |
offsets: | |
Param10: | |
options: |
void graphf_3d_plot_surface (unsigned data_size, unsigned n_z_rows, unsigned n_y_rows, unsigned n_x_rows, const double *xyz_offset, const double *xyz_scale, unsigned axis, const void *data, const Graphf3DDataOffsets *offsets, GraphfOptionType first_option, ...);
Param1: | |
Param2: | |
Param3: | |
Param4: | |
xyz_offset: | |
xyz_scale: | |
Param7: | |
data: | |
offsets: | |
first_option: | |
...: |
void graphf_3d_plot_point_surface_v (unsigned n_rows, unsigned n_cols, const Graphf3DPoint *data, unsigned n_options, const GraphfOption *options);
Param1: | |
Param2: | |
data: | |
Param4: | |
options: |
void graphf_3d_plot_point_surface (unsigned n_rows, unsigned n_cols, const Graphf3DPoint *data, GraphfOptionType first_option, ...);
Param1: | |
Param2: | |
data: | |
first_option: | |
...: |
void graphf_3d_view_init (Graphf3DView *view, const double *look_at, const double *forward, const double *upward, double distance, double focal_length, int is_perspective);
view: | |
look_at: | |
forward: | |
upward: | |
distance: | |
focal_length: | |
is_perspective: |
void graphf_3d_view_rotate (Graphf3DView *view, const double *center_of_rot, const double *axis_and_mag, int camera_relative);
view: | |
center_of_rot: | |
axis_and_mag: | |
camera_relative: |
void graphf_3d_view_move (Graphf3DView *view, const double *delta, int camera_relative);
view: | |
delta: | |
camera_relative: |
void graphf_3d_view_set_window (Graphf3DView *view, double x, double y, double width, double height);
view: | |
x: | |
y: | |
width: | |
height: |
void graphf_3d_camera_world_to_local (const Graphf3DCamera *camera, double *out, const double *in);
camera: | |
out: | |
in: |
void graphf_3d_camera_world_to_local_vector (const Graphf3DCamera *camera, double *out, const double *in);
camera: | |
out: | |
in: |
void graphf_3d_camera_local_to_screen (const Graphf3DCamera *camera, double *out, const double *in, unsigned output_width, unsigned output_height);
camera: | |
out: | |
in: | |
Param4: | |
Param5: |
void graphf_3d_camera_xydepth_to_world (const Graphf3DCamera *camera, double *world_coord_out, double x, double y, double depth, double width, double height);
camera: | |
world_coord_out: | |
x: | |
y: | |
depth: | |
width: | |
height: |
void graphf_3d_camera_local_to_world (const Graphf3DCamera *camera, double *world_coord_out, const double *local_coords);
camera: | |
world_coord_out: | |
local_coords: |
void graphf_3d_camera_get_camera_relative_ray_from_pixel (const Graphf3DCamera *camera, double pixel_x, double pixel_y, double width, double height, double *ray_offset_out, double *ray_dir_out);
camera: | |
pixel_x: | |
pixel_y: | |
width: | |
height: | |
ray_offset_out: | |
ray_dir_out: |
<< graphf-rgb | Graphf: Widget Library >> |