May 13, 2018
Description
Curv is a programming language for creating art using mathematics. It's a 2D and 3D geometric modelling tool that supports full colour, animation and 3D printing.
https://github.com/doug-moen/curv
Playing around with my new capcone primitive
let
capcone ( p1 , p2 ) =
let a=p1[[X,Y,Z]];
b=p2[[X,Y,Z]];
d1=p1[3];
d2=p2[3];
ba = b - a;
in make_shape {
dist p =
let
pa = p[[X,Y,Z]] - a;
h = clamp(dot(pa,ba) / dot(ba,ba), 0, 1);
d=lerp(d1,d2,smoothstep(0,1,h));
r = d / 2;
in mag(pa - ba*h) - r;
bbox = [min(a-max(d1,d2),b-max(d1,d2)), max(a+max(d1,d2),b+max(d1,d2))];
is_3d = true;
};
in
union(
capcone ((0,0,0,1),(10,0,0,4)),
capcone ((0,5,0,2),(10,5,0,2)),
capcone ((0,10,0,3),(10,10,0,0)),
capcone ((0,15,0,4),(10,15,0,5)),
)
License:
Creative Commons - Attribution