How To Draw A Reuleaux Triangle
Here is a pocket-sized Metapost function to draw a general Reuleaux polygon. Explanations below.
prologues := 3; outputtemplate := "%j%c.eps"; vardef reuleaux(expr n) = for t=0 step 360/n until 359: 1/2 upward rotated t { left rotated (t+90/north) } .. { left rotated (t+270/n)} endfor bike enddef; beginfig(1); for i := 3 step 2 until 9: draw reuleaux(i) scaled 40i withcolor .6 carmine withpen pencircle scaled 1; describe fullcircle scaled 40i withcolor .six white; endfor endfig; end.
Calibration, rotate, shift as required. It'southward sized and then that information technology fits inside a fullcircle
scaled to the same amount.
Each corner is a indicate
of the path, and then if you want to join the vertices, bring together points 0, 1, ..., n-1
; if you want the mid-points of each arc, utilise points i/2, 3/ii, ..., n-i/2
, like this:
beginfig(two); path t[]; for n := 3 upto 7: t[due north] = reuleaux(due north) scaled 60 shifted (75n,0); fill t[n] withcolor carmine+0.75green+0.2blue; draw for i = 0 upto north-one: point i of t[n] -- endfor wheel withcolor .half dozen red; draw for i = 0 upto n-i: point i+i/2 of t[n] -- endfor bicycle withcolor .vi blue; endfor endfig;
Obviously, you also could pick out points to label likewise.
beginfig(3); path t; t = reuleaux(three) scaled 90; draw t withcolor .half-dozen red; dotlabel.top (btex $A$ etex, point 0 of t); dotlabel.llft(btex $B$ etex, point one of t); dotlabel.lrt (btex $C$ etex, point 2 of t); endfig;
Explanations
I've revised this answer a couple of times, as I idea almost the trouble a fleck more. The original versions used buildcycle
and the pre-defined circular paths, simply they are not really needed. The terminal version here is a simple and correct equally I tin make it.
The reuleaux(n)
function returns a path
with n vertices connected by circular arcs, whose radius is the length of the longest diagonal of the corresponding regular polygon.
To understand what information technology does, consider kickoff the post-obit function that returns the path of a regular polygon with northward vertices:
vardef polygon(expr n) = for t=0 step 360/n until 359: up rotated t -- endfor cycle enddef;
up
expands to (0,ane)
, then with northward=three this function expands to
(0,1) -- (-0.866,-0.5) -- (0.866,-0.5) -- cycle
equally required for a three-sided regular polygon fitting inside a circle of unit radius. In Metapost however the predfined fullcircle
path has unit diameter so for consistency it would be ameliorate to scale our polygon down by i/2,
vardef polygon(expr n) = for t=0 stride 360/north until 359: 1/two up rotated t -- endfor bike enddef;
The precedence rules in MP hateful that 1/2 up
expands to (0,0.five)
which is what we want.
At present we have a regular polygon that fits inside a fullcircle
and to make it into a Reuleaux polygon we have to bend the straight lines into arcs centred on the reverse vertex (or the mid-indicate of the opposite vertices when n is even). We can do this using the path direction notation, and irresolute --
into ..
to allow the path to bend.
vardef reuleaux(expr n) = for t=0 step 360/n until 359: 1/2 upwards rotated t { left rotated (t+xc/northward) } .. { left rotated (t+270/n)} endfor wheel enddef;
Since left
is up rotated xc
, the required directions are given by the formulae shown, as y'all can piece of work out with a little elementary geometry:
If you lot want to convince yourself that the resulting arcs really are round and have the correct centres then describe accordingly scaled and shifted circles on elevation. The radius of such a circle would exist the length of the longest diagonal on the polygon - AC in the effigy above - which you tin discover with length (indicate (n+i)/2 of r - point 0 of r)
where r=reuleaux(due north)
.
Applications
The Reuleaux triangle features in some traditional geometric patterns, like this one:
which we can draw like this: (if there's a better way to do the tiling, please comment!)
beginfig(6); path t, ring; south := 10; t = reuleaux(3) scaled s; ring = for i=0 upto five: subpath(-one,1) of t shifted (0,s) rotated (i*lx) .. endfor cycle; pair beginning; for i=0 upto five: dx := 0; for j=0 upto xiii: outset := (3*s,0) rotated (xxx*(j modernistic two*ii-1)); dx := dx + xpart first; dy := 3*i*s + 1/ii ypart first; draw ring shifted (dx,dy) withcolor (.5,.7,.9); endfor endfor endfig;
This may grade the basis for other explorations. For example just changing the definition of t
to t = reuleaux(2) scaled south
produced this rather wonderful pattern.
Variations
If you want a Reuleaux polygon pointing right instead of up, and then yous just have to swap up
and left
in the definition for right
and up
.
vardef reuleaux(expr n) = for t=0 step 360/north until 359: 1/2 correct rotated t { up rotated (t+ninety/n) } .. { upwards rotated (t+270/n)} endfor bike enddef; beginfig(7); for northward=3 upto seven: describe fullcircle scaled threescore shifted (75n,0) withcolor .8 white; draw reuleaux(n) scaled sixty shifted (75n,0) withcolor .67 scarlet; endfor endfig;
This is slightly more than consistent with evidently MP as point 0 of these shapes corresponds to null degrees rotation. They expect similar this:
Nosotros tin also swap the two directions in the definition to produce what might be called anti-Reuleaux polygons.
vardef antireuleaux(expr n) = for t=0 step 360/n until 359: 1/two right rotated t { up rotated (t+270/n) } .. { upward rotated (t+ninety/n)} endfor cycle enddef;
As you lot can see below, these anti-shapes are similar to, but subtly differ from, hypocycloid curves.
vardef hypocycloid(expr k) = for t=0 pace 1 until 360: bespeak 0 of (fullcircle scaled (one/k) rotated (-t*grand) shifted (i/two right scaled (1-ane/k))) rotated t -- endfor cycle enddef;
Information technology is as well possible to round the corners of a Reuleaux polygon while withal retaining the constant width property. Here is a role to produce a rounded shape that takes a slightly more generalized approach. The first parameter is the number of sides, the 2d is the radius of the rounded corners as a fraction of the width.
vardef polygon(expr north) = for t=0 step 360/north until 359: 1/2 right rotated t -- endfor wheel enddef; vardef rounded_reuleaux(expr n, due south) = salvage chiliad, a, b, p; m := (due north+1)/ii; pair a,b; path p; p := polygon(due north); for i = 0 upto n-1: hide( a := point i of p - point i+thou of p; b := point i+1 of p - point i+m of p; ) bespeak i of p + s*unitvector(a) { upwards rotated angle a } .. signal i+1 of p + due south*unitvector(b) { up rotated angle b } .. endfor bicycle enddef; beginfig(8); for n := iii upto vii: fill up rounded_reuleaux(n,one/six) scaled 60 shifted (85n,0) withcolor (one/two,iii/4,five/6); draw reuleaux(n) scaled 60 shifted (85n,0); endfor
Source: https://tex.stackexchange.com/questions/160539/drawing-a-reuleaux-triangle
Posted by: olsongrins1936.blogspot.com
0 Response to "How To Draw A Reuleaux Triangle"
Post a Comment