Zymplectic project

Documentation

Summary of built-in functions, essential features and limitations.

Documentation is currently incomplete

Built-in functions

Zymplectic contains a range of built-in functions and variables. The functions are found in the Z struct and the draw struct. Zymplectic's built-in functions provide no safety. Memory access violations may cause the application to shut down without notification.

Z is a struct that contains functions and variables specifying the differential equations, energies and settings
Z-functions Comment
Z.H(double *E, void *dE, int a)
Z.H(double *E, void *dE, int a , int b)
Declares a Hamiltonian system associated with object a (and b)

E is an energy function of type double E(void) that returns the energy. nullptr can be passed as argument to ignore the energy.

dE is the gradient function of type void dE(void) defining the differential equations

If system only depends on a single variable, b can be omitted
Z-variables Comment
draw is a struct that contains functions simplifying the use of OpenGL graphical functions
draw-functions Comment
draw.track_add(double x, double y) add value to pixel at position
draw.track_set(double x, double y, int a) set value to pixel at position x,y to a
draw.sphere(double x, double y, double z, double r) draw a sphere at x,y,z with radius r
If 2D, draws a filled circle ignoring depth
draw.lines(double* X, double* Y, int a)
draw.lines(double* X, double* Y, double* Z, int a)
draw lines based on coordinate arrays X,Y,(Z) each with specified length a. The number of lines drawn is a/2
draw.points(double* X, double* Y, int a)
draw.points(double* X, double* Y, double* Z, int a)
draw points based on coordinate arrays X,Y,(Z) each with specified length a. The number of points drawn is a
draw.line_strip(double* X, double* Y, int a)
draw.line_strip(double* X, double* Y, double* Z, int a)
draw lines between each coordinate based on coordinate arrays X,Y,(Z) each with specified length a. The number of lines drawn is a-1
draw.quads(double* X, double* Y, int a)
draw.quads(double* X, double* Y, double* Z, int a)
draw filled quads between every four coordinates based on coordinate arrays X,Y,(Z) each with specified length a. The number of quads drawn is a/4
draw.polygon(double* X, double* Y, int a)
draw.polygon(double* X, double* Y, double* Z, int a)
draw filled polygon based on coordinate arrays X,Y,(Z) each with specified length a
draw.triangles(double* X, double* Y, int a)
draw.triangles(double* X, double* Y, double* Z, int a)
draw filled triangles based on coordinate arrays X,Y,(Z) each with specified length a. The number of triangles drawn is a/3
draw.spring(double x1, double y1, double x2, double y2, double r)
draw.spring(double x1, double y1, double z1, double x2, double y2, double z2, double r)
draw a spring between x1,y1,(z1) and x2,y2,(z2) with radius r
draw.rod(double x1, double y1, double z1, double x2, double y2, double z2, double r)
draw.rod(double x1, double y1, double z1, double x2, double y2, double z2, double r, double a, int n)
draw a cylinder between x1,y1,z1 and x2,y2,z2 with radius r, optional rotation in radian a (default 0) and edge count n (default 64)
If 2D, draw a cylinder ignoring depth
draw.hrod(double x1, double y1, double z1, double x2, double y2, double z2, double r, double ri)
draw.hrod(double x1, double y1, double z1, double x2, double y2, double z2, double r, double ri, double a, int n)
draw a hollow cylinder between x1,y1,z1 and x2,y2,z2 with radius r, inside radius ri, optional rotation in radian a (default 0) and edge count n (default 64)
If 2D, draw a hollow cylinder ignoring depth
draw.text(double x,double y,char* A, int a)
draw.text(double x,double y, double z, char* A, int a)
write text at position x,y,(z) specified by text array A with array length a
draw.textscreen(double x,double y,char* A, int a) write text at screen pixel coordinates specified by text array A with array length a. Note that coordinate 0,0 is center and default resolution is 768x768 (range -384 to 384)
draw.rgb(double r, double g, double b)
draw.rgb(double r, double g, double b, double a)
assign color red r, green g, blue b and optionally alpha a (default 1) for drawn objects to ranging from 0 to 1
draw.shine(double a, double b) assign specular a and shininess b for drawn objects ranging from 0 to 1. If 2D, has no effect

Built-in natives and reserved variables