Haversine: Turtle Graphics (Logo) on a Sphere

srean1 pts0 comments

Haversine: Logo on a sphere

Run<br>Share<br>Reset<br>Back to mewo2.com

; Welcome to Haversine!<br>; Haversine is a dialect of Logo based around spherical geometry. You<br>; can use the following commands (all units are in degrees):<br>; fd bk lt rt<br>; penup pendown clear<br>; sin cos tan asin acos atan<br>; For variables, control flow, you can use, e.g.<br>; if :x > 0 [fd 100] [fd 50]<br>; repeat 3 [fd 90 rt 90]<br>; to square :x<br>; output :x ^ 2<br>; end<br>; let :y (square :x)<br>; Some useful extra builtins, because spheres are hard:<br>; (dihedral :p :q) returns the dihedral angle for a polyhedron<br>; that has p faces meeting at a vertex, each with q sides<br>; (polyangle :n :side) returns the turn angle for a regular<br>; n-gon with sides of length side

to dodec<br>let :d (dihedral 5 3)<br>repeat 5 [<br>repeat 5 [fd :d lt 60<br>fd :d rt 60]<br>fd :d rt 60]<br>end

clear<br>dodec

Sharing URL:

Done

haversine logo repeat dihedral sphere clear

Related Articles