Skip to main content

core.vg - Vector Graphics Core

vg

vg {
new
# new paths[] -> vg0
end;

get
# vgo -> oid

vg0add.path
# path

new.path0
# vg0, type, points.count, indices.count

vg.dump
# fmt, vg0
};

vg.vec2d

2D vector library formula

Interface vg.vec2d

vg.vec2d {
pointv
# vg0, x,y
line
# vg0, x0,y0, x1,y1
tri
# vg0, x0,y0, x1,y1, x2,y2
rect
# vg0, x,y, w,h
quad
# vg0, x0,y0, x1,y1, x2,y2, x3,y3
circle
# vg0, cx,cy, r, segs
star
# vg0, cx,cy, r.in, r.out, n
spiral
# vg0, cx,cy, r.in, r.out, loops, segs
};
vg.vec2d.pointv(vg0, x,y);
vg.vec2d.line(vg0, x0,y0, x1,y1);
vg.vec2d.tri(vg0, x0,y0, x1,y1, x2,y2);
vg.vec2d.rect(vg0, x,y, w,h);
vg.vec2d.quad(vg0, x0,y0, x1,y1, x2,y2, x3,y3);
vg.vec2d.circle(vg0, cx,cy, r, segs);
vg.vec2d.star(vg0, cx,cy, r.in, r.out, n);
vg.vec2d.spiral(vg0, cx,cy, r.in, r.out, loops, segs);

vg.curve3d

3D curve library formula

Import core.vg formulas

_ @1010;
_ @1100;
_ @core.vg;
_ @core.vg.vec2d.draw;
_ @core.vg.curve3d;
_ @core.vg.curve3d.draw;

Interface vg.vec2d

vg.curve3d {

new
# vg0

# Use curve for operation. Selects dma
use
# vg0

# Add new point
add
# x,y,z, d0,d1, p0,p1,p2,p3

set.shader
# vsh,fsh

};

vg.curve3d {

# Generators

gen.path0
# p
gen.rect0
# p

# Shaders

shader.default;
shader.simple1;

};

vg.curve3d.move.points0
# v0


Example

vg0:=vg.new;

curve0:=vg.curve3d.new(vg0);

# add point
add {
vg.curve3d.use(curve0);
vg.curve3d.add(_0,_1,_2, _3,_4, _5, _6,_7,_8);
};

Draw formula

### draw

vg.vec2d.draw(vg0);