B.3 JSON format

MathGL can save points and primitives of 3D object. It contain a set of variables listed below.

width

width of the image;

height

height of the image

depth

depth of the image, usually =sqrt(width*height);

npnts

number of points (vertexes);

pnts

array of coordinates of points (vertexes), each element is array in form [x, y, z];

nprim

number of primitives;

prim

array of primitives, each element is array in form [type, n1, n2, n3, n4, id, s, w, p, z, color].

Here type is kind of primitive (0 - mark, 1 - line, 2 - triangle, 3 - quadrangle, 4 - glyph), n1...n4 is index of point for vertexes and n2 can be index of glyph coordinate, s and w are size and width if applicable, z is average z-coordinate, id is primitive identification number, p is scaling factor for glyphs.

ncoor

number of glyph positions

coor

array of glyph positions, each element is array in form [dx,dy]

nglfs

number of glyph descriptions

glfs

array of glyph descriptions, each element is array in form [nL, [xP0, yP0, xP1, yP1 ...]]. Here nL is the number of line vertexes; and xP, yP, xQ, yQ are coordinates of lines. Line coordinate xP=0x3fff, yP=0x3fff denote line breaking.