Skip to content

Instantly share code, notes, and snippets.

View santhoshtr's full-sized avatar
👷‍♂️
Work in progress

Santhosh Thottingal santhoshtr

👷‍♂️
Work in progress
View GitHub Profile
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
hsv_colors #metapost-sandbox
% based on https://tug.ctan.org/info/drawing-with-metapost/Drawing-with-Metapost.pdf
vardef hsv_color(expr h, s, v) =
save chroma, hh, x, m;
chroma = v * s;
hh = h / 60;
x = chroma * (1 - abs(hh mod 2 - 1));
m = v - chroma;
if hh < 1: (chroma,x,0)+(m,m,m)
elseif hh < 2: (x,chroma,0)+(m,m,m)
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
Scratch #metapost-sandbox
beginfig(0);
width:=100;
rotation:=45;
pen calligraphicpen ;
calligraphicpen := makepen ((0, 0)--(width,0 ) rotated rotation) ;
z0 = (x1+150, 0);
z1 = (0, y0+250);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
അപാരത - IV Sasi #metapost-sandbox
input plain_ex;
input mpcolornames;
beginfig(0);
p:=0;
thick:= 100;
thin:= thick*0.5;
rotation:=-30;
vardef elliptical_nib = fix_nib(thick, thin, rotation) enddef;
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
മല - Calligraphy style #metapost-sandbox
beginfig(0);
nib_width:=100;
nib_thick:=5;
rotation:=45;
pen calligraphypen;
path p;
z0 = (-nib_width/2,0);
z1 = (x0, nib_thick);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
Calligraphic pen - Razor nib with small thickness #metapost-sandbox
beginfig(0);
nib_width:=100;
nib_thick:=10;
rotation:=40;
pen mypen;
path p;
z0 = (-nib_width/2,0);
z1 = (x0, nib_thick);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
Malayalam Ra using Pen Circle #metapost-sandbox
beginfig(0);
width:=500;
height:=500;
z0 = (x1 + 0.25width, 0);
z1 = (0, y0+height/2);
z2 = (x1 + width/2, y1+height/2);
z3 = (x2 + width/2, y1);
z4 = (x3 - 0.25width, y0);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
SMC Logo #metapost-sandbox
input mpcolornames;
beginfig(0);
radius := 350;
pickup pencircle scaled 10;
path p;
path s,l;
z0 = (0, radius);
z1 = ((x0+x2)/2, y0+radius);
z2 = (x1+radius, y0);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
SMC Logo #metapost-sandbox
input mpcolornames;
beginfig(0);
radius := 350;
pickup pencircle scaled 10;
path p;
path s,l;
z0 = (0, radius);
z1 = ((x0+x2)/2, y0+radius);
z2 = (x1+radius, y0);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
The Anatomy of a Smilie #metapost-sandbox
beginfig(0);
radius := 50;
pickup pencircle scaled 2;
path p;
path s, second;
z0 = (0, radius);
z1=((x0+x2)/2,y0+radius);
z2 = (x1+radius,y0);
@santhoshtr
santhoshtr / main.mp
Created February 13, 2026 10:04
The Anatomy of a Smilie #metapost-sandbox
beginfig(0);
radius := 50;
pickup pencircle scaled 2;
path p;
path s, second;
z0 = (0, radius);
z1=((x0+x2)/2,y0+radius);
z2 = (x1+radius,y0);