texlive[72705] Master/texmf-dist/doc/metapost/drawing-with-metapost:
commits+karl at tug.org
commits+karl at tug.org
Wed Oct 30 21:00:04 CET 2024
Revision: 72705
https://tug.org/svn/texlive?view=revision&revision=72705
Author: karl
Date: 2024-10-30 21:00:04 +0100 (Wed, 30 Oct 2024)
Log Message:
-----------
drawing-with-metapost (30oct24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/Drawing-with-Metapost.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/README.md
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/Drawing-with-Metapost.tex
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/basedate.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/clocks.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blend-toy.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-bathymetric.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-bathymetric.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-gamut.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-gamut.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-macro.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid-family.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid-family.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cardioid-construction.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cardioid-construction.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-tangents.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-tangents.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-limacon-simple.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-limacon-simple.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola-directrix.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola-directrix.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-archimedes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-archimedes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-equiangular.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-sq.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-sq.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-trig.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-trig.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dwmpcode.sty
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-357.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-357.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-five-better.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-five-better.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-four-point.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-four-point.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-fried.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-fried.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-gold.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-gold.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-moss.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-perfect.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-perfect.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-shaded.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-shaded.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-super.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-super.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-thom.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-addition-of-sines.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-addition-of-sines.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-epi-v-pie.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-epi-v-pie.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-exponential.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-exponential.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-lemniscate.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-maurer-rose.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-maurer-rose.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-parametric.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-parametric.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-pulse.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-pulse.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-reflection.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-sines.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-sines.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-stress.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-triangles-on-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-triangles-on-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh-open.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh-open.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels-tte.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/picture_frame.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-circumcircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-circumcircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-through.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-through.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-shapes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-shapes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-red-blue.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-red-blue.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-bush.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-bush.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon-golden.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon-golden.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake-construction.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake-construction.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree-deviate.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree-deviate.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-h-tree.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-h-tree.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-koch-steps.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-koch-steps.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-triangle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-triangle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-simple-tree.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-simple-tree.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rope.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-cm.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-inch.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-hex-trig.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-hex-trig.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-k.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-k.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-simple.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-simple.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-budget.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-budget.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-currency.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-currency.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-mpg.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-mpg.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/workflow-plain.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/workflow-plain.pdf
Added Paths:
-----------
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/automatic-grid.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/listex.py
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-reference-grid.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-common.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-5mm.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-cm.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-inch.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-other-distributions.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-gcd-comparison.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/show_name.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-procedures.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hex-parts.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pinwheel-macro.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trigonometry-functions.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-manila-paper.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-snow.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-snow.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-srm-damage.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-srm-damage.pdf
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/angles-lines.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/angles-lines.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/apollonius.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/apollonius.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arbelos.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arbelos.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-3-4.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-3-4.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-6-4.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-6-4.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-6-12.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-6-12.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8-parts.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8-parts.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hexagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hst.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hst.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hex-parts.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon-unit.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon-unit.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-square.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-square.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-square.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-triangle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedean-tools.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/area-under-graph.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/area-under-graph.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/axis-of-similitude.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/axis-of-similitude.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-euclidean.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-euclidean.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-interior.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-interior.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-vector.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-vector.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/blended-color-circles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/blended-color-circles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border-dashed.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border-shadow.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/braces.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/braces.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brachisto.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brachisto.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brexit-map.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brexit-map.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brown3a.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/callout.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/callout.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/circumcircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/circumcircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-antireuleaux-set.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-antireuleaux-set.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-fixed-polygon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-fixed-polygon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-points.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-points.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-chain.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-chain.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-tops.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-tops.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygons.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygons.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-geometry.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-geometry.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-set.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-set.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-standards.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-standards.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-triangles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-triangles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/compass-rose.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-inverse-and-sqrt.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-inverse-and-sqrt.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-operators.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-operators.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/conway.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/conway.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/corners.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/corners.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-code.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra-code.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/desargues.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/desargues.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dice.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dice.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-angle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-angle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-dragon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-dragon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/draw-picture.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/draw-picture.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/drawing-circles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/drawing-circles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dynamic-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dynamic-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/escher.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/escher.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/euler-sampler.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/euler-sampler.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/excircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/excircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/explode.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/explode.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/fake-transparency.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/fake-transparency.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gaussian.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gaussian.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gons.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gons.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/graph-paper.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/graph-paper.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-default-encoding.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-default-encoding.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-gfs-encoding.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-gfs-encoding.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-homer.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-homer.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/icosahedron.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/icosahedron.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/incircle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/incircle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-annotated.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-annotated.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-AB-or-BA.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-AB-or-BA.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-algorithm.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-algorithm.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-all-three.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-all-three.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-only-two.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-only-two.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/line-caps-and-joins.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/line-caps-and-joins.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/linear-graph.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/linear-graph.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/little-hexagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/little-hexagon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/magic-square-14.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/magic-square-14.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo-with-grid.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-pitfall.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-pitfall.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-sallows.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-sallows.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-shapes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-shapes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/minus.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/minus.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/multi-line-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/multi-line-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/nine-point-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/nine-point-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/numbered-axes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/numbered-axes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/open-triangle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/open-triangle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-default-fillers.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-default-fillers.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-missing-filler.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-missing-filler.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/parallel.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/parallel.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-P3.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-P3.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-stages.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-stages.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pinwheel.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pinwheel.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/plain-axes.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/plain-axes.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pole-and-polar.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pole-and-polar.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/porson.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/porson.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections-code.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/qed.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/qed.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/radical-axis.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/radical-axis.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-function.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-function.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-selection.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-selection.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-pentagon.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-pentagon.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-pt.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn-code.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shadows.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shadows.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shady-circles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shady-circles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-circle-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-circle-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-number-line.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-number-line.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/split-labels.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/split-labels.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times-on-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times-on-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-on-path.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-on-path.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-point-to-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-point-to-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-exterior.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-exterior.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-interior.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-interior.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tikzcd-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tikzcd-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-circle.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-circle.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-straight.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-straight.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-classical.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-classical.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-simple.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-simple.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-triangles.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-triangles.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/twister.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/twister.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/unicode.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/unicode.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/utf8.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/utf8.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/verbatim-listing.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/verbatim-listing.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/verbatim-with-infont.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/verbatim-with-infont.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/whatever.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/whatever.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/xypic-example.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/xypic-example.pdf
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/youth.mp
trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/youth.pdf
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/Drawing-with-Metapost.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/README.md 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/README.md 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,37 +1,45 @@
# Drawing-with-Metapost
+Toby Thurston -- 31 Oct 2024
+
This project provides a document that discusses how to draw technical diagrams
-with John Hobby's Metapost language. It includes over 200 illustrations
-created with Metapost, complete with source code as inspiration and examples.
-The intended level is for intermediate to advanced users rather than complete
-beginners. For introductions, tutorials, and other articles about Metapost,
-see http://www.tug.org/metapost.html
+with John Hobby's Metapost language. It includes over 200 illustrations created
+with Metapost, complete with source code as inspiration and examples. The
+intended level is for intermediate to advanced users rather than complete
+beginners. For introductions, tutorials, and other articles about Metapost, see
+http://www.tug.org/metapost.html
-Start with "Drawing-with-Metapost.pdf" in the top directory.
+Start with `Drawing-with-Metapost.pdf` in the top directory.
The `src` directory contains
- the TeX source for the main document
- the style file used for marking up Metapost source code
- the Metapost source for each illustration used in the main document
-- the corresponding PDF file created from the MP source
+- the corresponding PDF files created from each MP source file
+The text includes a discussion of the techniques used for drawing the
+illustrations, and includes complete or partial listings for most of them.
+These listings are included directly from the source code used, so in all cases
+the output should exactly match what you see on the page.
+
You might like to read the main document first, but you might also like to
-browse through the PDFs in the src directory, and when you find one that is
+browse through the PDFs in the `src` directory, and when you find one that is
interesting, have a look at the corresponding MP source file. There is a
one-to-one match between the PDF names and the MP source names, so
-"apollonius.pdf" is created from "apollonius.mp". The src directory contains
-a few drawings that are not (yet) included in the main document.
+`geometry-apollonius.pdf` is created from `geometry-apollonius.mp`. The `src`
+directory contains a few drawings that are not included in the main document.
To update the main PDF document I follow these steps
- build any new or updated Metapost source files with `lualatex` to create PDFs in the src directory
-- build the main tex file with `lualatex -output-directory=.. -recorder Drawing-with-Metapost`
-- run a Python script to read the .fls and `git add` all the files used
+- build the main tex file with `lualatex -recorder Drawing-with-Metapost`
+- run a Python script to read the `.fls` and `git add` all the files used
- git commit and push
-Toby Thurston -- 14 Apr 2023
+If you find any errors, or have any suggestions for improvement, please raise an
+issue or submit a pull request on Github.
-Copyright (c) 2023 by Toby Thurston. This material may be distributed only
+Copyright (c) 2024 by Toby Thurston. This material may be distributed only
subject to the terms and conditions set forth in the Open Publication License,
v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/Drawing-with-Metapost.tex
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/Drawing-with-Metapost.tex 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/Drawing-with-Metapost.tex 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,14 +1,18 @@
-% Copyright (c) 2023 by Toby Thurston. This material may be distributed only
+% Copyright (c) 2024 by Toby Thurston. This material may be distributed only
% subject to the terms and conditions set forth in the Open Publication License,
% v1.0 or later (the latest version is presently available at
% http://www.opencontent.org/openpub/).
+
+\loop\iftrue
+\errmessage{This manual is copyrighted and should not be compiled as is.}
+\repeat
\documentclass[a4paper,landscape]{article}
\usepackage{luamplib}
\mplibtextextlabel{enable}
+\everymplib{beginfig(0);} \everyendmplib{endfig;}
\usepackage{fontspec}
\newfontfamily{\demo}{TeX Gyre Pagella}
\DeclareTextFontCommand{\textdemo}{\demo}
-\usepackage{unicode-math}
\usepackage[inner=1in,textwidth=5in,textheight=6in, marginparsep=0.5in, marginparwidth=4.2in]{geometry}
\usepackage{sectsty}
\allsectionsfont{\normalfont\sffamily\bfseries}
@@ -17,34 +21,45 @@
\def\mfbook{\textsl{The \MF\kern1pt book}}
\def\texbook{\textsl{The \TeX\kern1pt book}}
\usepackage{shortvrb}\MakeShortVerb{"}
+\usepackage{enumitem}
\usepackage{dwmpcode}
\title{Drawing with Metapost}
\author{Toby Thurston}
-\date{March 2017 – April 2023}
+\date{March 2017 – October 2024}
\overfullrule=2pt
-\def\kw#1{\begingroup\def\_{\kern.04em
- \vbox{\hrule width.3em height .6pt}\kern.08em}%
-\ifmmode\mathop{\textbf{#1}}\else\hbox{\bf#1\/}\fi\endgroup}
-\def\op#1{\begingroup\def\_{\kern.04em
- \vbox{\hrule width.3em height .6pt}\kern.08em}%
-\ifmmode\mathop{\textrm{#1}}\else\hbox{\rm#1\/}\fi\endgroup}
-\def\id#1{\begingroup\def\_{\kern.04em
- \vbox{\hrule width.3em height .6pt}\kern.08em}%
-\ifmmode\mathop{\textit{#1}}\else\hbox{\it#1\/}\fi\endgroup}
-\def\cycle{{\rm cycle}}
+\def\kw#1{\begingroup\def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
+\ifmmode\mathop{\textbf{#1}}\else\textbf{#1}\fi\endgroup}
+\def\op#1{\begingroup\def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
+\ifmmode\mathop{\textrm{#1}}\else\textrm{#1}\fi\endgroup}
+\def\id#1{\begingroup\def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
+\ifmmode\mathop{\textit{#1}}\else\textit{#1}\fi\endgroup}
+\def\cycle{\textrm{cycle}}
\def\vpic#1#2{\moveright5.5in\vbox to 0pt{\hsize4in\vskip#1\centerline{\includegraphics{#2}}\vss}}
\def\mpic#1#2{\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip#1\centerline{\includegraphics{#2}}\vss}}}
+\def\mwpic#1#2{\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip#1\centerline{\includegraphics[width=4in]{#2}}\vss}}}
\def\mnote#1#2{\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip#1\noindent #2\par\vss}}}
-\def\mwpic#1#2{\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip#1\centerline{\includegraphics[width=4in]{#2}}\vss}}}
-\def\mxpic#1#2#3{\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip#1\centerline{\includegraphics[width=#2]{#3}}\vss}}}
-\def\nb{$\vcenter{\begin{mplibcode}beginfig(1);
+\def\nb{$\vcenter{\begin{mplibcode}
for t=0 upto 3: fill unitsquare scaled 4 shifted right shifted up rotated 45 rotated 90t;
-endfor currentpicture := currentpicture scaled 1/2; endfig;\end{mplibcode}}$\ }
+endfor currentpicture := currentpicture scaled 1/2; \end{mplibcode}}$\ }
\def\unit#1{\ifmmode\,\else\thinspace\fi\hbox{#1}}
\def\to{\mathrel{\ldotp\ldotp}}
\def\<#1>{\ensuremath{\langle\hbox{#1}\rangle}}
-\newfontface\ding{Zapf Dingbats}
-\def\hey{\llap{\ding ☞\ }}
+\usepackage{pifont}
+\def\hey{\llap{{\ding{43}}\ }}
+\newcommand\fleuron{\begin{mplibcode}
+ -z1 = z4 = 7 dir 8;
+ y2 - y1 = y4 - y3 = 3(y4 - y1);
+ z2 - z1 = z4 - z3 = whatever * dir 50;
+ draw z1 .. controls z2 and z3 .. z4
+ withpen pencircle xscaled 1.2 yscaled 0.2 rotated 50;
+ currentpicture := currentpicture rotated - angle z4;
+\end{mplibcode}}
+\newcommand\continued{\moveright 296pt\vbox to 0pt{\vskip -36pt
+\begin{mplibcode}
+ ahangle := 30;
+ drawarrow origin {right} .. {dir 60} 42 dir 60;
+ label.lft("\small \dots continued", origin);
+\end{mplibcode}\vss}}
%
\begin{document}
\let\folio\thepage
@@ -57,7 +72,7 @@
0pt{\vskip23pt\noindent\sffamily{\Large\bfseries\@title}\par\bigskip
\noindent\@author\ --- \@date\par
\bigskip\noindent
- \includegraphics{archimedes.pdf}
+ \includegraphics{tiling-archimedes}
\vss}
\makeatother
\thispagestyle{empty}
@@ -67,7 +82,7 @@
technical drawings with John Hobby’s \MP\ language. I’m assuming that you already
know the basics of the language, that you have it installed as part of your up to
date \TeX\ ecosystem, and that you have established a reasonable workflow that
-let’s you write a Metapost program, compile it, and include the results in your
+let’s you write a \MP\ program, compile it, and include the results in your
\TeX\ document. If not, you might like to start at the \MP\ page on CTAN, and read
some of the excellent tutorials, including "mpintro.pdf". If you have already done
this, please read on.
@@ -86,12 +101,21 @@
And when I say \textit{plain} \MP\ I mean \MP\ with the default format (as defined
in the file "plain.mp") loaded and only a few simple external packages (like
-"boxes.mp" occasionally). Nearly all of the examples here are supposed to be self
+"colorbrewer") occasionally. Nearly all of the examples here are supposed to be self
contained, and any macros are defined locally so you can get to grips with what’s
going on. \MP\ is a very subtle language, and it’s possible to do some very clever
-and completely inscrutable things with it; in contrast I’ve tried to be as clear as
+and completely inscrutable things with it; but here I have tried to be as clear as
possible in my examples.
+\vbox to 0pt{
+\vskip 1in
+\noindent
+\begingroup\footnotesize\blue{
+Copyright \copyright\ 2024 by Toby Thurston. This material may be distributed only
+subject to the terms and conditions set forth in the Open Publication License,~v1.0
+or later (the latest version is presently available at
+"http://www.opencontent.org/openpub/").}\endgroup\par\vss}
+
\newpage
\section{Some features of the syntax}
@@ -100,7 +124,7 @@
current scope”; the assignment "a:=3;" means “update the value of "a" to the value "3"
immediately”. The difference becomes apparent when you try to update a
variable in the same scope.
- \mwpic{0pt}{tiling}
+ \mwpic{-64pt}{tiling-arch-hexagon}
This difference also lets you write linear equations
like "a=-b;". After this, as soon as you give a value to "a", \MP\ immediately works
@@ -165,7 +189,7 @@
my own workflows that you might find helpful. You might also think I'm being really
inefficient; if so please drop me a line and suggest an improvement.
-The common features of each of these workflows are: mac os, the MacVim editor to
+The common features of each of these workflows are: Mac~OS, the MacVim editor to
edit \MP\ source code, and
Skim.app to view PostScript and PDF files. I have the complete MacTeX distribution
installed; any commands mentioned below are supplied by MacTeX.
@@ -191,26 +215,26 @@
the chosen output format, which will be "png", "svg", or more usually "eps", which
is the default (and suggests that the output is Encapsulated PostScript).
+\smallskip
+
I then add drawing and label commands, using all the traditional facilities for
typesetting labels described in section \ref{sec:trad-labels}. I compile the source
with "mpost". I usually do this from within MacVim using the command line ":!mpost %"
where "!" means “this is an external command” and the "%" picks up the current file
name. Usually I need several attempts to get a diagram right, so I open Skim to preview the
-output with ":!open -a Skim %:r1.eps". I have Skim set up so that when I recompile
-the source, it automatically updates the view of the PostScript output.
+output.
\vadjust{\moveright5.4in\vbox to 0pt{\vss\hsize 4in\noindent
-$$\includegraphics[width=4in]{workflow-plain.pdf}$$
-If I want to use the diagram in a \LaTeX\ document I can include the EPS file
-directly with
-\begin{texcode}
- \includegraphics{some-diagram1.eps}
-\end{texcode}
-but usually I prefer to convert the EPS to PDF using "epstopdf" rather than rely on
-the automatic conversion. This is mainly because the PDFs are generally more useful
-files to have about (I can include them in presentations etc). Sometimes I do this
-manually but usually I use a small Python script to automate this process: run
+$$\includegraphics[width=4in]{workflow-plain}$$
+Until recent (2024) versions of Mac~OS, it was possible to get Skim to view the
+PostScript output directly, with automatic updates on recompile,
+but the conversion from PostScript no longer works properly, so
+I now prefer to convert the EPS to PDF using "epstopdf". This
+slightly complicates the edit, compile, and preview loop. On the other hand
+the PDFs are generally more useful files to create, so it is worth the extra effort.
+
+I use a small Python script to automate the process: run
"mpost" with the "-recorder" option; scan the list of files to see what got
-produced; check which ones are PostScript; call "esptopdf" to make each one into a
+produced; check which ones are PostScript; call "epstopdf" to make each one into a
PDF file; remove each EPS file if successful. Your mileage may vary.\par
}}
@@ -226,8 +250,8 @@
\begin{texcode}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
+\mplibtextextlabel{enable}
\begin{document}
-\mplibtextextlabel{enable}
\begin{mplibcode}
\end{texcode}
\vskip-12pt
@@ -246,11 +270,16 @@
fit the contents of document, so is ideal for single diagrams. One small
disadvantage is that you can only produce a single PDF output file, so you need to have a
separate file for each picture, but the good news is that you get a much simpler and
-more effective integration with \LaTeX, in particular with the font environment.
-Since this only works with "lualatex" you have to use the "fontspec" package, as
-explained in section \ref{sec:neo-labels}.
+more effective integration with \LaTeX, in particular with the font environment, but
+as this only works with "lualatex" you have to use the "fontspec" package, as
+explained in section \ref{sec:neo-labels}.\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize 4in\noindent
+\hey\small If you like the fancier \MP\ format provided with ConTexT, you can use it directly with this
+"luamplib" approach. Just add this option to your preamble:
+\begin{texcode}
+\mplibsetformat{metafun}
+\end{texcode}}}
-\subsection{Integrated graphics with Lua\LaTeX}
+\subsection{Integrated graphics with Lua\LaTeX}\label{sec:lua-integrated}
If you are ready to use "lualatex" for processing your entire document, then you can
directly embed your \MP\ drawings in a series of "mplibcode" environments. Each one
@@ -264,19 +293,19 @@
\label{plain-shapes}
In \MP\ there are two sorts of paths: open and closed.
-\mpic{-12pt}{closed-triangles}
+\mpic{-12pt}{paths-triangles}
A closed path is called a cycle, and is created with the \mpl{cycle} primitive like this:
\begin{code}
path t; t = origin -- (55,0) -- (55,34) -- cycle;
\end{code}
You can think of \mpl{cycle} as meaning ‘connect back to the start and close the path’.
-Note that you have explicitly put \mpl{cycle} to make a closed path. If you wrote
+Note that you have explicitly put \mpl{cycle} to make a closed path. If you wrote
\begin{code}[xrightmargin=-32pt]
path u; u = origin {right} .. (55,0) .. (55,34) .. {-2,-1} origin;
\end{code}
then $u$ would be an open path even though the last point is the same as the
first. Any path that does not have \mpl{cycle} at the end is an open
-path.\mpic{-12pt}{open-triangle}
+path.\mpic{-12pt}{paths-open-triangle}
You can use \mpl{draw} with either sort of path, but you can only use \mpl{fill} with a
cycle. This concept is common to most drawing languages but it’s often hidden: an
@@ -283,7 +312,7 @@
open path might be automatically closed for you when you try to fill it. \MP\ takes
a more cautious approach; if you pass an open path to \mpl{fill} you will get an error
that says ‘Not a cycle’, even if the first and last points are the same like path
-$u$ above.
+$u$ above.
If you want to write a macro that deals differently with the two types
of path, then you can use \mpl{cycle} in a boolean context to test
@@ -306,7 +335,7 @@
--&straight line\cr
---&tense line\cr
\&&splice.\cr}\vss}} or you would like to bone up on exactly what \mpl{curl} and
-\mpl{tension} are for, then you are recommended to review Chapter 14 of \mfbook.
+\mpl{tension} are for, then you are recommended to review Chapter 14 of \mfbook.
\vfill\noindent
Most of the examples in this document use only the two simple joiners \mpl{--} and
@@ -317,7 +346,7 @@
\subsection{Predefined closed paths}
There are several closed paths defined for you in plain \MP.
-\mpic{0pt}{closed-standards}
+\mpic{-36pt}{paths-standards}
\begin{itemize}
\item "unitsquare" is defined as the path
\mpl{(0,0)--(1,0)--(1,1)--(0,1)--cycle}. It runs counter-clockwise from the
@@ -324,7 +353,7 @@
origin, and you can use it to draw any rectangle with appropriate
use of \mpl{xscaled} and \mpl{yscaled}, or a parallelogram with \mpl{slanted},
or a diamond with \mpl{rotated} --- but note that the definition means
- that is it centred on point \mpl{(1/2, 1/2)} so you might want to
+ that is it centred on point \mpl{(1/2, 1/2)} so you might want to
shift it by \mpl{-(1/2,1/2)} before you transform it.
\item "fullcircle" which you can use to draw any circle or ellipse with
@@ -331,26 +360,27 @@
appropriate use of \mpl{xscaled} and \mpl{yscaled}. Unlike the square, it is defined so that it is centred
at the origin. But beware that it has unit \textit{diameter}, so its radius
is $0.5\unit{bp}$ long. The path runs counter-clockwise and starts at 3
- o’clock; which means \mpl{point 0 of fullcircle = 1/2 right} is true.
+ o’clock; which means \mpl{point 0 of fullcircle = 1/2 right} is true.
\item "superellipse()" which creates the shape beloved of the Danish designer Piet Hein. Unlike the
other two, this one is defined as a function rather than a \<path> constant, so you need to call it
like this:
\begin{code}
-path s;
-s = superellipse(1/2 right, 1/2 up, 1/2 left, 1/2 down, .8);
+path s;
+s = superellipse(1/2 right, 1/2 up, 1/2 left, 1/2 down, 13/16);
\end{code}
- to create a ‘unit’ shape that matches \mpl{fullcircle} as shown on the right.
- The fifth parameter is the ‘superness’: the value
- 1 makes it look almost square, 0.8 is about right, 0.5 gives you a diamond,
- and values outside the range $(0.5,1)$ give you rather weird propeller
+ to create a ‘unit’ shape that matches \mpl{fullcircle} as shown above.
+ The fifth parameter is the ‘superness’: the value \mpic{-132pt}{paths-superellipses}
+ 1 makes it look almost square; $\frac12$ gives you a diamond; a value somewhere
+ between $\frac34$ and $\frac78$ looks about right.\quad$\longrightarrow$\\
+ Values outside the range $(0.5,1)$ give you rather weird propeller
shapes.
- Note that, unaccountably, $\id{superellipse}()$ is defined
-in \texttt{plain.mp} with a \kw{def} rather than a \kw{vardef}.
-This means you need to enclose it in a group before you can
-transform it in any way. One way to do this is to use parentheses; or you
-can assign it to a \<path> variable, as shown above.
+ \nb Note that, unaccountably, $\id{superellipse}()$ is defined in
+ \texttt{plain.mp} with a \kw{def} rather than a \kw{vardef}. This means you
+ need to enclose it in a group before you can transform it in any way. One
+ way to do this is to use parentheses; or you can assign it to a \<path>
+ variable, as shown above.
\end{itemize}
@@ -357,7 +387,7 @@
\newpage\subsection{Points on the standard closed paths}
-\noindent\mpic{-10pt}{closed-points}%
+\noindent\mpic{-10pt}{paths-points}%
\textsc{Here are the three shapes} centred on the origin and labelled to show the points
along them. \textbf{Note} that the \textit{unitsquare} shape has been shifted so that it is
centred on the origin in all of these examples. The small red circle marks the
@@ -384,15 +414,15 @@
center p -- subpath(0,1/5 length p) of p -- cycle
\end{code}
Clearly this works rather better with more circular shapes. Indeed for a circle you
-can convert directly between circumference angle and points along the path. So
-you have defined path $c$ to be scaled copy of \mpl{fullcircle}, then
-\mpl{point 1 of c} is $45^\circ$ round and 1~radian is \mpl{point 1.27324 of c}, (because
-$4/\pi \simeq 1.27324$).
+can convert directly between circumference angle and points along the path. So you
+have defined path $c$ to be scaled copy of \mpl{fullcircle}, then \mpl{point 1 of c}
+is $45^\circ$ round and 1~radian is \mpl{point 1.27324 of c}, (because $4/\pi \simeq
+1.27324$).
\vfill\noindent
In a closed path, the point numbering in \MP\ wraps round: so in a
circle, point $n$ is the same as point $n+8$; and in general point $n$ is the same as
-point $n+\hbox{\bf length }p$. This works with negative numbers too, so we could use
+point $n+\kw{length} p$. This works with negative numbers too, so we could use
\begin{code}
center p -- subpath(-1,1) of p -- cycle
\end{code}
@@ -405,9 +435,9 @@
\newpage
\subsection{Regular polygons of a given radius}\label{polygons}
-\noindent\mpic{-10pt}{closed-polygons}%
+\noindent\mpic{-10pt}{paths-polygons}%
\textsc{Regular polygons} with a given radius can be defined or drawn directly with a simple inline loop:
-\vadjust{\moveright -60pt \vbox to 0pt{\vskip-3pt\includegraphics{little-hexagon.pdf}\vss}}
+\vadjust{\moveright -60pt \vbox to 0pt{\vskip-3pt\includegraphics{paths-little-hexagon}\vss}}
\begin{code}
draw for i=0 upto 5: 20 dir 60i -- endfor cycle;
\end{code}
@@ -414,8 +444,8 @@
which works because \mpl{dir d} expands to \mpl{right rotated d}. But
you might prefer to make a macro:
\begin{code}
-vardef polygon(expr n, r) =
- for i=0 upto n-1: (r, 0) rotated (360/n * i) -- endfor cycle
+vardef polygon(expr n, r) =
+ for i=0 upto n-1: (r, 0) rotated (360/n * i) -- endfor cycle
enddef;
\end{code}
This produces a closed path to represent an $n$-sided polygon that fits in a circle
@@ -425,64 +455,42 @@
If you need polygon paths that start at the top, you can just swap the
coordinates:
\begin{code}
-vardef polygon(expr n, r) =
- for i=0 upto n-1: (0, r) rotated (360/n * i) -- endfor cycle
+vardef polygon(expr n, r) =
+ for i=0 upto n-1: (0, r) rotated (360/n * i) -- endfor cycle
enddef;
\end{code}
-$$\includegraphics[width=0.66\textwidth]{closed-polygon-tops.pdf}$$
+$$\includegraphics[width=0.66\textwidth]{paths-polygon-tops}$$
\hey Note also that some extra care is required to find the centres of these shapes. The
\mpl{center} macro defined in "plain.mp" gives you the centre of the bounding box,
but this is not the same as the centre of the polygon when the number of sides is
-odd. What you need instead is the geometric median:
+odd. What you need instead is the geometric center or \textit{centroid}:
\begin{code}
-vardef median primary p =
+vardef centroid primary p =
origin for i=1 upto length p: + point i of p / length p endfor
enddef;
\end{code}
-This should work for any closed path, not just regular polygons.
+This should work for any closed path, not just regular polygons. For ways to
+label the vertices neatly, as shown above, see §\ref{sec:new-dynamic}.
\newpage
\subsection{Regular polygons of a given side length}\label{polygons-given-side}
But you might want a polygon with a fixed side instead of a fixed radius. This needs
-a little trigonometry, using the sine rule:\mpic{-42pt}{closed-fixed-polygon}
-\begin{code}
-vardef polygon_with_side(expr n, s) =
- save a, b, r; numeric a, b, r;
- a * n = 360; a + 2b = 180; r = s * sind(b) / sind(a);
- for i = 0 upto n-1: (0, r) rotated (a * i) -- endfor cycle
-enddef;
-\end{code}
-Which you can use like this to produce a nest of polygons $\rightarrow$
-\begin{smallcode}
-for n = 11 downto 3: path p; p = polygon_with_side(n, 72);
- fill p withcolor (n/32)[white, 3/4 if odd n: red else: blue fi];
- draw p;
-endfor
-\end{smallcode}
+a little trigonometry, using the sine rule:\mpic{-60pt}{paths-fixed-polygon}
+\smallmpexternal[firstline=7, lastline=11]{paths-fixed-polygon.mp}
+\noindent
+Which you can use like this to produce a nest of polygons \rightarrowfill
+\smallmpexternal[firstline=12, lastline=16]{paths-fixed-polygon.mp}
+
+\vfill
+\noindent
These polygon paths are centred on $(0, 0)$ but
sometimes it is more convenient to construct a polygon on a known segment
-rather than working out how to rotate and shift it into place.
-$$\includegraphics[width=0.9\textwidth]{closed-polygon-chain.pdf}$$
-Here is a way to do that using the \mpl{of} syntax in the macro construction
-$\longrightarrow$
+rather than working out how to rotate and shift it into place.
+$$\includegraphics[width=0.9\textwidth]{paths-polygon-chain}$$
+Here is a way to do that using the “\mpl{of}” syntax in the macro construction \rightarrowfill
\vadjust{\moveright 384pt\vbox to 0pt{\vss
-\begin{smallcode}
-vardef poly expr n of p = save x, y;
- z0 = point 0 of p; z1 = point 1 of p;
- for i=2 upto n-1:
- z[i] = z[i-2] rotatedabout(z[i-1], 180(2/n-1));
- endfor
- for i=0 upto n-1: z[i] -- endfor cycle
-enddef;
-path P[]; P3 = for i=0 upto 2: 6 up rotated 120i -- endfor cycle;
-fill P3 withcolor 3/4 red; draw P3;
-for n = 4 upto 23:
- numeric m; m = floor(n / 2);
- P[n] = poly n of subpath (m, m-1) of P[n-1];
- fill P[n] withcolor (n/32)[3/4 if odd n: red else: blue fi, white];
- draw P[n]; label(decimal n, median(P[n]));
-endfor
-\end{smallcode}\vskip -12pt}}
+\smallmpexternal[firstline=6,lastline=22]{paths-polygon-chain.mp}
+\vskip -42pt}}
\newpage\subsection{Curved polygons}
@@ -491,11 +499,11 @@
\mpl{..} you would get a circle, and contrariwise, if you try
\mpl{tensepath(fullcircle scaled 20)} you will get a regular octagon. But we can
also adjust the directions at the corners to make a variety of closed polygon shapes
-with closed edges.
+with closed edges.
One of the most pleasing is the Reuleaux polygon, with circular arcs for edges.
-$$\includegraphics[width=0.9\textwidth]{closed-reuleaux-set.pdf}$$
-The figure on the right attempts to explain the geometry.\mwpic{-160pt}{closed-reuleaux-geometry}
+$$\includegraphics[width=0.9\textwidth]{paths-reuleaux-set}$$
+The figure on the right attempts to explain the geometry.\mwpic{-160pt}{paths-reuleaux-geometry}
\begin{code}
vardef reuleaux(expr n, r) =
save a; numeric a; a = 90/n;
@@ -506,39 +514,17 @@
\end{code}
If you swap the directions at each point you get shapes that are not quite like
hypocycloids; play about a bit more to get flower shapes or windmills.
-$$\includegraphics[width=0.9\textwidth]{closed-antireuleaux-set.pdf}$$
+$$\includegraphics[width=0.9\textwidth]{paths-antireuleaux-set}$$
\newpage
\subsection{A triangle of Schläfli polygons}\label{sec:gcd}
Apart from the curious polygon patterns in the display, the main \MP\ point of interest
-is the recursive "gcd" macro to find the greatest common divisor.\mpic{-108pt}{gons}
+is the recursive "gcd" macro to find the greatest common
+divisor.\mpic{-108pt}{paths-schlafli-polygons}
-\begin{code}
-input colorbrewer-rgb
+\mpexternal[firstline=6,lastline=26]{paths-schlafli-polygons.mp}
-vardef gcd(expr a, b) =
- if b = 0: a else: gcd(b, a mod b) fi
-enddef;
-
-beginfig(1);
-for n=2 upto 24:
- for s=1 upto floor n/2:
- pair p; p = (12n - 24s, -24n);
- path gon; gon =
- for t=0 upto n/gcd(s,n) - 1:
- 10 up rotated (360/n * s * t) --
- endfor cycle;
- if (n mod s = 0):
- fill gon shifted p withcolor Blues 9 2;
- label("$" & decimal (n/s) & "$", p);
- fi
- draw gon shifted p withpen pencircle scaled 1/8;
- endfor
-endfor
-endfig;
-\end{code}
-
\noindent
The macro also leads directly to an efficient way to find the least common multiple:
\begin{code}
@@ -553,39 +539,38 @@
Plain \MP\ has a built-in function to compute the intersection points of two paths, and
there’s a handy high level function called "buildcycle" that uses this function to
create an arbitrary closed path.
-\mpic{0pt}{area-under-graph}
+\mpic{-36pt}{paths-area-under-graph}
The arguments to the function are just a list of paths, and providing the paths all
intersect sensibly, it
returns a closed path that can be filled or drawn. This is often used for colouring an
area under a function in a graph.
Here is an example. The red line has been defined
-as path "f" and the two axes as paths "xx", and "yy". The blue area was defined
+as path "f" and the two axes as paths "xx", and "yy". The light blue area was defined
with
-\begin{code}
-buildcycle(yy shifted (1u,0), f, yy shifted (2.71828u,0), xx)
-\end{code}
+\mpexternal[firstline=18,lastline=18]{paths-area-under-graph.mp}
+\noindent
Note the re-use of the $y$-axis path shifted along by different amounts.
-\smallskip\noindent
+\vfill\noindent
There are similar examples in the \MP\ manual, but "buildcycle" can also
be useful in more creative graphics.
Here’s a second example that uses closed paths to give an illusion of depth to a simple
graphic of the planet Saturn.
-\mpic{0pt}{saturn}
+\mpic{0pt}{paths-saturn}
\marginpar{\hbox{}\vskip1.3in\raggedright\noindent\textbf{Notes}\begin{itemize}
- \item The first five paths are just circles and ellipses based on "fullcircle".
- \item The drawing is done inside an "image" simply so that the final result can
+ \item The first five paths are just circles and ellipses based on \mpl{fullcircle}.
+ \item The drawing is done inside an \mpl{image} simply so that the final result can
be drawn at an angle
- \item "unfill gap" is shorthand for "fill gap withcolor background"
- \item The subpaths passed to "buildcycle" are chosen carefully to make sure we
+ \item \mpl{unfill gap} means: \mpl{fill gap withcolor background}
+ \item The subpaths passed to \mpl{buildcycle} are chosen carefully to make sure we
get the intersections at the right points and so that the component paths
- all run in the same direction. Note that "subpath (8,4) of globe" runs
+ all run in the same direction. Note that \mpl{subpath (8,4) of globe} runs
clockwise (that is backwards) from point 8 to point 4.
\end{itemize}}
-\mpexternal{saturn-code.mp}
+\mpexternal[firstline=7,lastline=23]{paths-saturn.mp}
\newpage\subsection{The implementation of \texttt{buildcycle}}
-\textsc{The implementation} of "buildcycle" in plain \MP\ is interesting for a number of
+\textsc{The implementation} of \mpl{buildcycle} in plain \MP\ is interesting for a number of
reasons. Here it is copied from "plain.mp" (with minor simplifications) $\longrightarrow$
\vadjust{\moveright5.5in\vbox to 0pt{\kern-1cm%
\begin{code}
@@ -614,19 +599,19 @@
Notice how freely the indentation can vary; this is both a blessing
(because you can line up things clearly) and a curse (because the syntax may not
be very obvious at first glance). Notice also the different ways we can use a
-$\kw{for}$-loop. The first two are used at the ‘outer’ level to repeat complete
+\mpl{for}-loop. The first two are used at the ‘outer’ level to repeat complete
statements (that end with semi-colons); the third one is used at the ‘inner’ level
to build up a single statement.
-The use of a "text" parameter allows us to pass a comma-separated list as an
+The use of a \mpl{text} parameter allows us to pass a comma-separated list as an
argument; in this case the list is supposed to be a list of path expressions that
-(we hope) will make up a cycle. The first "for" loop provides us with a standard
+(we hope) will make up a cycle. The first \mpl{for} loop provides us with a standard
idiom to split a list; in this case the comma-separated value of "input_path_list"
is separated into into a more convenient array of paths called "pp" indexed by "k".
-Note that the declaration of the array as "path" forces the argument to be a list of
+Note that the declaration of the array as \<path> forces the argument to be a list of
paths.
-The second "for" loop steps through this array of paths looking for intersections.
+The second \mpl{for} loop steps through this array of paths looking for intersections.
The index "j" is set to be "k" when "i=1", and then set to the previous value of "i"
at the end of the loop; in this way
"pp[j]" is the path before "pp[i]" in what is supposed to be a cycle.
@@ -638,14 +623,12 @@
the time returned from the length of the path.
If all has gone well, then "ta" will hold all the start points of the desired
-subpaths, and "tb" all the corresponding end
-points.
-The third and final "for" loop assumes that this is indeed the case, and tries to
-connect them all together. Note that it uses ".." rather than "&" just in case the
-points are not quite co-incident; finally it finishes with a
-\mpl{cycle} to close the path even though point "tb" of path "k" should be identical (or
-at least very close) to
-point "ta" of path "0".
+subpaths, and "tb" all the corresponding end points. The third and final \mpl{for}
+loop assumes that this is indeed the case, and tries to connect them all together.
+Note that it uses \mpl{..} rather than \mpl{&} just in case the points are not quite
+co-incident; finally it finishes with a \mpl{cycle} to close the path even though
+point \mpl{tb[k] of pp[k]} should be identical (or at least very close) to point
+\mpl{ta[0] of pp[0]}.
This implementation of \mpl{buildcycle} works well in most cases, provided that there
are enough components to the cycle of paths. If you only have two paths, then the
@@ -656,16 +639,10 @@
\subsection{Strange behaviour of \texttt{buildcycle} with two closed paths}
The implementation of "buildcycle" in plain \MP\ can get confused if you use it with
-just two paths. Consider the following example: \mpic{0pt}{overlaps-missing-filler}
-\begin{code}
-beginfig(1);
- path A, B;
- A = fullcircle scaled 2.5cm;
- B = fullcircle scaled 1.8cm shifted (1cm,0);
- fill buildcycle(A,B) withcolor .8[blue,white];
- drawarrow A; drawarrow B;
-endfig;
-\end{code}
+just two paths. Consider the following example: \mpic{0pt}{paths-overlaps-missing-filler}
+
+\mpexternal[firstline=7,lastline=14]{paths-overlaps-missing-filler.mp}
+
When we compile this example, we get no error message from "buildcycle", but there
is no fill colour visible in the output. The problem is that the points found by
"buildcycle" are the same both times that it steps through the middle loop, so
@@ -673,12 +650,12 @@
so the fill has zero area.
Now observe what happens when we rotate and reverse each of the paths in
-turn.\mpic{-24pt}{overlaps-default-fillers}
+turn.\mpic{-24pt}{paths-overlaps-default-fillers}
Number 1 corresponds to the example shown above; point~0 of~$A$ is inside the closed
path $B$. In~2 we have rotated path $A$ by 180° so that the start of path~$A$ is no
longer inside $B$, and now "buildcycle" works ‘properly’ --- but this is the only
time it does so. In~3, we've rotated $B$ by 180° as well, so that $B$ starts inside
-$A$ and as expected "buildcycle" fails. In 4 we've rotated $A$ back to it's
+$A$ and as expected "buildcycle" fails. In 4 we've rotated $A$ back to its
original position, so that both paths start inside each other; and we get the
union of the two shapes. In 5--8, we've repeated the exercise with path $A$
reversed, and "buildcycle" fails in yet more interesting ways.
@@ -743,116 +720,12 @@
enddef;
\end{smallcode}
Using this "overlap" macro in place of "buildcycle" produces less surprising
-results.\mpic{-2in}{overlaps}
+results.\mpic{-2in}{paths-overlaps}
\newpage
-\subsection{Fitting dashed lines to a path}
-
-\textsc{This one is} perhaps for perfectionists, but also shows how simple it
-is to make useful adjustments in \MP. As you will know, plain \MP\ provides two
-built-in dash patterns, so that you can draw a path \mpl{dashed withdots} or
-\mpl{dashed evenly}.
-\vadjust{%
-\moveright384pt\vbox to 0pt{\vskip-46pt\hsize 4.2in\small
-$$
-\begin{mplibcode}
-vardef exactly(expr a) =
- save m; numeric m; 2m = (a-6) / round(a/6);
- dashpattern(on m off m)
-enddef;
-vardef gooddots(expr a) =
- save m; numeric m; 2m = (a-5) / round(a/5);
- dashpattern(off m on 0 off m)
-enddef;
- beginfig(1);
- for i=2 upto 8:
- path c[];
- c1 = fullcircle scaled 16i shifted 80 left;
- c2 = fullcircle scaled 16i shifted 80 right;
- draw c1 dashed evenly withcolor 2/3 blue;
- draw c2 dashed exactly(arclength c2) withcolor 1/2 red;
- %draw c1 shifted 160 down dashed withdots withcolor 2/3 blue;
- %draw c2 shifted 160 down dashed gooddots(arclength c2) withcolor 1/2 red;
- endfor
- endfig;
-\end{mplibcode}
-$$
-
-\noindent
-The blue circles on the left were drawn with \mpl{dashed evenly}, and the uneven
-gaps are noticeable at the “three o’clock” positions where the paths begin and end.
-As you can see the default dash spacing looks fine at some sizes but bad on others. On the right you can see the
-same circular paths coloured red, and drawn with \mpl{dashed exactly(arclength c,
-6)}.
-
-$$
-\begin{mplibcode}
-vardef exactly(expr a, u) =
- save m; numeric m; 2m = a / round(a/u);
- dashpattern(on m off m)
-enddef;
- beginfig(1);
- for i=2 upto 8:
- path c[];
- c1 = unitsquare shifted -(1/2, 1/2) scaled 16i shifted 80 left;
- c2 = unitsquare shifted -(1/2, 1/2) scaled 16i shifted 80 right;
- draw c1 dashed evenly withcolor 2/3 blue;
- draw c2 dashed (exactly(arclength c2, 8) shifted 6 right) withcolor 1/2 red;
- endfor
- endfig;
-\end{mplibcode}
-$$
-Other paths may require a bit more ingenuity and thought. Because the square paths
-have four equal sides, they work better with a target dash length that is a multiple
-of 4. Here the blue squares on the left use the default \mpl{dashed evenly}, and the
-red on the right, \mpl{exactly(arclength c2, 8)} \mpl{shifted 6 right}. The shift makes
-the corners look better.
-
-
-\vss}}
-
-The keyword \mpl{dashed} gives you access to the PostScript "setdash" command, its
-argument is a special \<picture> defined with the \MP\ \mpl{dashpattern} function.
-If you look in "plain.mp" you will find these declarations:
-\begin{code}
-picture evenly,withdots;
-evenly = dashpattern(on 3 off 3); % dashed evenly
-withdots = dashpattern(off 2.5 on 0 off 2.5); % dashed withdots
-\end{code}
-The detailed syntax is explained in §9.4 of the \MP\ manual, but essentially
-\mpl{withdots} creates a unit 5 points long with a dot in the middle, and
-\mpl{evenly} creates a unit 6 points long with the dashes 3pt long (plus the round
-bit at the end of each dash, unless you have changed \mpl{linecap}) and gaps 3pt
-long (minus any round bits).
-
-You probably also know that you can adjust these sizes by applying a suitable
-scaling, so that \mpl{dashed withdots scaled 1/2} gives a rather denser dotted line,
-and \mpl{dashed evenly scaled 4} will give you very long dashes. But you may also
-notice that the dash patterns (particularly the longer ones) do not always fit your
-paths exactly -- this is especially noticeable with closed paths, where you may end
-up with one unsightly long dash or a very short gap a the point where the path
-begins and ends.
-
-Fortunately there is a very simple solution: adjust the length of the dash pattern
-so that an integer number of dash units exactly fit your path.
-\begin{code}
-vardef exactly(expr a, u) =
- save m; numeric m; 2m = (a-u) / round(a/u);
- dashpattern(on m off m)
-enddef;
-\end{code}
-Here "a" is supposed to be the \mpl{arclength} of your path, and "u" the desired
-unit size, so you can use it like this:
-\begin{code}
-path c; c = fullcircle scaled 200;
-draw c dashed exactly(arclength c, 6);
-\end{code}
-to get a close approximation to \mpl{dashed evenly} that exactly fits the path.
-
-\newpage
\section{Numbers}
-This section discusses plain \MP's scalar numeric variables
+This section discusses plain \MP\ scalar numeric variables
and what you can do with them.
\MP\ inherits its unusual native system of scaled numbers from \MF; like many of
Knuth's creations it is slightly quirky, but works very well once you get the hang
@@ -872,19 +745,16 @@
choose fractional step-values in a "for" loop; the errors can accumulate so that
you may miss your expected terminal value.\vadjust{\moveright5.5in\vbox to
0pt{\kern-2in\hsize4in\noindent
- Compare the following two snippets:
+ Compare the following two snippets:
$$\vbox{\halign{#\hfil\quad&#\hfil\cr
Code&Output\cr\noalign{\smallskip\hrule\bigskip}
- \vtop{\parindent0pt\hsize2.2in
- \bgroup\obeylines
- $\kw{for}$ $i=0$ \kw{step} $1/10$ \kw{until} $1$:
- \quad$\kw{show}$ $i$;
- $\kw{endfor}$
- \egroup
-
-}
+\vtop{\begin{code}[xleftmargin=0pt, xrightmargin=160pt]
+for i = 0 step 1/10 until 1:
+ show i;
+endfor
+\end{code}}
&
- \vtop{\parindent0pt\parskip-2pt\obeylines\hsize60pt\tt
+ \vtop{\parindent0pt\parskip-2pt\obeylines\hsize60pt\ttfamily
>> 0
>> 0.1
>> 0.20001
@@ -897,15 +767,13 @@
>> 0.90005
}
\cr\noalign{\bigskip}
- \vtop{\parindent0pt\hsize2.2in
- \bgroup\obeylines
- $\kw{for}$ $i=0$ \kw{step} $1$ \kw{until} $10$:
- \quad$\kw{show}$ $i/10$;
- $\kw{endfor}$
- \egroup
-}
+\vtop{\begin{code}[xleftmargin=0pt, xrightmargin=160pt]
+for i = 0 step 1 until 10:
+ show i/10;
+endfor
+\end{code}}
&
- \vtop{\parindent0pt\parskip-2pt\obeylines\hsize60pt\tt
+ \vtop{\parindent0pt\parskip-2pt\obeylines\hsize60pt\ttfamily
>> 0
>> 0.1
>> 0.2
@@ -919,7 +787,8 @@
>> 1
}\cr\noalign{\bigskip\hrule}\cr
}}$$
-You get 11 iterations in the second but only 10 with the first.
+Unless you run this with "-numbersystem=decimal", you will get
+11 iterations in the second but only 10 with the first.
\vss}}
\item The system limits you to numbers that are less than 4096 in absolute value.
@@ -951,7 +820,7 @@
\begin{itemize}
\item $\id{eps}$ is defined to be a
small amount that is noticeable to \MF’s rounding algorithms, namely
-${32\over65536}={1\over2048}\simeq 0.00049$. As a distance on the page or screen it's invisible at
+${32\over65536}={1\over2048}\simeq 0.00049$. As a distance on the page or screen, it's invisible at
any resolution less than 150,000 dots per square inch. If you were designing fonts
in \MF, $\id{eps}$ could help you avoid bad choices of pixels at low resolutions, but in
\MP\ it's only really useful in comparisons that might suffer from rounding errors.
@@ -974,9 +843,9 @@
\vadjust{\moveright5.5in\vbox to 0pt{\kern-221pt\hsize 4.25in
\noindent
Running the toy program:
-\par\bigskip
-$\kw{show} \id{numbersystem}, \id{eps}, \id{epsilon}, \id{infinity}; \kw{end}\!.$
-\par\bigskip\noindent
+\begin{code}
+show numbersystem, eps, epsilon, infinity; end.
+\end{code}
gives the following results with the different
number systems:
@@ -1109,54 +978,15 @@
\smallskip
\parshape=1 0pt 3.4in
This behaviour is usually what you want.
-\vadjust{\moveright 266pt \vbox to 0pt{\noindent
+\vadjust{\moveright 266pt \vbox to 0pt{\noindent
\begin{mplibcode}
input clocks
-beginfig(1); draw clock(hour, minute) scaled 0.8; endfig;
+draw clock(hour, minute) scaled 0.8;
\end{mplibcode}\vss}}
For example we can use it to turn the time of day into an appropriate rotation for
the hands of a clock.%
\vadjust{\moveright 384pt\vbox to 0pt{\kern-196pt
-\begin{code}
-path hand[];
-hand1 = origin .. (.257,1/50) .. (.377,1/60)
- & (.377,1/60) {up} .. (.40,3/50)
- .. (.60, 1/40) .. {right} (.75,0);
-hand1 := (hand1 .. reverse hand1 reflectedabout(left,right)
- .. cycle) scaled 50;
-hand2 = origin .. (.60, 1/64) .. {right} (.925,0);
-hand2 := (hand2 .. reverse hand2 reflectedabout(left,right)
- .. cycle) scaled 50;
-
-% hour of the day to degrees
-vardef htod(expr hours) = 30*((15-hours) mod 12) enddef;
-vardef mtod(expr minutes) = 6*((75-minutes) mod 60) enddef;
-
-vardef clock(expr hours, minutes) = image(
- % face and outer ring
- fill fullcircle scaled 100 withcolor 1/256(240, 240, 230);
- draw fullcircle scaled 99 withcolor .8 white;
- draw fullcircle scaled 100 withpen pencircle scaled 7/8;
- % numerals
- for h=1 upto 12:
- label( decimal h infont "bchr8r", (40,0) rotated htod(h));
- endfor
- % hour and minute marks
- for t=0 step 6 until 359:
- draw ((48,0)--(49,0)) rotated t;
- endfor
- drawoptions(withpen pencircle scaled 7/8);
- for t=0 step 30 until 359:
- draw ((47,0)--(49,0)) rotated t;
- endfor
- % hands rotated to the given time
- filldraw hand1 rotated htod(hours+minutes/60);
- filldraw hand2 rotated mtod(minutes);
- % draw the center on top
- fill fullcircle scaled 5;
- fill fullcircle scaled 3 withcolor .4 white;
-) enddef;
-\end{code}
+\mpexternal[firstline=9,lastline=46,xleftmargin=0pt]{clocks.mp}
\vss}}
In the program given on the right, this idea
is used to define functions that convert from hours and minutes
@@ -1170,9 +1000,9 @@
\vfill
There is also a "round" function that rounds a number to the nearest integer. It is
-essentially defined as $\mathop{\kw{floor}}(x+0.5)$ except that it is enhanced to
-deal with $\kw{pair}$ variables as well. If you round a pair the $x$-part and
-the $y$-part are rounded separately, so that $\mathop{\kw{round}}(3.14159, 2.71828)
+essentially defined as $\kw{floor}(x+0.5)$ except that it is enhanced to
+deal with \<pair> variables as well. If you round a pair the $x$-part and
+the $y$-part are rounded separately, so that $\kw{round}(3.14159, 2.71828)
= (3,3)$.
The "round" function only takes a single argument, but you can use it to round to a
@@ -1185,12 +1015,11 @@
\newpage
\subsection{Integer powers}
-\textsc{Even if you use} one of the new number systems, you may occasionally get
-caught out by the \mpl{**} operator. As the table on the right shows, you may get
+\textsc{Occasionally} you might get
+caught out by the implementation of the \mpl{**} operator. As the table on the right shows, you may get
an approximate answer from \mpl{x ** y} even when $x$ and $y$ are both integers.
\vadjust{\moveright 384pt\vbox to 0pt{\kern -2pt
$$\begin{mplibcode}
-beginfig(0);
%primarydef x ** y = 1 for n=1 upto y: * x endfor enddef;
for x=1 upto 19:
for y = 1 upto 7:
@@ -1206,32 +1035,31 @@
label.lft("Results of \mpl{x**y} for small values, using", lrcorner currentpicture shifted 36 up);
label.lft("the default \mpl{scaled} number system", lrcorner currentpicture shifted 24 up);
currentpicture := currentpicture scaled 0.8;
-endfig;
\end{mplibcode}$$\vss}}
Note that the squares are all integers, and the powers of two appear to be ok
(although if the page was wider you would see that \mpl{2**9} is $512.00002$), but
-that with a couple of exceptions cubes and higher powers are slightly off. Changing
-the number system makes it worse; even $x^1$ is not always an integer. The reason
+that with a couple of exceptions cubes and higher powers are all slightly off. Changing
+to one of the new number systems makes it worse; even $x^1$ is not always an integer. The reason
can be found in the way that the \mpl{**} operator is defined in "plain.mp".
\begin{smallcode}[xleftmargin=0pt, xrightmargin=-36pt]
primarydef x ** y = if y = 2: x * x else: takepower y of x fi enddef;
def takepower expr y of x =
- if x > 0:
+ if x > 0:
mexp(y * mlog x)
- elseif (x = 0) and (y > 0):
+ elseif (x = 0) and (y > 0):
0
- else:
+ else:
if y = floor y:
if y >= 0: 1 for n=1 upto y: * x endfor
else: 1 for n=-1 downto y: / x endfor
fi
- else:
+ else:
hide(errmessage "Undefined power: " & decimal x & "**" & decimal y)
- fi
- fi
+ fi
+ fi
enddef;
\end{smallcode}
-This is inherited direction from plain \MF, and as it says in the \mfbook, it is
+This is inherited directly from plain \MF, and as it says in the \mfbook, it is
optimized for $x^2$ and takes care to handle correctly negative numbers and zeros.
But for all positive values of $x$ other than 2 it is implemented using logs, and
the results are therefore only approximate. To avoid confusion where this might
@@ -1246,7 +1074,7 @@
\newpage
\section{Pairs, triples, and other tuples}
-\vpic{7pt}{random-selection}
+\vpic{7pt}{pairs-random-selection}
\noindent
\MP\ inherits a generalized concept of number from \MF\ that includes ordered pairs.
@@ -1311,7 +1139,7 @@
which you can use to find orthogonal points.
\bigskip\noindent
-\includegraphics{random-function}
+\includegraphics{pairs-random-function}
\vss}}%
The deceptively simple definition of $\id{z}$ as a subscripted macro allows you to
write "z1 = (10,20);" and have it automatically expanded into the equivalent of
@@ -1387,34 +1215,8 @@
subtraction are just done with the
normal operators.
\vadjust{\moveright 384pt\vbox to 0pt{\vskip -3.74in
-$$\includegraphics{complex-operators}$$
-\begin{code}
-beginfig(1);
- numeric u; u = 1cm;
- z1 = 2 dir 15; z2 = 1.2 dir 60;
- z3 = z1+z2; z4 = z1 zscaled z2; z5 = (x1,-y1);
- drawoptions(withcolor 2/3 white);
- draw (1/2 left -- 3 right) scaled u ;
- draw (1/2 down -- 3 up ) scaled u ;
- draw subpath (0,3) of fullcircle scaled 2u rotated -22.5;
- drawoptions();
- dotlabel.lrt (btex $\scriptstyle 1$ etex, (u,0));
- dotlabel.ulft(btex $\scriptstyle i$ etex, (0,u));
- interim ahangle := 30;
- forsuffixes @=1,2,3,4,5:
- x@ := x@ * u; y@ := y@ * u;
- drawarrow origin -- z@
- cutafter fullcircle scaled 5 shifted z@
- withcolor 2/3 if @ < 3: blue else: red fi;
- endfor
- fill fullcircle scaled dotlabeldiam;
- dotlabel.rt (btex $A$ etex, z1);
- dotlabel.urt(btex $B$ etex, z2);
- dotlabel.top(btex $A+B$ etex, z3);
- dotlabel.top(btex $A \times B$ etex, z4);
- dotlabel.rt (btex $\bar{A}$ etex, z5);
-endfig;
-\end{code}
+$$\includegraphics{pairs-complex-operators}$$
+\mpexternal[firstline=6,lastline=30]{pairs-complex-operators.mp}
\vss}}%
To get the complex conjugate you
could use "reflectedabout(left,right)", but it's probably easier just to write
@@ -1442,23 +1244,11 @@
Since multiplication by $z$ can be thought of as a transformation consisting of
rotation by the argument of $z$ and scaling by $|z|$, you can define the complex
inverse and complex square root simply using \mpl{angle} and \mpl{abs}.
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip -24pt
-\centerline{\includegraphics{complex-inverse-and-sqrt}}
-The interesting part of the left hand figure was drawn as follows:
-\begin{smallcode}
-input colorbrewer-rgb
-for i=1 upto 3:
- z[i] = (3/2 + 1/4 normaldeviate) * dir (16 i + normaldeviate);
- path a;
- a = z[i] scaled 42 -- origin -- zinverse(z[i]) scaled 42;
- drawarrow a cutafter fullcircle scaled 5 shifted point 2 of a
- withcolor SetTwo[7][2+i];
- drawdot point 0 of a withpen pencircle scaled dotlabeldiam;
- drawdot point 2 of a withpen pencircle scaled dotlabeldiam;
- drawdot point 2 of a withpen pencircle scaled 2 withcolor white;
-endfor
-\end{smallcode}
-The only difference on the right is that the drawing used "zsqrt()".
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip -84pt
+\centerline{\includegraphics{pairs-complex-inverse-and-sqrt}}
+\noindent
+The drawing uses the two functions defined on the left.
+\smallmpexternal[firstline=11,lastline=44,xleftmargin=0pt]{pairs-complex-inverse-and-sqrt.mp}
\vss}}
\smallskip\noindent
@@ -1470,9 +1260,9 @@
In other words you need to find a complex number with an argument that is the
negative of the argument of $z$ and a modulus that will scale $|z|$ to 1.
You can use the polar notation with "dir" to write this directly:
-\begin{code}
-vardef zinverse(expr z) = 1/abs z * dir - angle z enddef;
-\end{code}
+
+\mpexternal[firstline=6,lastline=6]{pairs-complex-inverse-and-sqrt.mp}
+
The complex division, $z/w$, can now be done as: \mpl{z zscaled zinverse(w)}.
The only difficulty with this function is how it deals with zero, or rather with
the point $(0,0)$. Since `\mpl{abs (0,0)}' gives $0$, the function will give you
@@ -1491,11 +1281,7 @@
This function also has a difficulty with the point $(0,0)$, because "angle (0,0)" is
not well defined, and so \MP\ throws an error. If you want a function that
correctly returns $(0,0)$ as its own square root, then try something like this:
-\begin{code}
-def zsqrt(expr z) =
- if abs z > 0: sqrt(abs z) * dir 1/2 angle fi z
-enddef;
-\end{code}
+\mpexternal[firstline=7,lastline=9]{pairs-complex-inverse-and-sqrt.mp}
\newpage
\subsubsection{Using complex numbers to draw fractals}
@@ -1503,57 +1289,10 @@
As an example of what you can do with complex arithmetic, here is a version of the
diagram from §4.1 of Knuth's \textsl{Seminumerical Algorithms} showing $S$, the set
of all points that can be written as $\sum_{k\ge1}a_k(i-1)^{-k}$.
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip -81pt
-\begin{smallcode}
-vardef fizz(expr X) =
- pair m, n;
- m = right;
- n = origin;
- numeric a, x;
- x = X;
- forever:
- exitif x = 0;
- m := m zscaled zinverse((-1, 1));
- a := x mod 2;
- n := n + a * m;
- x := x div 2;
- endfor
- n
-enddef;
-input colorbrewer-rgb
-color shade[];
-shade0 = Reds 5 4; shade1 = Oranges 5 4;
-shade2 = Greens 5 4; shade3 = Blues 5 4;
-
-beginfig(1);
- numeric s, t; s = 256; t = 4;
- for n=0 upto (s/t*s/t-1):
- numeric h, v;
- h = floor 1/8 (n mod 32);
- v = n mod 4;
- fill fullcircle scaled t shifted (fizz(n) scaled s)
- withcolor (1/2 + 1/8 v)[white, shade[h]];
- endfor;
-
- path xx, yy;
- xx = (left--right) scaled (s+8);
- yy = xx rotated 90;
- for i=-1 upto 1:
- draw xx shifted (0, s*i) withpen pencircle scaled 1/8;
- draw yy shifted (s*i, 0) withpen pencircle scaled 1/8;
- endfor
- dotlabel.lrt(btex $-1-i$ etex, (-1, -1) scaled s);
- dotlabel.lrt(btex $-1$ etex, (-1, 0) scaled s);
- dotlabel.lrt(btex $-1+i$ etex, (-1, 1) scaled s);
- dotlabel.lrt(btex $-i$ etex, (0, -1) scaled s);
- dotlabel.lrt(btex $+i$ etex, (0, 1) scaled s);
- dotlabel.lrt(btex $+1-i$ etex, (1, -1) scaled s);
- dotlabel.lrt(btex $+1$ etex, (1, 0) scaled s);
- dotlabel.lrt(btex $+1+i$ etex, (1, 1) scaled s);
-endfig;
-\end{smallcode}
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip -36pt
+\mpexternal[firstline=7,lastline=42,xleftmargin=0pt]{pairs-double-dragon.mp}
\vss}}
-$$\includegraphics[width=\textwidth]{double-dragon.pdf}$$
+$$\includegraphics[width=\textwidth]{pairs-double-dragon}$$
\vbox to 0pt{\noindent\small\textbf{Note}: you can adjust the “resolution” with the parameter $t$, but don't
make it smaller than 1 if you are using the default number system; the diagram looks
a bit strange unless $t$ is an integer power of 2.\vss}
@@ -1584,25 +1323,26 @@
As you can see, you can apply implicit multiplication to a \mpl{color}, so after
the declaration above "2 brg" would be a valid colour, although you have to think
a bit to know what that means in terms of colour in your drawings.
-\vadjust{\moveright 384pt\vbox to 0pt{\kern-72pt
+\vadjust{\moveright 396pt\vbox to 0pt{\kern-144pt\noindent
To use RGB hex strings, you'll need to write a function:
\begin{code}
vardef hexrgb(expr Spec) =
- save r, g, b;
- numeric r, g, b;
- r = hex(substring (1,3) of Spec);
- g = hex(substring (3,5) of Spec);
- b = hex(substring (5,7) of Spec);
- 1/256(r,g,b)
+ save r, g, b;
+ numeric r, g, b;
+ r = hex substring (1,3) of Spec;
+ g = hex substring (3,5) of Spec;
+ b = hex substring (5,7) of Spec;
+ 1/256(r,g,b)
enddef;
brg = hexrgb("#014225");
pbr = hexrgb("#df3439");
\end{code}
+\noindent\hey The \mpl{hex} function is a built-in primitive operation.
\vss}}%
Plain \MP\ defines five basic colour constants: \mpl{red}, \mpl{green},
\mpl{blue}, \mpl{white}, \mpl{black}. These are quite useful with leading
-fractions: \mpl{2/3 red} gives a nice dark red, that's good for drawing lines you
+fractions: \mpl{2/3 red} gives a nice dark red, that is good for drawing lines you
want to emphasize; \mpl{1/2 white} gives you a shade of grey; and so on. But since
\mpl{black} is defined as \mpl{(0,0,0)}, \mpl{1/2 black} just gives you \mpl{black}.
@@ -1612,21 +1352,9 @@
colour that is part way between two others. So \mpl{1/2[red, white]} gives you a
shade of pink, and \mpl{2/3[blue, white]} a sort of sky blue. You can also use this
idea to vary colour with data, as in \mpl{(r)[red, blue]} where \mpl{r} is some
-calculated value. \vadjust{\moveright 384pt\vbox to 0pt{\kern-36pt
-\begin{code}
-color brg; brg = 1/256 (1, 66, 37);
-color pbr; pbr = 1/256 (223, 52, 57);
-N = 5; n = 0;
-for y=1 upto N:
- for x=1 upto N:
- fill fullcircle scaled 16 shifted 20(x,y)
- withpen pencircle scaled 2
- withcolor (n/N/N)[pbr, brg];
- label(decimal incr n infont "phvr8r", 20(x,y))
- withcolor white;
- endfor
-endfor
-\end{code}\vss}}
+calculated value. \vadjust{\moveright 396pt\vbox to 0pt{\kern-64pt
+\mpexternal[firstline=6,lastline=18]{color-blend-toy.mp}
+\vss}}
Here's a toy example:
\vbox to 0pt{\centerline{\includegraphics[scale=0.8]{color-blend-toy}}\vss}
@@ -1635,56 +1363,26 @@
\subsection{CMYK colours}
\MP\ also implements a CMYK colour model, using tuples of four numerics.
-This is more or less a direct mapping onto the PostScript "cmykcolor" functions.
In this model the four components represent cyan, magenta, yellow, and black.
White is \mpl{(0,0,0,0)} and black is anything where the last component is 1.
-Beware however that the constants, \mpl{white} and \mpl{black} are defined in
-"plain.mp" as RGB colours, and you can't mix the two models, so anything like
-\mpl{1/2[(1,1,0,0), white]} will not work. If you want to do lots of work with CMYK colours
-you might like to redefine the color constants.
-$$\includegraphics[width=0.7\textwidth]{blended-color-circles}$$
+
+Beware that the five colour constants defined in "plain.mp" are defined as RGB
+colours, and you can't mix colour models, so anything like \mpl{1/2[(1,1,0,0),
+white]} will not work, unless you redefine the color constants as CMYK colours:
+\begin{smallcode}
+cmykcolor black, white, red, green, blue;
+black = (0,0,0,1); white = (0,0,0,0);
+red = (0,1,1,0); green = (1,0,1,0); blue = (1,1,0,0);
+\end{smallcode}
+$$\includegraphics[width=0.7\textwidth]{color-blended-circles}$$
\hey The apparent blending of colours here is done by calculating the overlaps
-and filling them in order. In plain \MP, there is no support for transparency in any of the
-colour models; this is because they are inherited directly from PostScript.
+and filling them in order. With plain "mpost", there is no support for transparency in any of the
+colour models; but "luamplib" gives you access to PDF transparency, see
+§\ref{sec:transparent}.
\moveright 384pt\vbox to 0pt{\vss
-\begin{code}
-% the illusion of blended colours is helped by buildcycle
-
-path C[], B[];
-
-% arrange each circle so that point 0 is outside the others
-C1 = fullcircle scaled 120 rotated 90 shifted 40 up;
-C2 = C1 rotated 120;
-C3 = C2 rotated 120;
-
-B0 = buildcycle(C1, C2, C3);
-B1 = buildcycle(C1, C2);
-B2 = buildcycle(C2, C3);
-B3 = buildcycle(C3, C1);
-
-picture P;
-for x=0 upto 1:
- for y=0 upto 1:
- P := image(
- s := 1/4 + x/2;
- k := 0 + y/4;
- fill C1 withcolor s*(1,0,0,k);
- fill C2 withcolor s*(0,1,0,k);
- fill C3 withcolor s*(0,0,1,k);
- fill B3 withcolor s*(1,0,1,k);
- fill B2 withcolor s*(0,1,1,k);
- fill B1 withcolor s*(1,1,0,k);
- fill B0 withcolor s*(1,1,1,k);
- undraw C1; undraw C2; undraw C3;
- ) shifted -(200x, 200y);
- draw P;
- label.bot(("shade: " & decimal s & ", k: " & decimal k)
- infont "phvr8r", point 1/2 of bbox P);
- endfor
-endfor
-\end{code}}
-
+\mpexternal[firstline=9,lastline=41]{color-blended-circles.mp}
+}
\newpage
\subsection{HSV colours}
@@ -1691,22 +1389,8 @@
HSV colours are colours defined by a triple of hue, saturation, and value.
Unlike RGB and CMYK colours there is no native support in \MP\ but it is possible to
write a routine that maps HSV triples into RGB colours:
-\begin{code}
-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)
- elseif hh < 3: (0,chroma,x)+(m,m,m)
- elseif hh < 4: (0,x,chroma)+(m,m,m)
- elseif hh < 5: (x,0,chroma)+(m,m,m)
- else: (chroma,0,x)+(m,m,m)
- fi
-enddef;
-\end{code}
+\mpexternal{color-hsv-macro.mp}
+\noindent
This is based on information from the Wikipedia article on
on “HSL and HSV”.
@@ -1719,110 +1403,22 @@
You can produce ranges of colour by changing hue, or make gradations of a single
colour by changing the saturation or value.
-\moveright 384pt\vbox to 0pt{\vss
-\begin{code}
-defaultfont := "phvr8r";
+\moveright 376pt\vbox to 0pt{\vss
+\mpexternal[firstline=5,lastline=31]{color-hsv-gamut.mp}}
-numeric s[], v[];
-s0 = 1/2; v0 = 7/8;
-s1 = 7/8; v1 = 7/8;
-s2 = 7/8; v2 = 1/2;
-for y=0 upto 2:
- for h=0 step 15 until 360:
- fill fullcircle scaled 24 shifted (h, -32y)
- withcolor hsv_color(h, s[y], v[y]);
- draw fullcircle scaled 24 shifted (h, -32y)
- withcolor white;
- if y=1:
- label(decimal h infont defaultfont scaled 1/2, (h,-16));
- fi
- endfor
-endfor
-
-label.urt("Less saturation", (-20,12));
-label.lrt("Lower value", (-20,-76));
-
-drawarrow (-15, -12) -- (-15,12);
-drawarrow (-15, -52) -- (-15,-76);
-\end{code}}
-
\newpage
-\subsubsection{An HSV example of a graduated scale}
+\subsection*{An HSV example of a graduated scale}
\noindent
-This example requires the \mpl{hsv_color} routine from the previous page.
-\mpic{12pt}{color-hsv-bathymetric}
-\begin{code}[xleftmargin=0pt]
-defaultfont := "phvr8r"; defaultscale := 3/4;
-path h,d,b; numeric n; n = 10;
-h = ((-2,0)--(0,0)--(-1,3)--(-2,3)--cycle) scaled 60;
-d = h rotated 180;
-b = subpath (0,1) of h -- point 1+1/n of d --
- (xpart point 0 of h, ypart point 1+1/n of d) -- cycle;
-fill b withcolor hsv_color(123, 1/8, 7/8);
-draw subpath (2.13,4) of b;
-for i=1 upto n:
- fill point 4-(i-1)/n of h -- point 1+(i-1)/n of h
- -- point 1+i/n of h -- point 4-i/n of h -- cycle
- withcolor hsv_color(42, 1/4 + 3/4 * i/n, 1 - i/3n);
- fill point 4-(i-1)/n of d -- point 1+(i-1)/n of d
- -- point 1+i/n of d -- point 4-i/n of d -- cycle
- withcolor hsv_color(200, i/n - 1/n, 1 - i/3n);
-endfor
-string s;
-for i=1 upto n-1:
- draw point 4-i/n of h -- point 1+i/n of h;
- draw point 4-i/n of d -- point 1+i/n of d;
- s := decimal if i < 4: (i**2+1) else: (10 + (i-3)*10) fi & "00";
- label.rt(s, point 1+i/n of h);
- label.lft(s, point 1+i/n of d);
-endfor
-label.rt("Metres", point 2 of h);
-label.lft("Metres", point 2 of d);
-label.lft("Hypsometric tints" infont defaultfont
- scaled defaultscale rotated 90, point 7/2 of h);
-label.rt("Bathymetric tints" infont defaultfont
- scaled defaultscale rotated -90, point 7/2 of d);
-label.lft("sea level", point 0 of h);
-label("areas below sea level", center b);
-draw h; draw d;
-\end{code}
+This example requires the \mpl{hsv_color} macro from the previous page.
+\mpic{2pt}{color-hsv-bathymetric}
+\mpexternal[firstline=7,lastline=39, xleftmargin=0pt]{color-hsv-bathymetric.mp}
-
-
\newpage
\subsection{Grey scale}
-\moveright5.5in\vbox to 0pt{\vskip6pt
-\begin{code}[xleftmargin=0pt]
-numeric s; s = 13;
-path atom;
-atom = origin
- -- (2s,0) rotated -30 -- (2s,0) rotated -30 + (0,s)
- -- ( s,0) rotated 30 -- ( s,0) rotated 30 + (0,s)
- -- (0,2s) -- cycle;
-
-picture p[];
-for i=0 upto 2:
- p[i] = image(
- fill atom rotated -120i withcolor (7/8 - 1/8i) ;
- draw atom rotated -120i;
- );
-endfor
-
-n = 13;
-for i=-n upto n:
- for j=-n upto n:
- forsuffixes $=0,1,2:
- draw p$ shifted ((3i*s,0) rotated -30
- + (0,floor(1/2i)*3s + 3j*s));
- endfor
- endfor
-endfor
-
-clip currentpicture to (unitsquare shifted -(1/2,1/2)
- xscaled 55.425s yscaled 30s);
-\end{code}
+\moveright5.4in\vbox to 0pt{\vskip6pt
+\mpexternal[firstline=5,lastline=36,xleftmargin=0pt]{color-grey-escher.mp}
\vss}
\noindent
The \mpl{withcolor} command will also take a single \mpl{numeric} instead of a 3-tuple or
@@ -1833,9 +1429,8 @@
between.
Grey scale is appropriate for some printed media, and can make effective textures
-and patterns.
-The code on the right was used to produce this:
-$$\includegraphics[width=\textwidth]{escher}$$
+and patterns. The pattern below was produced by this program \rightarrowfill
+$$\includegraphics{color-grey-escher}$$
First a basic path (named $\id{atom}$) is defined, then in the first loop three
picture variables, $p_1$, $p_2$, and $p_3$, are defined, each one rotated
120° from the previous and filled with a slightly darker shade of grey.
@@ -1843,49 +1438,23 @@
Finally the picture is clipped to a neat rectangle.
\newpage
-\subsubsection{Drawing algorithmic shadows}
-\moveright5.5in\vbox to 0pt{\vskip6pt
-\begin{code}[xleftmargin=0pt]
-path b, w;
-b = ((-3,-4)--(3,-2)--(3,+2)--(-3,4)--cycle) scaled 5;
-w = b reflectedabout(up, down);
-
-numeric n;
-n = 128;
-
-picture B, W;
-B = image(for i=0 step 1/n until 1:
- draw point 4-i of b -- point 1+i**2 of b
- withcolor 1-i**8;
- endfor);
-
- W = image(for i=0 step 1/n until 1:
- draw point 4-i of w -- point 1+i**2 of w
- withcolor 3/4-i**8;
- endfor);
-
-for i=-9 upto 9:
- for j=-4 upto 4:
- draw if odd (i+j): W else: B fi shifted (i*30,j*30);
- endfor
-endfor
-
-clip currentpicture to bbox currentpicture yscaled 7/8;
-\end{code}
+\subsection*{Drawing algorithmic shadows}
+\moveright5.25in\vbox to 0pt{\vskip6pt
+\mpexternal[firstline=5,lastline=32]{color-grey-shadows.mp}
\vss}
\noindent
Here is a more complex pattern, showing one way to create an
illusion of shadows with multiple fine lines.
-$$\includegraphics[width=\textwidth]{shadows}$$
+$$\includegraphics{color-grey-shadows}$$
The first part defines two wedge-shaped closed paths, $\id{w}$ being
the mirror image of $\id{b}$. Like the standard \id{unitsquare} path, the
path $\id{b}$ is defined so that point 0 is the bottom left corner.
-The two $\kw{picture}$ variables are produced
-by drawing lines across the shapes from bottom to top. By setting $n$ high enough,
-these multiple lines blend smoothly to give an even colour. And by using higher
-powers of the index variable, an effective shadow can be drawn ‘bunched up’ into the
-top of each shape.
+The two \<picture> variables are produced by drawing lines across the shapes from
+bottom to top. If you set the loop step small enough, these multiple lines blend smoothly to
+give an even colour. And by using higher powers of the index variable, an effective
+shadow can be drawn ‘bunched up’ into the top of each shape. Note that \MP\ likes
+integer powers of two.
By repeating them alternately in a grid, we get an effective texture, which is
clipped at the end to a neat rectangle again.
@@ -1896,24 +1465,15 @@
\moveright 384pt\vbox to 0pt{\vskip144pt\raggedright\hsize4in\noindent
This map shows the "RdYlBu[9]" palette in action on a map of the Brexit vote in
-London. The outlines are the 33 London boroughs, and the colours show how we voted,
-faded by turnout. The data and the outlines are from publicly-available UK
-government sources. They were prepared for \MP\ using various Python scripts, and
-they are available in the source for this document.
+London. The outlines are the 33 London boroughs, and the colours show how we voted.
+The size of the labels shows the turnout. The data and the outlines are from
+public domain sources. They were prepared for \MP\ using various scripts,
+and they are available in the source for this document.
-\vskip 72pt
+\vskip 48pt
Here is the code for the palette used as the legend:
-\begin{smallcode}
-input colorbrewer-rgb
-numeric s; s = 10;
-for i = 1 upto 9:
- fill unitsquare scaled s shifted (i*s, 0) withcolor RdYlBu[9][i];
- if i > 1: draw (i*s, 0) -- (i*s, s); fi
-endfor
-draw unitsquare xscaled 9s yscaled s shifted (s,0);
-label.top("Leave" infont "phvr8r", (s, s));
-label.top("Remain" infont "phvr8r", (10s, s));
-\end{smallcode}
+\mpexternal[firstline=9,lastline=9]{color-brexit-map.mp}
+\mpexternal[firstline=11,lastline=19]{color-brexit-map.mp}
\vss}
\noindent
@@ -1926,7 +1486,7 @@
package provides two files that define all the colour ranges; one for CMYK and
another for RGB; an example of usage is shown below on the right.
-$$\includegraphics[width=\textwidth]{brexit-map.pdf}$$
+$$\includegraphics[width=\textwidth]{color-brexit-map.pdf}$$
%--------------------------------------------
@@ -1934,46 +1494,9 @@
\section{Random numbers}
\MP\ provides us with two built-in functions to generate random numbers.
-\vadjust{\moveright 384pt\vbox to 0pt{\kern-24pt
-\begin{code}
-vardef dice(expr pip_count, pip_color) =
- save d,r,p, ul, ur, lr, ll;
- r=1/8; path d; picture p;
- d = for i=0 upto 3:
- quartercircle scaled 3 shifted (15,15) rotated 90i --
- endfor cycle;
- p = image(draw fullcircle scaled 6;
- fill fullcircle scaled 6 withcolor pip_color);
- pair ul, ur, ll, lr;
- ul = 1/5[ulcorner d, lrcorner d];
- lr = 4/5[ulcorner d, lrcorner d];
- ur = 1/5[urcorner d, llcorner d];
- ll = 4/5[urcorner d, llcorner d];
- image(fill d withcolor background; draw d;
- if odd(pip_count):
- draw p shifted center d;
- fi;
- if pip_count > 1:
- draw p shifted ul; draw p shifted lr;
- fi;
- if pip_count > 3:
- draw p shifted ur; draw p shifted ll;
- fi;
- if pip_count = 6:
- draw p shifted 1/2[ul,ur];
- draw p shifted 1/2[ll,lr];
- fi)
-enddef;
-
-beginfig(1);
-for i=0 upto 4:
- draw dice(1+floor uniformdeviate 6, red)
- rotated (2 normaldeviate)
- shifted (36i,0);
-endfor
-endfig;
-\end{code}
- $$\includegraphics{dice}$$
+\vadjust{\moveright 372pt\vbox to 0pt{\kern-24pt
+\mpexternal[firstline=5,lastline=39,xrightmargin=-36pt]{random-dice.mp}
+$$\includegraphics{random-dice}$$
\vss}}
\begin{itemize}
\item `$\kw{uniformdeviate}\,n$' generates a random real number between $0$ and
@@ -2003,7 +1526,7 @@
about 68.3\%; between $-2$ and 2, about 95.4\%.
\vadjust{\moveright 3.6in\vbox to 0pt{\hsize 1.6in \vskip21pt \noindent
\small 10000 samples suggest\\\kw{normaldeviate} works.\par\vss}}
- $$\includegraphics[width=4.6in]{gaussian}$$
+ $$\includegraphics[width=4.6in]{random-gaussian}$$
To relocate the mean, just add a constant. To rescale the distribution,
multiply by the desired standard deviation (the square root of the
desired variance).
@@ -2018,85 +1541,39 @@
implementation is based on the `Ratio method' presented in \textsl{The Art of
Computer Programming}, section~3.4.1. It turns out to be very straightforward to
implement the algorithm for this method as a user-level program $\longrightarrow$
-\vadjust{\moveright5.5in\vbox to 0pt{\kern -64pt
-\begin{smallcode}
-vardef normaldeviate =
- save u, v, xa;
- forever:
- forever:
- u := uniformdeviate 1;
- exitif (u>1/64);
- endfor
- v := sqrt(8/mexp(256)) * ( -1/2 + uniformdeviate 1 );
- xa := v/u;
- exitif ( xa**2 <= -mlog(u)/64 );
- endfor
- xa
-enddef;
-
-vardef exponentialdeviate =
- save u;
- forever:
- u := uniformdeviate 1;
- exitif (u>0);
- endfor
- -mlog(u)/256
-enddef;
-
-vardef gammadeviate(expr a,b) =
- save y, x, v, s, accept; boolean accept;
- s = sqrt(2a-1);
- forever:
- forever:
- y := tand(uniformdeviate 180);
- exitif y<64;
- endfor
- x := s * y + a - 1;
- accept := false;
- if x>0:
- v := uniformdeviate 1;
- if (v <= (1+y**2)*mexp((a-1)*mlog(x/(a-1))-(256*s*y))):
- accept := true;
- fi
- fi
- exitif accept;
- endfor
- x/b
- enddef;
-\end{smallcode}
+\vadjust{\moveright5.5in\vbox to 0pt{\kern -112pt
+\smallmpexternal{random-other-distributions.mp}
\vss}}%
-There are a couple points here. First, the inner loop around the assignment to $u$ is
-designed to avoid very small values that would cause $v/u$ to be larger than 64, and
-hence make "xa**2" overflow. This is a useful general technique, and justified in
-terms of the algorithm since large values of $v/u$ are rejected anyway. Secondly,
-the expression "sqrt(8/mexp(256))" is a constant ($ \sqrt{8/e} \simeq 1.71553 $) and could be
-replaced by it's value, but this does not make an appreciable improvement to the
+This version of \mpl{normaldeviate} is of academic interest only, in all real code
+you should use the primitive operation, but there are a couple of programming notes.
+If you put ‘\mpl{u = uniformdeviate 1}’, then you have $0 \le u < 1$, so $v/u$ might
+give you a divides-by-zero error; using ‘\mpl{u = 1 - uniformdeviate 63/64}’ ensures
+that $1/64 < u \le 1$, which not only avoids the possibility of a divide-by-zero
+error, but also ensures that $|(v/u)| < 64$, so that you can square it without
+overflow. This is a useful general technique, and justified in terms of the
+algorithm since large values of $v/u$ are rejected anyway. Secondly, the expression
+\mpl{sqrt(8/mexp(256))} is a constant ($ \sqrt{8/e} \simeq 1.71553 $) and could be
+replaced by its value, but this does not make an appreciable improvement to the
speed of the routine. On a modern machine, this routine is only very slightly
slower than using the primitive function.
+\medskip\noindent
It is also fairly straightforward to implement random number generators that follow other statistical
distributions. The mathematical details are in the section of \textsl{TOACP}
referenced above. Two examples, for the exponential distribution and the gamma
distribution, are shown on the right. In both cases, note the care required to avoid
-arithmetic overflow (and see section~\ref{trig} for the "tand" function).
+arithmetic overflow with the default scaled number system.
\medskip\label{mexp}\noindent
You can also see the special nature of \MP's \kw{mexp} and \kw{mlog}
functions. They are defined so that $\kw{mexp} x = \exp(x/256)$ and $\kw{mlog} x =256\log(x)$.
This is another artefact of the scaled number system. \MP\ computes $x^y$ using the
-formula "mexp(y*mlog(x))", and the adjusted log values give more accurate results.
+formula \mpl{mexp(y*mlog(x))}, and the adjusted log values give more accurate results.
Note that this means that you have $e=\kw{mexp}(256)$.
-\medskip\noindent
-At the start of each job, \MP\ automatically sets a new seed for the random number
-generator, so that the sequence of numbers is different each time. But you can set
-this yourself if you need the same sequence each time. At the start of your program
-you should put "randomseed:=3.14;" (or whatever value you prefer). According to
-\textsl{The Metafont Book}, the default value is
-$\id{day}+\id{time}\ast\id{epsilon}$, but in \MP\ the exact value used depends on
-the resolution of the timers available on your system; essentially the value
-should be different every time you run \MP.
+It is sometimes useful to define macros for the usual versions of $\exp$ and $\log$
+as shown on the right. This not only helps you make fewer programming mistakes, and
\newpage\subsection{Random walks}
@@ -2104,34 +1581,9 @@
You can use the random number generation routines to produce visualizations of
random walks, with various levels of analysis.
\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4.4in\kern -2\baselineskip
-\begin{code}
-beginfig(1);
-numeric w, h, n; w = 377; h = 80; n = 500;
-draw (origin--right) scaled w;
-draw (origin--right) scaled w shifted (0,+h/2) withcolor 3/4;
-draw (origin--right) scaled w shifted (0,-h/2) withcolor 3/4;
-pair zenith, nadir; zenith = nadir = origin;
-path walk[];
-for i=1 upto 8:
- numeric y; y = 0;
- walk[i] = origin for x=w/n step w/n until w:
- hide(
- y := y if uniformdeviate 1 < 1/2: + else: - fi 1;
- if y > ypart zenith: zenith := (x,y) ; fi
- if y < ypart nadir: nadir := (x,y) ; fi
- )
- -- (x,y)
- endfor;
- undraw walk[i] withpen pencircle scaled 3/4;
- draw walk[i] withcolor (1/2+y/h)[red, blue]
-endfor
-drawarrow (12 up -- 2 up) shifted zenith withcolor blue;
-drawarrow (12 down -- 2 down) shifted nadir withcolor red;
-endfig;
-\end{code}
-
+\mpexternal[firstline=5,lastline=31,xleftmargin=0pt]{random-walks-red-blue.mp}
\smallskip\noindent
-\hey Note the \mpl{undraw} line using a slightly thicker pen; this makes it
+\hey Note the \mpl{undraw} line using a slightly thicker pen; this makes it
easier to follow the lines as they cross each other.
\vss}}
$$\includegraphics[width=\textwidth]{random-walks-red-blue}$$
@@ -2150,32 +1602,40 @@
the value, or changing the odds in favour of one direction or the other. For
example:
\begin{code}
-y := y if uniformdeviate 1 < p: + 2 else: - 1 fi;
+y := y if uniformdeviate 1 < p: + 2 else: - 1 fi;
\end{code}
will set the delta to $+2$ with probability $p$ and and to $-1$ with probability $1-p$.
-\newpage\subsection{Brownian motion}
+\newpage
+\subsubsection{Random walks with different constraints}
-A random walk is normally constrained to move one unit at a time, but if you relax
+\textsc{Formally}, a random walk is constrained to move one unit at a time, but if you relax
that constraint and use `\kw{normaldeviate}' in place of `\kw{uniformdeviate}' you
-can get rather more interesting patterns.\vadjust{\moveright5.5in\vbox to 0pt{
-\hsize4in\kern -20pt
-\begin{code}
-beginfig(2);
-for n=1 upto 4:
- x:=y:=0;
- draw (x,y) for i=1 upto 2000:
- hide(x:=x+4normaldeviate; y:=y+4normaldeviate;)
- .. (x,y)
- endfor withcolor ((n+2)/9)[blue,white];
- fill fullcircle scaled 3 shifted (x,y) withcolor red;
-endfor
-% mark the origin
-fill fullcircle scaled 3 withcolor green;
-endfig;
-\end{code}
+may get more “realistic” patterns.
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4.2in\kern2\baselineskip\noindent
+The drawing here is much the same as the previous page, except that the definition of
+\id{walk} in the central loop is simplified to this:
+\mpexternal[firstline=15,lastline=18,xleftmargin=0pt]{random-walks-normal.mp}
+}}
+$$\includegraphics[width=\textwidth]{random-walks-normal}$$
+Alternatively you could add an extra constraint that the final value should be zero
+(or some other desired target value); this is the so-called “Brownian bridge”.
+$$\includegraphics[width=\textwidth]{random-walks-normal-bridge}$$
+To do this, you make a random walk path, as above, with \id{n} points, and then copy
+it into a new path where the $i$-th point is adjusted by $i/n\times(t-y)$ where $t$
+is the target value, and $y$ is the $y$-value of the last point on the walk path.
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4.2in\vss
+\mpexternal[firstline=7,lastline=23,xleftmargin=0pt]{random-walks-normal-bridge.mp}
+}}
-\kern 120pt
+\newpage\subsection{Brownian motion}
+
+Relaxing all the constraints, can give you even more
+interesting patterns.\vadjust{\moveright5.5in\vbox to 0pt{
+\hsize4.2in\vskip -32pt
+\mpexternal[firstline=6,lastline=20,xleftmargin=0pt]{random-two-dimensional-brownian.mp}
+
+\kern 84pt
\noindent
Using these random number generators means that the output is
different each time because \MP\ produces a different sequence of numbers. You may
@@ -2188,16 +1648,17 @@
randomseed := uniformdeviate infinity;
\end{code}
Now \MP\ writes the (random) value used in the log for you to copy. Note that if you are using
-"luamplib" you need to add the "\mplibshowlog{enable}" option.
+"luamplib" you need to add the "\mplibshowlog{enable}" option to get this value in
+the log.
\vss}}
If you also allow the $x$-coordinates to
wander at random as well as the $y$-coordinates you get two-dimensional random
patterns. And if you replace the straight line segments "--" with ".." so that \MP\
-draws a smooth curve through the points, as well as vary the colour each time
-you draw a new curve, then the result is almost artistic.
+draws a smooth curve through the points, then the result is almost artistic.
-\medskip\noindent
-\hbox to \textwidth{\includegraphics[width=1.2\textwidth]{brown3a}\hss}
+\vbox to 0pt{\noindent
+\hbox to \textwidth{\includegraphics[width=1.2\textwidth]{random-two-dimensional-brownian}\hss}
+\vss}
\newpage\subsection{Drawing freehand}
@@ -2207,45 +1668,7 @@
perhaps it would be better to say `translated' rather than `stolen'; moreover my
implementations are easier to use with plain \MP.\vadjust{\moveright5.5in\vbox to 0pt{
\hsize4in\kern -5.5\baselineskip
-\begin{smallcode}
-def freehand_segment(expr p) =
- point 0 of p {direction 0 of p rotated (4+normaldeviate)} ..
- point 1 of p {direction 1 of p rotated (4+normaldeviate)}
-enddef;
-def freehand_path(expr p) =
- freehand_segment(subpath(0,1) of p)
- for i=1 upto length(p)-1:
- & freehand_segment(subpath(i,i+1) of p)
- endfor
- if cycle p: & cycle fi
-enddef;
-defaultfont := "eurm10";
-color sepia; sepia = (0.44, 0.26, 0.08);
-picture marker; marker = image(for s=-1/2, 1/2:
- draw (left--right) scaled 2 rotated 60 shifted (s,0);
-endfor);
-def moved_along expr x of p = rotated angle direction x of p
- shifted point x of p enddef;
-
-beginfig(1);
-pair A, B, C, D;
-A = (0,-30); B = (180,0); C = (120,90);
-D = (1/2 + 1/40 normaldeviate)[A, B];
-path triangle, circumcircle, bisector;
-triangle = freehand_path(A--D--B--C--cycle);
-bisector = freehand_segment(C--D);
-circumcircle = freehand_path(A..B..C..cycle);
-draw triangle;
-draw bisector;
-draw circumcircle withcolor .67 red;
-draw marker moved_along 1/2 of triangle withcolor .67 red;
-draw marker moved_along 3/2 of triangle withcolor .67 red;
-label.lft("A", A);
-label.rt ("B", B);
-label.top("C", C);
-label.bot("D", D);
-endfig;
-\end{smallcode}
+\smallmpexternal[firstline=5,lastline=42,xleftmargin=0pt]{random-freehand-circumcircle.mp}
\vss}}
\subsubsection{Making curves and straight lines look hand drawn}
@@ -2269,48 +1692,11 @@
This second freehand figure uses a macro to draw a wonky line through two points
with a bit of overlap at each end. The overlap size is given using the suffix
-syntax. The lines are drawn in sepia ink to enhance the hand-drawn look. The angle
+syntax. The lines are drawn in sepia ink to enhance the hand-drawn look. The angle
labels are positioned on invisible arcs between neighbouring wonky lines.
\vadjust{\moveright5.5in\vbox to 0pt{
\hsize4in\kern -4.5\baselineskip
-\begin{code}[xleftmargin=0pt]
-vardef freehand_through@#(expr a, b) =
- save t; pair t;
- t = @# * unitvector(b - a) rotated (4 + normaldeviate);
- a - t .. a {t} .. b {t} .. b + t
-enddef;
-
-vardef mid_arc@#(expr p, a, b) =
- save c; path c;
- c = fullcircle scaled (2*@#) shifted p cutbefore a cutafter b;
- point arctime 1/2 arclength c of c of c
-enddef;
-
-beginfig(1);
-defaultfont := "eurm10"; color sepia; sepia = (0.44, 0.26, 0.08);
-pair A, B, C; A = (0,-30); B = (180,0); C = (120,90);
-
-path a, b, c;
-a = freehand_through 7 (A, B);
-b = freehand_through 8 (B, C);
-c = freehand_through 6 (C, A);
-
-drawoptions(withcolor sepia);
-draw a; draw b; draw c;
-
-drawoptions(withcolor .67 blue);
-label.bot ("a", point 3/2 of a);
-label.rt ("b", point 3/2 of b);
-label.ulft("c", point 3/2 of c);
-
-drawoptions(withcolor .5 red);
-label(char 11, mid_arc 16 (A, a, c));
-label(char 12, mid_arc 14 (B, b, a));
-label(char 13, mid_arc 14 (C, c, b));
-
-drawoptions();
-endfig;
-\end{code}
+\mpexternal[firstline=5,lastline=41,xleftmargin=0pt]{random-freehand-through.mp}
\vss}}
$$\includegraphics{random-freehand-through}$$
@@ -2319,8 +1705,8 @@
\noindent\llap{\nb\ }The AMS Euler font available to \MP\ as "eurm10" is encoded as a subset of the \TeX\
math italic layout --- essentially it has all the Greek letters but none of the
arrows, nor the musical notation.
-$$\includegraphics{euler-sampler}$$
-If you can't get the upper case $\Gamma$ at \mpl{char 0}, then you might be running
+$$\includegraphics{trad-euler-sampler}$$
+If you can't get the upper case $\Gamma$ at \mpl{char 0}, then you might be running
an old out-of-date version of "luamplib".
\newpage\subsection{Increasingly random shapes of the same size}
@@ -2331,26 +1717,7 @@
For these shapes the objective was to make them increasingly random, but to keep
them all the same length.\vadjust{\moveright5.5in\vbox to 0pt{
\hsize4in
-\begin{code}
-beginfig(1);
-numeric desired_length, n, s;
-desired_length = 180; n = 30; s = 80;
-
-for r=0 upto 8:
-
- path shape;
- shape = for i=1 upto n:
- (s + r * normaldeviate, 0) rotated (360/n*i) ..
- endfor cycle;
-
- shape := shape scaled (desired_length/arclength shape);
-
- draw shape shifted (r*s, 0) withcolor (r/8)[black,red];
- label(decimal r, (r*s, 0));
-
-endfor
-endfig;
-\end{code}
+\mpexternal[firstline=6,lastline=21,xleftmargin=0pt]{random-shapes.mp}
\vss}}
Each time round the outer loop the \id{shape} is redeclared to clear it, and
then redefined by an inline-loop with $n$ steps like
@@ -2373,101 +1740,45 @@
\newpage\subsection{Explosions and splashes}
Random numbers are also useful to make eye catching banners for posters,
-presentations, and infographics. Here are two simple example shapes: $\to$
-\mpic{18pt}{explode}
-
-\begin{smallcode}
-string heavy_font;
-heavy_font = "PlayfairDisplay-Black-osf-t1--base";
-
-randomseed:=2128.5073;
-
-beginfig(1);
-n = 40; r = 10; s = 50;
-path explosion, splash;
-explosion = for i=1 upto n:
- (s if odd(i): - else: + fi r + uniformdeviate r,0) rotated (i*360/n) --
-endfor cycle;
-
-splash = for i=1 upto n:
- (s if odd(i): - else: + fi r + uniformdeviate r,0) rotated (i*360/n) ..
-endfor cycle;
-splash := splash shifted (3s,0);
-
-fill explosion withcolor 1/2 green + red;
-draw explosion withpen pencircle scaled 2 withcolor 2/3 red;
-label("BOOM!" infont heavy_font scaled 2, center explosion)
- withcolor red;
-fill splash withcolor 1/2 green + blue;
-draw splash withpen pencircle scaled 2 withcolor 2/3 blue;
-label("SPLAT!" infont heavy_font scaled 2, center splash)
- withcolor blue;
-endfig;
-\end{smallcode}
-
+presentations, and infographics. Here are two simple example shapes \rightarrowfill
+\mwpic{0pt}{random-explosions}
+\mpexternal[firstline=8,lastline=29,xleftmargin=0pt]{random-explosions.mp}
\noindent
-In this figure "n" is the number of points in the shape, "r" is the amount of
-randomness, and :"s" is the radius used.
-In order to get a clear zig-zag outline, the loop alternately adds or subtracts "r";
-and then adds a random amount on top to make it look random.
-Notice that the only difference between the "explosion" and "splash" is that how
-the connecting lines are constrained to be straight or allowed to make smooth
-curves.\vadjust{\moveright5.5in\vtop to -2pt{\hsize 4in\vss\noindent
-The display font used here is one of the gems hidden away in "psfonts.map".
+In this figure $n$ is the number of points in the shape, $s$ is the radius, and $r$
+is the amount of randomness added to or removed from $s$. In order to get a clear
+zig-zag outline, the loop alternately adds or subtracts $r$; and then adds a random
+amount on top to make it look random. Notice that the only difference between the
+"explosion" and "splash" is that how the connecting lines are constrained to be
+straight or allowed to make smooth curves.
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent\small
+The display font used here is Playfair Display Black. If you have it installed
+as a system font, you can use "fontspec" and "luamplib" with "lualatex" as described
+in §\ref{sec:sa-lua-flow}, but if you are still using
+plain "mpost", then you need to hunt for it in your local "psfonts.map".
If you run \MP\ with the "-recorder" option, it will create a list of all the files
used, with the current job name and an extension of ".fls". This file will include
a line which tells you exactly which version of "psfonts.map" is being used.
-
The DVIPS documentation explains the format of the file, but for \MP's purposes the
-first word of each non-comment line defines a font name you can try. However beware
-that just because a name is defined in your map file, does not necessarily mean that
-you actually have the required PostScript font files installed as well. But if you have a
-full TexLive installation you will find that very many of them are already
-installed.\strut
-}}
+first word of each non-comment line defines a font name you can try. When you find
+it you can add something like this to the top of the example:
+\begin{smallcode}
+defaultfont = "PlayfairDisplay-Black-osf-t1--base";
+defaultscale = 3;
+\end{smallcode}}}
\newpage\subsection{Simulating jagged edges or rough surfaces}
You can use the idea of adding a little bit of noise to simulate a rough surface.
-$$\includegraphics[width=0.95\textwidth]{qed}$$
+\vadjust{\moveright5.25in\vbox to 0pt{\hsize 4in\vskip-12pt
+\smallmpexternal[firstline=6,lastline=37,xleftmargin=0pt]{random-qed.mp}
+\vss}}
+$$\includegraphics[width=0.95\textwidth]{random-qed}$$
These diagrams are supposed to represent light rays reflecting from a surface: on
the left the surface is smooth ($r=0$) and on the right it's rough ($r=0.42$).
The parameter $r$ is used in the \MP\ program as a scaling factor for the random
noise added to each point along the rough surface; the only difference in the code
to produce the two figures was the value of $r$.%
-\vadjust{\moveright5.5in\vbox to
- 0pt{\hsize 4in\vss
-\begin{smallcode}
-def perpendicular expr t of p =
- direction t of p rotated 90 shifted point t of p
- enddef;
-
-beginfig(1);
-u = 5mm; r = 0.42; n = 32; s = 8u; theta = -45;
-
-path base;
-base = origin
- for i=1 upto n-1: -- (i/n*s,r*normaldeviate) endfor
- -- (s,0) -- (s,-u) -- (0,-u) -- cycle;
-fill base withcolor .8[blue,white];
-draw base withcolor .67 blue;
-
-path ray[];
-for i=2 upto 6:
- ray[i] = (left--right) scaled 2/3 s rotated theta shifted (i*u,0);
- b := ypart (ray[i] intersectiontimes base);
- ray[i] := point 0 of ray[i]
- -- point b of base
- -- point 0 of ray[i]
- reflectedabout(point b of base, perpendicular b of base);
- drawarrow ray[i];
-endfor
-
-label("r=" & decimal r, center base);
-endfig;
-\end{smallcode}
-\vss}}
First the base block is created with some noise on the upper side. Then five rays
are created. Applying \mpl{ypart} to the pair of times returned by
\mpl{intersectiontimes} gives us the point of the base where the incident ray hits
@@ -2487,45 +1798,21 @@
It's also possible to use a random
walk approach so that each random step takes account of the previous one to avoid
any big jumps. Here's one way to do that.
-$$\includegraphics{torn-edge-straight}$$
-\begin{code}
-path t; numeric x, y;
-x = 0; y=0;
-t = (x, -20) -- (x, y) for i=1 upto 288:
- -- (incr x, walkr y)
- endfor -- (x, -20) -- cycle;
-draw t withcolor .67 blue;
-\end{code}
+$$\includegraphics{random-torn-straight-edge}$$
+\mpexternal[firstline=6,lastline=12]{random-torn-straight-edge.mp}
+
+\noindent
The "walkr" routine works like the "incr" and "decr" commands; it updates the value of the
argument. The idea is that the further away from zero you are, the more likely is
that the next value will take you back towards zero.
-\begin{code}
-vardef walkr suffix $ =
- $ := $ if uniformdeviate 1 < (2**-abs($)): + else: - fi
- signr $; $
- enddef;
-vardef signr suffix $ =
- if $<0: - else: + fi uniformdeviate 1
- enddef;
-\end{code}
+\mpexternal{random-torn-edge.mp}
You can use this to produce more realistic torn edges. You can also apply this as a
form of jitter to a curved path, by adding a suitably rotated vector to enough
-points along the path.
+points along the path, as shown in the example on the right.\rightarrowfill
\moveright5.5in\vbox to 0pt{\kern-4in
-\begin{code}
-path c; c = fullcircle scaled 200;
-draw c withcolor .8 white;
-
-y=0; n = 600;
-path t; t = for i=0 upto n-1:
- point i/n*length(c) of c
- + (0, walkr y) rotated angle direction i/n*length(c) of c
- --
-endfor cycle;
-draw t withcolor .67 red;
-\end{code}
-$$\includegraphics{torn-edge-circle}$$
+\mpexternal[firstline=6,lastline=16]{random-torn-edge-circle.mp}
+$$\includegraphics{random-torn-edge-circle}$$
\vss}
@@ -2536,21 +1823,7 @@
Here is the equilateral triangle point macro in action.
$$\includegraphics{geometry-triangles-on-circle}$$
\vskip -12pt
-\begin{code}
-beginfig(1);
-path c; c = fullcircle scaled 144;
-pair a,b,p,q;
-for i=0 upto 7:
- a := point i of c;
- b := point i+1 of c;
- p := equilateral_triangle_point(a,b);
- q := equilateral_triangle_point(b,a);
- draw a -- p -- b withcolor .67 green;
- draw a -- q -- b withcolor .67 red;
-endfor
-draw c withcolor .53 blue;
-endfig;
-\end{code}
+\mpexternal[firstline=8,lastline=21,xleftmargin=0pt]{geometry-triangles-on-circle.mp}
\vss}}%
This section deals with drawing geometrical figures that involve lines,
angles, polygons, and circles. Plain \MP\ provides very few tools that are
@@ -2588,11 +1861,7 @@
enddef;
\end{code}
And if you want to get right back to primitives you could even write that as:
-\begin{code}
-vardef equilateral_triangle_point(expr a, b) =
- b shifted -a rotated 60 shifted a
-enddef;
-\end{code}
+\mpexternal[firstline=5,lastline=7]{geometry-triangles-on-circle.mp}
\newpage
@@ -2599,29 +1868,28 @@
\subsection{Bisecting lines and paths}
\moveright5.5in\vbox to 0pt{\hsize4in\noindent
-$$\includegraphics{mediation-pitfall}$$
+$$\includegraphics{geometry-mediation-pitfall}$$
\vskip 50pt
-$$\includegraphics[width=4in]{mediation-shapes}$$
+$$\includegraphics[width=4in]{geometry-mediation-shapes}$$
\bigskip
-$$\includegraphics[width=4in]{mediation-sallows}$$
+$$\includegraphics[width=4in]{geometry-mediation-sallows}$$
\centerline{\textsl{Lee Sallows' theorem of median triangles}}
\vss}
\noindent
-The best way to bisect a line depends on how you have defined it.
-If you have two pairs $a$ and $b$, then the simplest way to find
-the pair that bisects them is to write "1/2[a,b]". This mediation
-mechanism is entirely general, so you can write \mpl{1/3[a,b]}, "1/4[a,b]", and
+\textsc{The best way to bisect} a line depends on how you have defined it.
+If you have two \<pair>s $a$ and $b$, then the simplest way to find
+the \<pair> that bisects them is to write "1/2[a,b]". This mediation
+mechanism is entirely general, so you can write "1/3[a,b]", "1/4[a,b]", and
so on to define other pairs that are part of the way from $a$ to $b$.
-The expression "0[a,b]" is equal to $a$, and "1[a,b]" is equal to $b$;
-but the number before the left bracket does not have to
+But the number before the left bracket does not have to
be confined to the range $(0,1)$. If you write "3/2[a,b]" you will get a pair on
the extension of the line from $a$ to $b$ beyond $b$. To get a pair going the
other way you can either reverse $a$ and $b$, or use a negative number; but don't
get caught out by the \MP\ precedence rules: "-1/2[a,b]" is interpreted as
"-(1/2[a,b])" and not as "(-1/2)[a,b]", so either put in the parentheses or swap
-the order of the pairs: "(3/2)[b,a]". See $\longrightarrow$.
+the order of the pairs: "(3/2)[b,a]". See \rightarrowfill
-If you want to work with a \kw{path} variable, rather than separate \kw{pair}
+If you want to work with a \<path> variable, rather than separate \<pair>
variables, you can
use the \mpl{point t of p}
notation to do mediation along the path. For a simple straight path $p$ of length 1
@@ -2632,18 +1900,17 @@
\begin{code}
point arctime 1/2 arclength p of p of p
\end{code}
-If your path is closed, and makes a triangle or a regular polygon,
-then you can bisect it with the line
+If your path makes a regular polygon, then you can bisect the shape with the line
\begin{code}
point t of p -- point t + 1/2 length p of p
\end{code}
-\textbf{NB}: if the polygon has an odd number of sides, then $2t$ must be a whole
-number.
+\noindent
+\hey If the polygon has an odd number of sides, then $2t$ must be a whole number.
-\smallskip\noindent
-In a triangle these bisecting lines are called medians. The three medians intersect
+\vfill\noindent
+\textsc{In a triangle} these bisecting lines are called medians. The three medians intersect
at the centroid of the triangle. The centroid is a good place to put a label on a
-triangle. You could find it \mpl{intersectionpoint} or with
+triangle. You could find it using the macro from \ref{polygons}, or with
a construction using \mpl{whatever} on any two medians, but since we know that the centroid
divides each median in the ratio $2:1$ we can find the centroid of a triangle path
$p$ most simply with:
@@ -2650,15 +1917,15 @@
\begin{code}
z0 = 2/3[point 0 of p, point 3/2 of p];
\end{code}
-The median is the basis for several beautiful theorems about the geometry of the
+The median lines are the basis for several beautiful theorems about the geometry of the
triangle. The theorem shown here was first published in 2014.
\newpage
\subsection{Bisecting angles}\label{sec:bisect}
\moveright5.5in\vbox to 0pt{\hsize4in\noindent
-$$\includegraphics{bisection-euclidean}$$
+$$\includegraphics{geometry-bisection-euclidean}$$
\smallskip
-$$\includegraphics{bisection-vector}$$
+$$\includegraphics{geometry-bisection-vector}$$
\vss}
\noindent
In an equilateral triangle the medians also bisect the angles at each vertex; this
@@ -2677,7 +1944,7 @@
$e = \frac12[p,q]$
instead of calling the triangle macro at all. However the macro is still making two
calls to \mpl{intersectionpoint}. If you wanted to eliminate this you could use the
-useful plain \MP\ macro "unitvector" to produce a solution based on adding two equal
+useful plain \MP\ macro \mpl{unitvector} to produce a solution based on adding two equal
length vectors from the corner to the two other points. Another approach is to
exploit another geometric theorem that states that the bisector of an angle in a
triangle divides the opposite side in the ratio of the two other sides.
@@ -2685,7 +1952,7 @@
be ${p\over p+q}={1\over1+q/p}$ from $A$ to $C$, and you can express this
simply using \MP's mediation syntax:
\vbox to 0pt{
-$$\includegraphics{bisection-interior}$$
+$$\includegraphics{geometry-bisection-interior}$$
\vss}
\newpage
@@ -2693,23 +1960,12 @@
There is no classical method to trisect an arbitrary angle, so you need to resort
to measuring and arithmetic in \MP. If the angle is a given this is trivial:
-\mpic{-12pt}{trisection-simple.pdf}
-\begin{smallcode}
-path ray;
-numeric theta;
-ray = origin -- 200 right;
-theta = 42;
-draw ray;
-draw ray rotated 1/3 theta withcolor 2/3 red;
-draw ray rotated 2/3 theta withcolor 2/3 red;
-draw ray rotated theta;
-dotlabel.llft("$0$", origin);
-label("$\theta/3$", 72 right rotated 1/6 theta);
-label("$\theta/3$", 72 right rotated 3/6 theta);
-label("$\theta/3$", 72 right rotated 5/6 theta);
-\end{smallcode}
+\mpic{-12pt}{geometry-trisection-simple}
+\smallmpexternal[firstline=6,lastline=17]{geometry-trisection-simple.mp}
+
+\noindent
But if you have only the coordinates of some points then you need to use the
-\mpl{angle} primitive to measure the angle first; \mpl{angle} takes a \kw{pair}
+\mpl{angle} primitive to measure the angle first; \mpl{angle} takes a \<pair>
argument and returns a numeric representing the angle in degrees measured clockwise
from the $x$-axis to a line through the origin and the point represented by the pair.
This definition means that if you have three points $A$, $B$, and $C$, then you can
@@ -2722,13 +1978,13 @@
(angle (P-Q) - angle (R-Q)) * turningnumber (P--Q--R--cycle) mod 360
enddef;
\end{smallcode}
-The primitive \mpl{turningnumber} is explained on p.\thinspace 111 of \textsl{The
-METAFONTbook}. It takes a closed path and returns number of times that you would
+The primitive \mpl{turningnumber} is explained on p.\thinspace 111 of \mfbook.
+It takes a closed path and returns number of times that you would
turn through 360${}^\circ$ if you traversed the path. We use this here to
negate the measured angle if necessary, so that you always get the interior angle.
The \mpl{mod 360} on the end ensures that the result is in the range $0 \le \theta <
360$. Armed with a measured angle, all you then need is arithmetic.
-\mpic{-160pt}{trisection-classical.pdf}
+\mpic{-160pt}{geometry-trisection-classical}
It might be possible to use the \id{solve} macro to simulate the Neusis construction
(that allows you to measure a length) illustrated on the right, but measuring the
angles is rather easier.
@@ -2738,27 +1994,15 @@
\moveright5.5in\vbox to 0pt{\hsize4in\noindent
\centerline{A puzzle square featuring some intersections}
-$$\includegraphics[width=3in]{magic-square-14}$$
+$$\includegraphics[width=3in]{geometry-magic-square-14}$$
The points were defined like this (the order was important).
-\begin{code}
-z1 = (10,10);
-z4 = 144 right rotated 12;
-z5 = z4 shifted (2, 78);
-z7 = z4 reflectedabout(origin, (1,1));
-
-z2 = 1/2 [z5, z7];
-z9 = whatever [z1, z4];
-z2-z9 = whatever * (z7-z1);
-z8 = whatever [z1, z5] = whatever [z2, z4];
-z3 = whatever [z2, z9] = whatever [z4, z7];
-z6 = whatever [z1, z7] = whatever [z3, z5];
-\end{code}
+\mpexternal[firstline=8,lastline=18]{geometry-magic-square-14.mp}
\vss}
\noindent
If you have line segments defined by their endpoints, then the
canonical way to find their intersection, is to use
the mediation syntax with \id{whatever} twice:
-$$\includegraphics[width=\textwidth]{whatever.pdf}$$
+$$\includegraphics{geometry-whatever}$$
The mediation syntax works even if the intersection point does not actually lie on
either of the two line segments. The intersection will be the point where the two
(infinite) lines through the pairs of points meet. If the two lines are parallel,
@@ -2781,7 +2025,7 @@
\subsubsection{The intersection algorithm}
\MP\ inherits a fast algorithm for finding the intersection between two paths from
-\MF. It is explained rather more gnomically than usual at the end of Chapter 14 of
+\MF. It is explained rather more succinctly than usual at the end of Chapter 14 of
\mfbook, with more detail given in the web source for \MF. The core algorithm works
on paths of length 1. If you have longer paths, \MP\ works its way along the paths
applying the core algorithm to successive pairs of unit subpaths. It does this is
@@ -2798,14 +2042,12 @@
point $t$ of $A$ will be very close to point $u$ of $B$, as they both refer to the
same intersection point. If you want the alternative point that is earlier on $B$,
then use `$B \mathbin{\textrm{intersectiontimes}} A$'
-instead.\mpic{-222pt}{intersection-AB-or-BA}
+instead.\mpic{-222pt}{geometry-intersection-AB-or-BA}
\vfill\noindent
When we get down to paths of length 1, the algorithm works something like this:
-$$
-\includegraphics{intersection-algorithm}
-$$
+$$\includegraphics{geometry-intersection-algorithm}$$
\vadjust{\moveright 384pt\vbox to 0pt{\hsize 4.2in\vss \noindent
The two paths are represented as rectangles that enclose the end points and the
control points for each path. If these rectangles don't overlap then there is
@@ -2817,7 +2059,7 @@
the subpaths enclosed by these two tiny rectangles, which is why they do not always
refer to exactly the same point.}}
-\subsubsection{Finding all intersection points}
+\subsubsection{Finding all intersection points}\label{sec:allxp}
As noted above, the \mpl{intersectiontimes} algorithm will stop at the first
intersection of the two paths, but it is possible that the two paths will intersect
@@ -2853,10 +2095,10 @@
the second iteration. If you need to avoid the repeated use of \mpl{xpart} and
\mpl{ypart}, one alternative is to do this inside the loop:
\begin{smallcode}
- ...
- numeric t, u;
- (t, u) = A intersectiontimes B;
- ...
+...
+numeric t, u;
+(t, u) = A intersectiontimes B;
+...
\end{smallcode}
Now the numerics are reset each time and the equation is not inconsistent.
\vadjust{\moveright 384pt\vbox to 0pt{\hsize 4.2in\vss \noindent
@@ -2865,7 +2107,7 @@
But it
is possible to create quite long paths of unit \mpl{length} and these may intersect
each other more than once, like so:
-$$\includegraphics{intersection-only-two}$$
+$$\includegraphics{geometry-intersection-only-two}$$
Here the two paths $A$ and $B$ are Bézier splines of with \mpl{length=1}, so the
normal \MP\ algorithm is only ever going to give you one of the intersections. In
the diagram above, the
@@ -2875,18 +2117,10 @@
The most reliable approach is to take a copy of one of the paths, and snip it off at
the intersection and try again until there is nothing left to snip.
-$$\includegraphics{intersection-all-three}$$
+$$\includegraphics{geometry-intersection-all-three}$$
The three points marked here were captured like this:
-\begin{code}
-pair P[]; numeric n; n=0;
-path R; R := A; % take a copy of A
-forever:
- R := R cutbefore B; % snip where we cross B
- exitif length cuttings = 0; % stop if nothing was cut
- P[incr n] = point 0 of R; % capture the point
- R := subpath (epsilon, infinity) of R; % nudge along
-endfor
-\end{code}
+\mpexternal[firstline=13,lastline=20]{geometry-intersection-all-three.mp}
+\noindent
This technique also works on paths with \mpl{length} greater than one,
so you may prefer it as your general “get all the intersections” approach.
Note that the \mpl{cutbefore} macro is defined using \mpl{intersectiontimes}.
@@ -2899,7 +2133,7 @@
Given five known points --- $A$, $B$, $C$, $D$, and $E$ --- \MP\ can find the point $F$
on the line $A \to B$, so that $E \to F$ is parallel to $C \to D$ like this:
-\mpic{0pt}{parallel}
+\mpic{0pt}{geometry-parallel}
\begin{code}
F = whatever[A, B]; % F is on the line A..B
E-F = whatever * (C-D) % E..F || C..D
@@ -2954,7 +2188,7 @@
The canonical way to draw a circle in plain \MP\ is to use the pre-defined path
\mpl{fullcircle} with a suitable transformation.
-\mpic{-12pt}{drawing-circles.pdf}
+\mpic{-12pt}{geometry-drawing-circles}
The path is defined (in "plain.mp") using two \MP\ primitive commands:
\begin{code}
path fullcircle; fullcircle = makepath pencircle;
@@ -2980,14 +2214,8 @@
draw fullcircle scaled abs (B-A) shifted 1/2[A,B];
\end{code}
Finally three points define a unique circle [\green{III}]:
-\begin{code}
-vardef circle_through(expr A, B, C) =
- save o; pair o;
- o = whatever * (A-B) rotated 90 shifted 1/2 [A,B]
- = whatever * (B-C) rotated 90 shifted 1/2 [B,C];
- fullcircle scaled 2 abs (A-o) shifted o
-enddef;
-\end{code}
+\mpexternal[firstline=27,lastline=32]{geometry-drawing-circles.mp}
+\noindent
Plain \MP\ also defines \id{halfcircle} and \id{quartercircle}, as the appropriate
subpaths of \id{fullcircle}, both starting at point 0 (3 o'clock). Curiously, this
differs from \MF\ where \id{quartercircle} is defined first, and the other two
@@ -2997,45 +2225,26 @@
$(34.5,21)$ to $(34,21.5)$.
\newpage
-\subsection{Incircle and excircle of a triangle}
+\subsection{Incircle and excircles of a triangle}
-The incircle of a triangle is the largest circle contained in the triangle.
+\textsc{The incircle of a triangle} is the largest circle contained in the triangle.
The centre of the incircle lies at the intersection of the internal angle bisectors.
So we can use ideas from §\ref{sec:bisect} and §\ref{sec:intersect} to define a
macro that returns the required path given points $A$, $B$, and $C$:
-\mxpic{-1in}{5in}{incircle}
-\begin{code}
-vardef incircle(expr A,B,C) =
- save a, b, m, t; pair a, b, m, t;
- a = A + unitvector (C-A) + unitvector (B-A);
- b = B + unitvector (A-B) + unitvector (C-B);
- m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
- t-m = whatever * (B-A) rotated 90;
- fullcircle scaled 2 abs (t-m) shifted m
-enddef;
-\end{code}
+\mpic{-1in}{geometry-incircle}
+\mpexternal[firstline=11,lastline=18]{geometry-incircle.mp}
-\bigskip\noindent
-The excircles of a triangle are the three circles lying outside the triangle and
+\vfill\noindent
+\textsc{The excircles of a triangle} are the three circles lying outside the triangle and
tangent to one edge and the extensions of the other two. The centres of each
excircle lie at the intersection of one internal angle bisector and the external
angle bisector of one of the other corners.
-
To get the external angle bisector,
-all you have to do is reverse the direction of one of the \mpl{unitvector} calls:
-\mxpic{0pt}{5in}{excircle}
-\begin{code}
-vardef excircle(expr A,B,C) =
- save a, b, m, t; pair a, b, m, t;
- a = A + unitvector (C-A) - unitvector (B-A);
- b = B + unitvector (A-B) + unitvector (C-B);
- m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
- t-m = whatever * (B-A) rotated 90;
- fullcircle scaled 2 abs (t-m) shifted m
-enddef;
-\end{code}
-
-\smallskip\noindent
+all you have to do is reverse the direction of one of the \mpl{unitvector} calls
+(can you see why?)
+\mpic{-.5in}{geometry-excircle}
+\mpexternal[firstline=11,lastline=18]{geometry-excircle.mp}
+\noindent\hey
To get the other excircles, call the macro with the points in a different order.
\newpage
@@ -3045,113 +2254,52 @@
already have the corners of your triangle as separate \<pair> variables, you can
use the \mpl{circle_through} macro from §\ref{sec:circles}. Or you can adapt the
macro to take a single triangular path:
-\begin{smallcode}[xleftmargin=0pt, xrightmargin=-60pt]
-vardef circumcircle(expr T) =
- save m; pair m;
- m = whatever * (point 0 of T - point 1 of T) rotated 90 shifted point 1/2 of T
- = whatever * (point 1 of T - point 2 of T) rotated 90 shifted point 3/2 of T;
- fullcircle scaled 2 abs (point 0 of T - m) shifted m
-enddef;
-\end{smallcode}
-Note that as the diagram on the right shows,\mxpic{-2in}{4.6in}{circumcircle}
+\smallmpexternal[firstline=11,lastline=16,xleftmargin=0pt, xrightmargin=-60pt]{geometry-circumcircle.mp}
+\noindent
+Note that as the diagram on the right shows,\mpic{-2in}{geometry-circumcircle}
the centre of the circumcircle is the intersection of all three of the perpendicular bisectors of
sides, but for the purposes of drawing in \MP\ you only need to find the
-intersection of two of them. You could write
+intersection of two of them. You could write
\begin{smallcode}[xleftmargin=0pt, xrightmargin=-60pt]
- m = whatever * (point 0 of T - point 1 of T) rotated 90 shifted point 1/2 of T
- = whatever * (point 1 of T - point 2 of T) rotated 90 shifted point 3/2 of T
- = whatever * (point 2 of T - point 3 of T) rotated 90 shifted point 5/2 of T;
+ m = whatever * (point 0 of T - point 1 of T) rotated 90 shifted point 1/2 of T
+ = whatever * (point 1 of T - point 2 of T) rotated 90 shifted point 3/2 of T
+ = whatever * (point 2 of T - point 3 of T) rotated 90 shifted point 5/2 of T;
\end{smallcode}
but this does not add any more information to the equation for $m$, and
-\MP\ will sometimes give you an “inconsistent equation” error if your triangle
+\MP\ will sometimes give you an “inconsistent equation” error if your triangle
is long and thin.
\vfill
\noindent
\hey The marks that show line segments are equal were created by this macro.
-\begin{code}
-vardef mark_equal(expr a, b, n) =
- save m, s; numeric s; 2s = n - 1;
- picture m; m = image(for t=-s upto s:
- draw (down--up) scaled 2 rotated -13 shifted (t,0)
- withpen pencircle scaled 1/4;
- endfor);
- draw m rotated angle (b-a) shifted 1/4[a,b];
- draw m rotated angle (b-a) shifted 3/4[a,b];
-enddef;
-\end{code}
-Given the triangular \<path> $T$, the macro was used like this:
+\smallmpexternal[firstline=38,lastline=47]{geometry-circumcircle.mp}
+Given the triangular \<path> $T$, the macro was used like this:
$\longrightarrow$\vadjust{\moveright5.5in\vbox to 0pt{\vss
-\begin{code}
-mark_equal(point 0 of T, point 1 of T, 1);
-mark_equal(point 1 of T, point 2 of T, 2);
-mark_equal(point 2 of T, point 0 of T, 3);
-\end{code}}}
+\smallmpexternal[firstline=49,lastline=51]{geometry-circumcircle.mp}
+}}
\newpage
\subsection{The nine-point circle of a triangle}
-The orthocentre of a triangle is the point is the intersection of the three
+The orthocentre of a triangle is the point at the intersection of the three
altitudes, shown as point $D$ below.
The point $N$, half-way from $D$ to the
circumcentre $M$ is the centre of the remarkable nine-point circle which passes
through the bases of the three altitudes and bisects the six line segments $AB$, $AC$, $AD$,
-$BC$, $BD$, and $CD$.\vadjust{\moveright5.2in\vbox to 0pt{\hsize 4in\vskip-80pt\noindent
-\begin{smallcode}
-pair A, B, C, D, N, M, p, q, r;
-A = origin; B = 377 dir 10; C = 233 dir 70;
-% pedal points (not labelled)
-p = whatever[B, C]; A - p = whatever * (B-C) rotated 90;
-q = whatever[C, A]; B - q = whatever * (C-A) rotated 90;
-r = whatever[A, B]; C - r = whatever * (A-B) rotated 90;
+$BC$, $BD$, and $CD$.\vadjust{\moveright5.25in\vbox to 0pt{\hsize 4in\vskip-88pt\noindent
+\smallmpexternal[firstline=6,lastline=52,xleftmargin=0pt]{geometry-nine-point-circle.mp}
+\vss}}
-D = whatever[A, p] = whatever[B, q];
-N = 1/4(A + B + C + D); % remarkably...
-M = D rotatedabout(N, 180); % M is also the circumcentre
+\smallskip
-path circumcircle, nine_point_circle;
-nine_point_circle = fullcircle scaled 2 abs(N - 1/2[A, B]) shifted N;
-circumcircle = fullcircle scaled 2 abs(M - A) shifted M;
+$$\includegraphics{geometry-nine-point-circle}$$
-draw nine_point_circle withcolor 3/4 red;
-draw circumcircle withcolor 1/2[3/4 blue, white];
-
-drawoptions(dashed evenly scaled 1/4 withcolor 1/2);
-draw 1/2[A,B] -- M -- 1/2[B, C];
-draw 1/2[C,A] -- M -- D;
-draw A -- p;
-draw B -- q;
-draw C -- r;
-
-% show the nine points with small circle markers
-drawoptions(withpen pencircle scaled 1/4);
-draw fullcircle scaled 2 shifted 1/2[A, B];
-draw fullcircle scaled 2 shifted 1/2[A, C];
-draw fullcircle scaled 2 shifted 1/2[A, D];
-draw fullcircle scaled 2 shifted 1/2[B, C];
-draw fullcircle scaled 2 shifted 1/2[B, D];
-draw fullcircle scaled 2 shifted 1/2[C, D];
-draw fullcircle scaled 2 shifted p;
-draw fullcircle scaled 2 shifted q;
-draw fullcircle scaled 2 shifted r;
-
-drawoptions();
-draw A--B--C--cycle;
-dotlabel.llft("$A$", A);
-dotlabel.rt("$B$", B);
-dotlabel.ulft("$C$", C);
-dotlabel.urt("\ $D$", D);
-dotlabel.llft("$M$", M);
-dotlabel.llft("$N$", N);
-\end{smallcode}\vss}}
-$$\includegraphics[width=\textwidth]{nine-point-circle}$$
-
\newpage
\subsection{Lines tangent to a point on a path}
\MP\ represents paths internally as a sequence of nodes. Each node consists of three
-pairs: the pre-control point, the point itself, and the post-control point.
-\mpic{0pt}{tangents-on-path}%
+pairs: the pre-control point, the point itself, and the post-control point.
+\mpic{0pt}{geometry-tangents-on-path}%
For a given path $p$ you can extract these points at time $t$ with these operators:
\begin{code}
precontrol t of p
@@ -3159,7 +2307,7 @@
postcontrol t of p
\end{code}
Unless you explicitly set them differently, \MP’s curve fitting will make these
-three points co-linear, so you can draw a tangent at point $t$ with
+three points co-linear, so you can draw a tangent at point $t$ with
\begin{code}
draw precontrol t of p -- postcontrol t of p;
\end{code}
@@ -3167,7 +2315,7 @@
like this depends on the size and shape of the curve, but it is somewhat arbitrary.
So you may prefer to extract a \<pair> representing the tangent at point $t$ with
\begin{code}
-pair d; d = postcontrol t of p - precontrol t of p;
+pair d; d = postcontrol t of p - precontrol t of p;
\end{code}
In fact, this is so useful that
"plain.mp" provides \mpl{direction} as a shorthand:
@@ -3176,7 +2324,7 @@
\end{smallcode}
which can save you some typing. But the clever bit is that $t$ does not have to be a whole
number. If you set $t=\frac14$ (say), \MP\ works out the corresponding fractional
-control points, so that you can use \mpl{direction t of p} to get a tangent at any point.
+control points, so that you can use \mpl{direction t of p} to get a tangent at any point.
The vector pairs returned have the right direction, but still have rather arbitrary magnitudes, so
the usual idiom is something like this:
@@ -3195,13 +2343,11 @@
construction: for a given circle $C$ and a point $p$, find the midpoint of $p$ and
the center of $C$; draw a semicircle through $p$, centred on this midpoint; the tangent
point is where the semicircle intersects $C$. %
-\mpic{-110pt}{tangents-point-to-circle.pdf}
+\mpic{-110pt}{geometry-tangents-point-to-circle}
Given a suitable \mpl{path C} and \mpl{pair p} you can do this:
-\begin{code}
-pair o, m, t, t'; o = center C; m = 1/2[o, p];
-t = C intersectionpoint halfcircle zscaled (p-o) shifted m;
-t' = C intersectionpoint halfcircle zscaled (o-p) shifted m;
-\end{code}
+\mpexternal[firstline=11,lastline=13]{geometry-tangents-point-to-circle.mp}
+
+\noindent
No parentheses are needed around the second path, because \mpl{intersectionpoint} is
defined with \mpl{secondarydef}.
@@ -3213,54 +2359,28 @@
means that \mpl{subpath (a, b) of C} is always the “long way round” C, on the
opposite side from $p$, and \mpl{subpath (a, b-8) of C} is always the shorter
segment.
-\begin{code}
-vardef tangent_times(expr C, p) =
- % return the two times on C that correspond
- % to the external tangents from p to C
- save o, a, b, G, H;
- pair o; numeric a, b; path G, H;
- o = center C;
- H = halfcircle zscaled (p-o) shifted 1/2[o, p];
- G = halfcircle zscaled (o-p) shifted 1/2[o, p];
- (a, whatever) = C intersectiontimes H;
- (b, whatever) = C intersectiontimes G;
- (a, b if b < a: + 8 fi)
-enddef;
-\end{code}
-Note the elegant syntax here;
-if \mpl{z} is a \<pair> then the operation \mpl{zscaled z} is equivalent
-to \mpl{scaled abs z rotated angle z}.
-\vpic{-200pt\noindent Here is the macro in action.
+\mpexternal{geometry-tangent-times.mp}
+
+\noindent
+Note the elegant syntax here; if \mpl{z} is a \<pair> then the operation
+\mpl{zscaled z} is equivalent to \mpl{scaled abs z rotated angle z}.
+
+\moveright5.5in\vbox to 0pt{\hsize4in\vskip-200pt
+\noindent Here is the macro in action.
Having obtained the two times $a$ and $b$ from the macro, the dashed line
-was drawn along a path that was composed with:
-\vrule depth 20pt width 0pt height 2pt
-\mpl{p -- subpath (a,b) of C -- cycle}
-}{tangent-times-on-circle}
+was drawn along a path that was composed with: \mpl{p -- subpath (a,b) of C -- cycle}
+$$\includegraphics{geometry-tangent-times-on-circle}$$
+\vss}
\newpage
\subsection{Lines tangent to two circles (exterior)}\label{sec:adjust-times}
The same \mpl{tangent_times} macro can be reused to find the tangents that touch two
-circles, using an approach like this: \mwpic{-12pt}{tangents-two-circles-exterior}
-\begin{code}
-path A, B;
-A = fullcircle scaled 144;
-B = fullcircle scaled 60 shifted (200, 140);
+circles, using an approach like this: \mwpic{-36pt}{geometry-tangents-two-circles-exterior}
-numeric R, r;
-R = abs (point 0 of A - center A);
-r = abs (point 0 of B - center B);
+\smallmpexternal[firstline=9,lastline=24]{geometry-tangents-two-circles-exterior.mp}
-path C; numeric t, u;
-C = fullcircle scaled (2R-2r) shifted center A;
-(t, u) = tangent_times(C, center B);
-
-draw A withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw B withpen pencircle scaled 2 withcolor 3/4[blue, white];
-
-draw subpath (t, u) of A -- subpath (u-8, t) of B -- cycle;
-\end{code}
Here $A$ and $B$ are the two circles you want to connect, and $A$ is larger than
$B$. $R$ is the radius of the larger, $r$ of the smaller. $C$ is an auxiliary circle
centred at the same point as $A$ and scaled so that its radius is $R-r$. If we
@@ -3267,28 +2387,34 @@
then find the tangent points on $C$ from the center of $B$, the points we want are
the corresponding points on $A$ and $B$.
-\medskip\noindent
-This works well, provided that none of three
-circles $A$, $B$, or $C$ has been rotated (that is that point 0 is at 3 o'clock in
-all of them). But
-this may not always be the case. For example, you might have written
+Notice how the times are used with \mpl{subpath}; if $a>b$, then the path returned
+from \mpl{subpath (a, b) of P} is the same as \mpl{reverse subpath (b, a) of P},
+which means that \mpl{subpath (u,t) of B} would give you the wrong side. The remedy
+is to subtract 8 from $u$ (or, more generally, to subtract the length of path $B$).
+Because there are 8 points on a \mpl{fullcircle} path, point $u$ and point $u-8$
+refer to the same place, but since $u-8 < t$, the subpath will run clockwise as
+required.
+
+\vfill
+\noindent\hey
+This all works provided that all three
+circles $A$, $B$, or $C$ have the same rotation.
+But this may not always be the case.
+For example, you might have defined $B$ as
\begin{code}
-B = fullcircle scaled 60 shifted 240 right rotated 36;
+B = fullcircle scaled 60 shifted 240 dir 36;
\end{code}
and then point $t$ of $B$ would \textit{not} correspond to point $t$ of the
-auxiliary circle. So to make the code above more general you have to adjust the
-tangent times to take account of the relative rotation of the circles.
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vskip-24pt\noindent
-\begin{code}
-vardef adjust_time(expr tt, AA, BB) =
- tt + 1/45 angle (point 0 of AA - center AA)
- - 1/45 angle (point 0 of BB - center BB)
-enddef;
-\end{code}
-\vss}}
-The in the figure $t$ was adjusted to $t'$ for $A$ and $t''$ for $B$, using the
-routine shown on the right. This routine shows the relationship between \mpl{angle}
-and points around a circle: $360^\circ = 8\:\hbox{points}$.
+auxiliary circle $C$.
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
+To cope with circles that might not have the same rotation, you need to adjust the
+tangent times to take account of the different relative rotation.
+\mpexternal[firstline=7,lastline=10]{geometry-tangents-two-circles-interior.mp}
+\noindent
+This macro exploits the relationship between \mpl{angle}
+and points around a \mpl{fullcircle} path: $360^\circ = 8\:\hbox{points}$.
+You can see it in action on the following page.
+}}
\newpage
\subsection{Lines tangent to two circles (interior)}
@@ -3296,65 +2422,24 @@
To find the interior tangents, you just need to add the smaller radius rather than
subtract it, and add 4 to the times on the smaller circles, so that they are on the
other side:
-$$\includegraphics[width=\textwidth]{tangents-two-circles-interior}$$
+$$\includegraphics[width=\textwidth]{geometry-tangents-two-circles-interior}$$
\bigskip\noindent
The complete code for this is shown on the right. It uses the same
routines given above; \mpl{tangent_times} from section \ref{sec:tangent-times}, and
\mpl{adjust_time} from section \ref{sec:adjust-times}.
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
-\begin{smallcode}
-path A, B;
-A = fullcircle scaled 144 rotated uniformdeviate 360;
-B = fullcircle scaled 60 shifted 240 right rotated 36;
-
-numeric R, r;
-R = abs (point 0 of A - center A);
-r = abs (point 0 of B - center B);
-
-path C;
-C = fullcircle scaled (2R+2r) shifted center A; % NB +ve
-
-numeric t, t', t'', u, u', u'';
-(t, u) = tangent_times(C, center B);
-t' = adjust_time(t, C, A);
-u' = adjust_time(u, C, A);
-t'' = adjust_time(t + 4, C, B); % Note the plus fours
-u'' = adjust_time(u + 4, C, B);
-
-draw A withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw B withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw C withpen pencircle scaled 1 withcolor 3/4[blue, white];
-
-draw subpath (t', u') of A -- subpath (u'', t'') of B -- cycle;
-draw center B -- subpath (t, u) of C -- cycle dashed evenly;
-
-draw center B -- point t'' of B dashed withdots scaled 1/2;
-draw center B -- point u'' of B dashed withdots scaled 1/2;
-draw point t of C -- point t' of A dashed withdots scaled 1/2;
-draw point u of C -- point u' of A dashed withdots scaled 1/2;
-
-dotlabel.ulft(btex $t$ etex, point t of C);
-dotlabel.lrt (btex $t'$ etex, point t' of A);
-dotlabel.lrt (btex $t''$ etex, point t'' of B);
-dotlabel.lrt (btex $u$ etex, point u of C);
-dotlabel.ulft(btex $u'$ etex, point u' of A);
-dotlabel.ulft(btex $u''$ etex, point u'' of B);
-drawdot center B withpen pencircle scaled dotlabeldiam;
-
-drawoptions(withcolor 1/2[blue, white]);
- label.urt(btex $A$ etex, point 1/2(t'+u'- 7.6) of A);
- label.rt (btex $B$ etex, point 1/2(t''+u''- 2) of B);
- label.urt(btex $C$ etex, point 1/2(t+u-8) of C);
-drawoptions();
-\end{smallcode}\vskip -1in
+\vadjust{\moveright5.25in\vbox to 0pt{\hsize 4in\vss\noindent
+\smallmpexternal[firstline=12,lastline=54]{geometry-tangents-two-circles-interior.mp}
+\vskip -72pt
}}
\subsection{Axis of similitude}\label{sec:axosim}
-\bigskip
-\noindent\hbox to \textwidth{\includegraphics[scale=0.92]{axis-of-similitude}\hss}
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
+\vbox to 0pt{\vskip-\baselineskip\noindent\hbox to
+\textwidth{\includegraphics[scale=0.92]{geometry-axis-of-similitude}\hss}\vss}
+
+\vfill
+\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
Given three circles taken in pairs, you can use the techniques of the preceding
sections to find the three points where the common external tangents
intersect (shown here as $E_{12}$, $E_{31}$, and $E_{23}$) and the
@@ -3364,58 +2449,53 @@
Similitude}.
The drawing is left as an exercise for the reader, except
-to note that if $r_1$ and $r_2$ are \mpl{numeric} variables representing
-the radius of the circles centred at the \mpl{pair} variables $C_1$ and $C_2$,
-then we have:
-$$\vbox{\openup3pt\halign{\hfil$#$&${}=#$\hfil\cr
-E_{12}&({r_1\over r_1 - r_2})[C_1, C_2];\cr
-I_{12}&({r_1\over r_1 + r_2})[C_1, C_2];\cr
-}}$$
-which is a bit quicker than working out all the tangent points.}}
+to note that if \mpl{r1} and \mpl{r2} are \<numeric> variables representing
+the radius of the circles centred at the \<pair> variables \mpl{C1} and \mpl{C2},
+then:
+\begin{smallcode}
+E12 = (r1/(r1 - r2)[C1, C2]; I12 = (r1/(r1 + r2)[C1, C2];
+\end{smallcode}
+which is a bit quicker than working out all the tangent points.
+My version is in the file "geometry-axis-of-similitude.mp"
+}
\newpage
\subsection{Inversion, pole, and polar}\label{sec:inversion}
Inversion in a circle is a generalization of reflection in a line.
-\mpic{-68pt}{pole-and-polar}
-It is useful for certain constructions in geometry, and easy to
-implement as a macro \MP. For given circle, and a
-given point $P$ lying outside the circle, the inverted point $P'$ lies inside the
-circle at the intersection of the line from $P$ to the centre of the circle, and the
-line between the tangent points [§\ref{sec:tangent-times}] from $P$, shown here as
-$Q$ and $R$.\rlap{\quad$\longrightarrow$}
+\mpic{-48pt}{geometry-pole-and-polar}
+It is useful for certain constructions in geometry, and easy to implement as a macro
+\MP. For given circle, and a given point $P$ lying outside the circle, the inverted
+point $P'$ lies inside the circle at the intersection of the line from $P$ to the
+centre of the circle, and the line between the tangent points
+[§\ref{sec:tangent-times}] from $P$, shown here as $Q$ and $R$.\rlap{\quad$\longrightarrow$}
But $OPQ$ and $OQP'$ are similar triangles, so $r/OP=OP'/r$ and so $OP' =
r^2/OP$, and since $P'$ must lie on the line through $O$ and $P$, this is enough to
-define a macro directly to find $P'$ given $P$, $O$, and $r$:
+to find $P'$ directly given $P$, $O$, and $r$:
\begin{code}
-P' = O + unitvector(P-O) scaled r * r / abs (P-O);
+P' = O + unitvector(P-O) scaled (r * r / abs (P-O));
\end{code}
-But examining \mpl{plain.mp} shows that \mpl{unitvector} is a macro defined like this:
+But examining "plain.mp" shows that \mpl{unitvector} is a macro defined like this:
\begin{code}
vardef unitvector primary z = z/abs z enddef;
\end{code}
-which suggests this alternative (safer) approach:
+which suggests this alternative formulation:
\begin{code}
-vardef invert(expr P, O, r) =
- save s; numeric s; s = r / abs (P-O);
- O + (P-O) * s * s
-enddef;
+P' = O + (P - O) scaled (r / abs (P - O) * r / abs (P - O));
\end{code}
-This works well provided that $|P| > \frac1{180} r$, which is usually the case, but
-you could also consider checking that $|t|>0$ and that $s$ was not too large.
-
-If it was more convenient to deal with the \<path> of the circle of inversion
-instead of the centre and the radius, you get the macro to work out the centre and
-the radius for you.
+or as a macro, and dividing first to avoid overflow:
\begin{code}
-vardef invert(expr P, C) =
- save o; pair o; o = 1/2[point 0 of C, point 4 of C];
- save r; numeric r; r = abs (point 0 of C - o);
- save s; numeric s; s = r / abs (P - o);
- o + (P - o) * s * s
+vardef invert(expr P, O, r) =
+ save s; numeric s; s = abs(P - O);
+ O + (P - O) / s * r / s * r
enddef;
\end{code}
+This works well in most cases, but you could consider checking that $s$ is not too small.
+If it is more convenient to deal with the \<path> of the circle of inversion
+instead of the centre and the radius, you can get the macro to calculate
+them for you:
+\mpexternal[firstline=6,lastline=11]{geometry-pole-and-polar.mp}
\vfill
@@ -3435,8 +2515,9 @@
inversion.
\smallskip
-\noindent\llap{\nb}The small dotted circle through $O$ and $P'$ above is the inversion
-of the whole polar line (infinitely extended).}
+\noindent\llap{\nb}The inversion of points on the polar (shown as blue dots)
+lie on a circle through $O$ and $P'$. The complete circle would be the inversion
+of the infinitely extended polar.}
\newpage
\subsection{Radical axis and radical centre}\label{sec:radical}
@@ -3447,64 +2528,27 @@
are of equal length. A circle centred at any point on the axis, and drawn with radius equal to the
length of the tangent will cut both circles at right angles.
-\medskip\noindent\centerline{\includegraphics{radical-axis}}
+\medskip\noindent\centerline{\includegraphics{geometry-radical-axis}}
\medskip\noindent
-In a system of three circles as shown, the \textit{radical centre} is the
+In a system of three circles as shown, the \textit{radical centre} ("radix") is the
intersection of the three mutual radical axes. The tangents from this point to all three circles
-have the same length, so a circle with this radius cuts all three circles at right
-angles.
+have the same length, so a circle with this radius (shown above in \red{red})
+cuts all three circles at right angles.
-\moveright5.5in\vbox to 0pt{\vss\hsize 4in\begin{smallcode}
-vardef radical_axis(expr ca, cb) =
- numeric t, d, ra, rb;
- ra = abs(center ca - point 0 of ca);
- rb = abs(center cb - point 0 of cb);
- d = abs(center cb - center ca);
- 2t = 1 + (ra+rb) / d * (ra-rb) / d;
- (up -- down) scaled 89
- rotated angle (center cb - center ca)
- shifted t[center ca, center cb]
-enddef;
-beginfig(1);
- path c[], a[];
- z1 = origin; z2 = 233 right rotated 4; z3 = 209 right rotated -42;
- c1 = fullcircle scaled 202 shifted z1;
- c2 = fullcircle scaled 106 shifted z2;
- c3 = fullcircle scaled 62 shifted z3;
- a1 = radical_axis(c1, c2);
- a2 = radical_axis(c2, c3);
- a3 = radical_axis(c3, c1);
- z0 = whatever [point 0 of a1, point 1 of a1]
- = whatever [point 0 of a2, point 1 of a2];
- numeric t; (t, whatever) = tangent_times(c1, z0);
- drawoptions(withpen pencircle scaled 1 withcolor 3/4[blue, white]);
- draw c1; draw c2; draw c3;
- drawoptions(withcolor 3/4[blue, white]);
- draw z1 -- point t of c1 dashed evenly;
- drawoptions(withpen pencircle scaled 1/4);
- draw z1 -- z2 -- z3 -- cycle;
- drawoptions();
- draw a1; draw a2; draw a3;
- drawoptions(withcolor 2/3 red);
- draw fullcircle scaled 2 abs (point t of c1 - z0) shifted z0;
- draw z0 -- point t of c1 dashed evenly;
- drawdot z0 withpen pencircle scaled dotlabeldiam;
- drawoptions(withcolor 1/4[blue, white]);
- drawdot z1 withpen pencircle scaled dotlabeldiam;
- drawdot z2 withpen pencircle scaled dotlabeldiam;
- drawdot z3 withpen pencircle scaled dotlabeldiam;
- label.urt(btex $C_1$ etex, point 1 of c1);
- label.urt(btex $C_2$ etex, point 1 of c2);
- label.rt (btex $C_3$ etex, point 0 of c3);
-endfig;
-\end{smallcode}\vskip -1in}
+\moveright5.5in\vbox to 0pt{\vss\hsize 4in
+\smallmpexternal[firstline=6,lastline=51]{geometry-radical-axis.mp}
+\vskip -1in}
\newpage
\subsection{Circles tangent to other circles}
-\bigskip
-\noindent\hbox to \textwidth{\includegraphics[height=\textheight]{apollonius}\hss}
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
+
+\vbox to 0pt{\noindent
+\hbox to \textwidth{\includegraphics[height=\textheight]{geometry-apollonius}\hss}
+\vss}
+
+\vfill
+\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
The classical Problem of Apollonius is to find a circle tangent to three others.
All of the approaches are rather involved, but Gergonne's is probably the simplest
to follow in \MP.
@@ -3524,10 +2568,9 @@
\smallskip\noindent
{\small
-The drawing is also left as an exercise for the reader, although you can find my
-version in the source code for this document. You might like to try to make a more
-robust version or to find all the other tangent circles.}
-}}
+The drawing is left as an exercise for the reader, although you can find my
+"geometry-apollonius.mp" in the source for this document. You might try to make a more
+robust version or to find all the other tangent circles.}}
\newpage
@@ -3534,117 +2577,36 @@
\subsection{Coordinate geometry examples}
\kern-\baselineskip
-\vpic{-24pt}{desargues}
-\kern-.5\baselineskip
-\begin{code}[xleftmargin=0pt, xrightmargin=-72pt]
-beginfig(1);
- z.P = 200 up rotated 21; z.A = 100 left rotated -21;
- z.B = origin; z.C = 90 right rotated 42;
+\vpic{-24pt}{geometry-examples-desargues}
- z.A' = 3/8[z.P, z.A];
- z.B' = 1/2[z.P, z.B];
- z.C' = 5/8[z.P, z.C];
-
- z.R = whatever [z.A, z.B] = whatever [z.A', z.B'];
- z.S = whatever [z.B, z.C] = whatever [z.B', z.C'];
- z.T = whatever [z.C, z.A] = whatever [z.C', z.A'];
-
- path t[];
- t1 = z.A--z.B--z.C--cycle;
- t2 = z.A'--z.B'--z.C'--cycle;
-
- fill t1 withcolor 7/8[red, white];
- fill t2 withcolor 7/8[blue, white];
- draw t1 withcolor 1/2 white;
- draw t2 withcolor 1/2 white;
-
- drawoptions(dashed withdots scaled 1/2);
- draw z.P--z.A;
- draw z.P--z.B;
- draw z.P--z.C;
-
- drawoptions(dashed evenly scaled 1/2);
- draw z.B--z.R--z.B';
- draw z.C--z.S--z.C';
- undraw subpath (1/4, 3/4) of (z.C'--z.T) withpen
- pencircle scaled 5;
- draw z.C--z.T--z.C';
-\end{code}
-\moveright 384pt \vbox to 0pt{\vss
-\begin{code}[xleftmargin=0pt, xrightmargin=-72pt]
-
- drawoptions(withcolor 2/3 red);
- draw 9/8[z.S,z.R] -- 9/8[z.R,z.S];
- picture pp; pp = thelabel("perspectrix", origin);
- draw pp shifted 7 down rotated angle (z.S-z.R)
- shifted 1/2[z.R, z.T];
- dotlabel.urt("perspector", z.P);
-
- drawoptions();
- dotlabel.lft (btex $A$ etex, z.A);
- dotlabel.llft(btex $B$ etex, z.B);
- dotlabel.lrt (btex $C$ etex, z.C);
- dotlabel.lft (btex $A'$ etex, z.A');
- dotlabel.llft(btex $B'$ etex, z.B');
- dotlabel.bot (btex $C'$ etex, z.C');
- label.rt(btex Desargues' Theorem etex, (x.C', 1/2(y.P+y.C')));
-endfig;
-\end{code}
+\mpexternal[xleftmargin=0pt,firstline=6,lastline=37]{geometry-examples-desargues.mp}
+\moveright 340pt \vbox to 0pt{\vss
+\mpexternal[xleftmargin=0pt,xrightmargin=-80pt,firstline=38,lastline=53]{geometry-examples-desargues.mp}
\vskip -42pt}
\newpage
-\moveright5.5in\vbox to 0pt{\vskip10pt\includegraphics[width=4.2in]{trisection-triangles}\vss}
-\vskip-\baselineskip
-\begin{code}[xleftmargin=0pt, xrightmargin=-80pt]
-randomseed := 2485.81543;
-vardef measured_angle(expr p, o, q) =
- (angle (p-o) - angle (q-o)) mod 360
-enddef;
-beginfig(1);
-picture T;
-for i=0 upto 1:
- for j=0 upto 1:
- clearxy;
- T := image(
- z1 = (120 + uniformdeviate 21, 0);
- z2 = (120 + uniformdeviate 21, 0) rotated 120 rotated 21 normaldeviate;
- z3 = (120 + uniformdeviate 21, 0) rotated 240 rotated 21 normaldeviate;
- numeric a, b, c;
- a = measured_angle(z3, z1, z2);
- b = measured_angle(z1, z2, z3);
- c = measured_angle(z2, z3, z1);
- z4 = whatever [z1, z2 rotatedabout(z1, 1/3 a)]
- = whatever [z2, z3 rotatedabout(z2, 2/3 b)];
- z5 = whatever [z2, z3 rotatedabout(z2, 1/3 b)]
- = whatever [z3, z1 rotatedabout(z3, 2/3 c)];
- z6 = whatever [z3, z1 rotatedabout(z3, 1/3 c)]
- = whatever [z1, z2 rotatedabout(z1, 2/3 a)];
- fill z4--z5--z6--cycle withcolor 3/4[red + 1/2 green, white];
- draw z4--z5--z6--cycle;
- draw z1 -- z4 -- z2 -- z5 -- z3 -- z6 -- cycle
- dashed withdots scaled 1/4;
- draw z1 -- z2 -- z3 -- cycle;
- );
- draw T shifted (200i, 240j);
- endfor
-endfor
-label.rt(btex \vbox{\halign{#\hfil\cr The trisectors of each angle\cr
-in any given triangle form a\cr central equilateral triangle.\cr}} etex, (24, 128));
-endfig;
-\end{code}
+\vpic{-36pt}{geometry-examples-trisections}
+\vbox to 0pt{
+ \mpexternal[xleftmargin=0pt,xrightmargin=-80pt,firstline=6,lastline=40]{geometry-examples-trisections.mp}
+\vss}
\newpage
-\kern-\baselineskip
-\vpic{1in}{projections}
-\mpexternal[xleftmargin=0pt]{projections-code.mp}
+\kern-3\baselineskip
+\vpic{0.25in}{geometry-examples-napoleon}
+\vbox to 0pt{
+ \mpexternal[xleftmargin=0pt,firstline=6,lastline=37]{geometry-examples-napoleon.mp}
+\vss}
+\newpage
+\kern-3\baselineskip
+\vpic{1in}{geometry-examples-projections}
+\vbox to 0pt{
+ \mpexternal[xleftmargin=0pt,firstline=6,lastline=41]{geometry-examples-projections.mp}
+\vss}
\newpage
-\moveright5.5in\vbox to 0pt{\hsize4in\noindent This needs an \mpl{invert} macro, such
-as the one from [§\ref{sec:inversion}].
-
-\smallskip\noindent
-\includegraphics[width=288pt]{arbelos}
-
-\vskip 1.414in\noindent
+\moveright5.25in\vbox to 0pt{\hsize4.25in\noindent
+\smallmpexternal[firstline=7,lastline=14,xleftmargin=0pt]{geometry-arbelos.mp}
+\centerline{\includegraphics{geometry-arbelos}}
+\vfill\noindent
\begingroup
\raggedleft\fontsize{8}{10}\selectfont\textsf{%
One must also recognize that any attempt to illustrate geometry\\
@@ -3654,48 +2616,113 @@
— Benoit Mandelbrot, \textsl{The Fractal Geometry of Nature}}
\par\endgroup
\vss}
-\begin{smallcode}[xleftmargin=0pt, xrightmargin=-72pt]
-beginfig(1);
-pair A,B,C; A = origin; C = 244 right; B = 7/8[A, C];
-path c[];
-c1 = fullcircle scaled 2 abs(A-C); % large circle for the inversions
-c2 = fullcircle scaled abs(A-C) shifted 1/2[A,C];
-c3 = fullcircle scaled abs(A-B) shifted 1/2[A,B];
-c4 = fullcircle scaled abs(B-C) shifted 1/2[B,C];
-c5 = invert(c4,c1);
-numeric d; d = abs(point 0 of c5 - point 4 of c5); % diameter of c5
+\smallmpexternal[firstline=15,lastline=52,xleftmargin=0pt,xrightmargin=-72pt]{geometry-arbelos.mp}
-drawoptions(withcolor 3/4 white);
-draw c4; draw c5;
-draw invert(subpath(0, 3/2) of c2, c1);
-draw invert(subpath(0, 3/2) of c3, c1);
-drawoptions();
-draw subpath(-1/4,1) of c1 withcolor 3/4[1/2 red,white];
-label.bot("\textit{circle of inversion}", point -1/4 of c1)
- withcolor 1/4[1/2 red, white];
+\newpage
+\subsection{Drawing angle marks}
-for i=1 upto 72:
- path c, c';
- c = c5 shifted (0, i*d); c' = invert(c, c1);
- if i < 5:
- drawoptions(withcolor 3/4 white);
- draw c; draw origin -- center c;
- fill fullcircle scaled dotlabeldiam shifted center c;
- fill fullcircle scaled dotlabeldiam shifted center c';
- drawoptions();
- fi
- draw c' withpen pencircle scaled 1/4 withcolor 2/3 blue;
-endfor
-forsuffixes $=2,3,4: draw subpath (0,4) of c$
- withpen pencircle scaled 1/4 withcolor 2/3 blue;
-endfor
-draw A--C;
-dotlabel.lft("$A$", A); dotlabel.llft("$B$", B); dotlabel.rt("$C$", C);
-endfig;
+\textsc{Observant readers} will have noticed that the occasional angle marks in the
+preceding examples are generally drawn using plain \MP\ commands rather than a
+macro. This is partly in order to make the examples self-contained and partly to
+show what can be done with the default plain \MP\ format.
+
+\smallskip\noindent
+To mark a right angle at point $a$ on the line $a\to b$ you can do something like
+this:
+\begin{code}
+draw unitsquare scaled 5 rotated angle (b-a) shifted a;
+\end{code}
+with a suitable pen and a suitable colour. You \textit{could} write a macro to do
+this, but it hardly seems worth the effort.%
+\vadjust{\moveright 5.5in\vbox to 0pt{\hsize 4.2in\vskip -108pt\noindent
+For example, this is one way to annotate a right-angle triangle:
+\begin{code}
+pair a, b, c; a = 10 dir 10; b = 160 dir 20;
+c - a = whatever * (b - a rotated 90); ypart c = ypart b;
+draw unitsquare scaled 5 rotated angle (b-a) shifted a
+ withcolor 3/4;
+draw a--b--c--cycle;
+\end{code}
+which produces this:
+$$\begin{mplibcode}
+pair a, b, c; a = 10 dir 10; b = 160 dir 20;
+c - a = whatever * (b - a) rotated 90; ypart c = ypart b;
+draw unitsquare scaled 5 rotated angle (b-a) shifted a withcolor 3/4;
+draw a--b--c--cycle;
+dotlabel.llft("$a$", a);
+dotlabel.rt ("$b$", b);
+dotlabel.ulft("$c$", c);
+\end{mplibcode}$$
+
+\bigskip\noindent
+Equipped with the macro shown on the left, you could add this:
+\begin{code}
+ draw angle_mark(a, c, b, 16) withcolor 2/3 red;
+\end{code}
+to get this:
+$$\begin{mplibcode}
+pair a, b, c; a = 10 dir 10; b = 160 dir 20;
+c - a = whatever * (b - a) rotated 90; ypart c = ypart b;
+vardef angle_mark(expr P, O, Q, r) =
+ fullcircle scaled 2r rotated angle (P - O)
+ shifted O cutafter (O -- Q)
+enddef;
+draw unitsquare scaled 5 rotated angle (b-a) shifted a withcolor 3/4;
+draw angle_mark(a, c, b, 16) withcolor 2/3 red;
+draw a--b--c--cycle;
+ dotlabel.llft("$a$", a);
+ dotlabel.rt ("$b$", b);
+ dotlabel.ulft("$c$", c);
+\end{mplibcode}$$
+Or, using the fancier macro:
+$$\begin{mplibcode}
+pair a, b, c; a = 10 dir 10; b = 160 dir 20;
+c - a = whatever * (b - a) rotated 90; ypart c = ypart b;
+vardef angle_label(expr P, O, Q, r) = image(
+ save a; path a; a = fullcircle scaled 2r rotated angle (P - O) shifted O cutafter (O -- Q);
+ fill O -- a -- cycle withcolor 7/8[red, white]; draw a withcolor 2/3 red;
+ save t; string t; t = decimal (round(angle (Q-O) - angle (P-O)) mod 360) & "°";
+ label(t, O + r * (unitvector(P-O) + unitvector(Q-O)));
+) enddef;
+draw unitsquare scaled 5 rotated angle (b-a) shifted a withcolor 3/4;
+draw angle_label(a, c, b, 16);
+draw a--b--c--cycle;
+ dotlabel.llft("$a$", a);
+ dotlabel.rt ("$b$", b);
+ dotlabel.ulft("$c$", c);
+\end{mplibcode}$$
+\vss}}
+
+\smallskip\noindent
+On the other hand, you might want to make a macro for a curved angle mark since, it
+is a bit more cumbersome. It is probably simplest make the macro create only the
+required path, so you can use it with \mpl{draw} or \mpl{fill} as required. The
+idea here is that $P$, $O$, and $Q$ are \<pair> variables and $r$ is a \<numeric>
+representing the desired radius.
+\begin{code}
+vardef angle_mark(expr P, O, Q, r) =
+ fullcircle scaled 2r rotated angle (P - O)
+ shifted O cutafter (O -- Q)
+enddef;
+\end{code}
+Note that \mpl{(P-O)} returns a \<pair>, but \mpl{(O--Q)} make a \<path>. Less is
+usually more in coordinate geometry diagrams, but you could go on to make it much
+fancier if you wanted:
+\begin{smallcode}[xrightmargin=-40pt]
+vardef fancier_angle_label(expr P, O, Q, r) = image(
+ save a, t; path a; string t;
+ a = fullcircle scaled 2r rotated angle (P - O) shifted O cutafter (O -- Q);
+ fill O -- a -- cycle withcolor 7/8[red, white]; draw a withcolor 2/3 red;
+ t = decimal (round(angle (Q-O) - angle (P-O)) mod 360) & "°";
+ label(t, O + r * (unitvector(P-O) + unitvector(Q-O)));
+) enddef;
\end{smallcode}
+Note that the angle label is calculated automatically. But
+it is tediously time-consuming to make this sort of macro completely
+general and fool-proof, so this example might not work for all angles.
\newpage
-\section{Trigonometry functions}\label{trig}
+\section{The missing trigonometry functions}\label{trig}
\MP\ provides only two basic trigonometry functions, "sind" and "cosd". This lack
appears to be a deliberate design; in general it's much easier to use the "rotated"
@@ -3708,45 +2735,7 @@
If you are using the default number system then it's enough to define it to five
decimal digits,%
\vadjust{\moveright 384pt\vbox to 0pt{\kern-144pt
-\begin{code}
-numeric pi;
-% approximate value
-pi := 3.14159;
-% measure round a circular arc...
-pi := 1/4 arclength (quartercircle scaled 16);
-% up to 32 digits of precision
-pi := 3.1415926535897932384626433832795;
-% as many digits as are needed...
-vardef getpi =
- numeric lasts, t, s, n, na, d, da;
- lasts=0; s=t=3; n=1; na=0; d=0; da=24;
- forever:
- exitif lasts=s;
- lasts := s;
- n := n+na; na := na+8;
- d := d+da; da := da+32;
- t := t*n/d;
- s := s+t;
- endfor
- s
-enddef;
-pi := getpi;
-
-% conversions
-vardef degrees(expr theta) = 180 / pi * theta enddef;
-vardef radians(expr theta) = pi / 180 * theta enddef;
-% trig functions that expect radians
-vardef sin(expr theta) = sind(degrees(theta)) enddef;
-vardef cos(expr theta) = cosd(degrees(theta)) enddef;
-% inverse trig functions
-vardef acosd(expr a) = angle (a,1+-+a) enddef;
-vardef asind(expr a) = angle (1+-+a,a) enddef;
-vardef acos(expr a) = radians(acosd(a)) enddef;
-vardef asin(expr a) = radians(asind(a)) enddef;
-% tangents
-vardef tand(expr theta) = save x,y; (x,y)=dir theta; y/x enddef;
-vardef atand(expr a) = angle (1,a) enddef;
-\end{code}
+\mpexternal[firstline=1,lastline=37]{trigonometry-functions.mp}
\vss}}
but if you are using one of the new number systems you might want more digits of
precision. In fact there's no harm in always defining these extra digits; even when
@@ -3757,7 +2746,9 @@
an error if you supply more digits that the default precision. So in general
it's best to use no more than 32 digits. It's also possible, but not really worth
the trouble, to define a routine to calculate $\pi$ to the current
-precision.\rlap{\raise1ex\hbox{\ $\smash{\nearrow}$}} However you define it, once you are armed with a value for $\pi$ you can
+precision.\rlap{\raise1ex\hbox{\ $\smash{\nearrow}$}}
+
+However you define it, once you are armed with a value for $\pi$ you can
then define functions to convert between degrees and radians, and some more `normal'
versions of sine and cosine.
@@ -3770,12 +2761,11 @@
$\kw{dir}\,30$ gives you the point $(x,y)$ on the unit circle such that $\tan
30^{\circ} = y/x$. You can use these ideas to define tangent and arctan functions
if you really need them, but often "angle" and "dir" are more directly useful
-for drawing.
-
-You should also be aware that the tangent function shown here does not
-check whether $x=0$; if this is an issue, then add something like this
+for drawing.
+You should also be aware that the "tand" function shown here does not
+check whether $x$ is close to zero; if this is an issue, then add something like this
at the appropriate point:
-$$\kw{if}\,x=0\!:\id{infinity}\: \kw{else}\!: y/x \kw{fi}$$
+$$\kw{if}\,\id{abs}(x)<\id{eps}\!:\id{infinity}\: \kw{else}\!: y/x \kw{fi}$$
\newpage
\section{Traditional labels and annotations}\label{sec:trad-labels}
@@ -3788,14 +2778,14 @@
\noindent
\MP\ does not draw text directly; but it provides two different mechanisms to
-turn some text into a \<picture>, which can then be treated like any other;
+turn some text into a \<picture>, which can then be treated like any other;
saved as a variable, drawn directly, or transformed in some way with a
scaling, a reflection, or a rotation. The first mechanism is described below,
-the other in §\ref{btex}.
+the second in §\ref{btex}.
\subsection{Simple strings in PostScript fonts with \texttt{infont}}\label{infont}
-The first mechanism is the primitive binary operation "infont". As explained in
+The first mechanism is the primitive binary operation \mpl{infont}. As explained in
section~8.3 of the \MP\ manual, it takes two strings as arguments: the left hand
argument is the string of text to be printed; the right hand argument is the name of
the font to use; and the result is a "picture" primary.\vadjust{
@@ -3804,7 +2794,7 @@
To find the name of a suitable font, you have to consult your local "psfonts.map"
file, and probably the PSNFSS documentation.
Here are a few of the many fonts available on my local \TeX\ installation; the name
-to use with "infont" is in the first column.
+to use with \mpl{infont} is in the first column.
$$\includegraphics{trad-font-samples}$$
The text example in the first line
of this table was produced with
@@ -3840,7 +2830,7 @@
the numeric expression is rounded to the nearest integer modulo
256.
- \item Use \mpl{decimal} to get a string representing
+ \item Use \mpl{decimal} to get a string representing
the value of a numeric expression.
\item Apply \mpl{str} to any suffix (and hence to any variable). You get back a
@@ -3858,22 +2848,20 @@
\end{itemize}
\newpage
-\subsubsection{Character sets used by \texttt{infont} to set
-text}\label{sec:charsets}
+\subsubsection{Character sets used by \texttt{infont} to set text}\label{sec:charsets}
Standard \MP\ is configured to accept as input only space and the usual 94 visible
ASCII characters (that is the characters numbered 32 to 126 in the tables at the
-right), but you can use any 8-bit characters as the payload of a string.
-However, plain \MP\ is set by default to use "cmr10", the familiar Computer Modern typeface
+right), but you can use any 8-bit characters as the payload of a string. However,
+plain \MP\ is set by default to use "cmr10", the familiar Computer Modern typeface
developed by Knuth for \TeX, and unfortunately, this is encoded using the \TeX\ text
-font encoding (also known as `OT1', and as shown in the first table in Appendix~F of the {\sl \TeX book}).
-\mpic{-108pt}{trad-font-tables}
-From the point of
-view of using "infont" to make simple labels, this means that the characters for
-space and seven other characters ("< > \ _ { | }") are in the wrong place.
-You are likely to notice this first if you try to set a label with two words; the
-space will come out as a small diagonal stroke accent that is used in plain \TeX\
-to make the characters Ł and ł, used in Polish and other Slavic languages.
+font encoding (also known as `OT1', and as shown in the first table in Appendix~F of
+the {\sl \TeX book}). \mpic{-108pt}{trad-font-tables} From the point of view of
+using \mpl{infont} to make simple labels, this means that the characters for space
+and seven other characters ("< > \ _ { | }") are in the wrong place. You are likely
+to notice this first if you try to set a label with two words; the space will come
+out as a small diagonal stroke accent that is used in plain \TeX\ to make the
+characters Ł and ł, used in Polish and other Slavic languages.
To fix this you should change the default font at the start of your program:
\begin{code}
@@ -3887,16 +2875,16 @@
Choosing a font with one of these encodings means that if you use Windows code page
1252 or ISO Latin 1 as the encoding for your text editor, you can create labels with
-accented characters using "infont" and without resorting to "btex" \dots\ "etex".
+accented characters using \mpl{infont} and without resorting to \mpl{btex ... etex}.
But if you are using UTF-8 characters (as many of us are now), then you have to do
-some extra work to get them printed correctly with "infont". A solution is shown on
+some extra work to get them printed correctly with \mpl{infont}. A solution is shown on
the next page.
-In the normal course of labelling a drawing, it is always possible to
-use "btex" \dots\ "etex" to produce your accented characters as discussed in section
-\ref{btex} below; but it may be that you are using \MP\ to represent data and labels
-supplied from some other program or a website. In this case it can be useful to be
-able to work with at least a subset of UTF-8 input.
+When labelling a drawing, it is always possible to use \mpl{btex ... etex} to
+produce your accented characters as discussed in section \ref{btex} below; but it
+may be that you are using \MP\ to represent data and labels supplied from some other
+program or a website. In this case it can be useful to be able to work with at
+least a subset of UTF-8 input. This is discussed in the next section.
\newpage
\subsubsection{Mapping a subset of UTF-8 for \texttt{infont}}
@@ -3914,7 +2902,7 @@
then pick the appropriate character in your encoding with "char". But your
output is still, of course, limited to the 256 characters in your encoded font.
-\item If you get tired of writing "decode", you could define a short cut with a
+\item If you get tired of typing "decode", you could define a short cut with a
shorter name. You could even write it as a primary without parentheses like
this:
\begin{code}
@@ -3922,53 +2910,30 @@
\end{code}
which would let you write:
\begin{code}
-label.rt(U"café à la möde", (x,y));
+label.rt(U"café à la crème", (x,y));
\end{code}
-\item However, there's no point in making any of this too elaborate. If you
- really want proper Unicode support you should use \MP\ with Lua\TeX. (See
+\item \red{However, there's no point in making any of this too elaborate}. If you
+ really want proper Unicode support you should use \MP\ with Lua\TeX. (See
below in §\ref{sec:neo-labels}).
\vss}}
-\begin{code}[xrightmargin=-10pt]
-vardef decode(expr given) =
- save a,i,s,out; string s, out; numeric a, i;
- out = ""; i=0;
- forever:
- i := i+1; s := substring (i-1,i) of given; a := ASCII s;
- if a < 128:
- elseif a = 194:
- i := i+1; s := substring (i-1,i) of given;
- elseif a = 195:
- i := i+1; s := char (64 + ASCII substring (i-1,i) of given);
- else:
- s := "?";
- fi
- out := out & s;
- exitif i >= length given;
- endfor
- out
-enddef;
-\end{code}
-Use it with "infont" like this: \verb|decode("café") infont "ptmr8r"| to produce a
-normal "picture" that can be passed to \mpl{draw} or saved as
-usual.\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip -9.5pt
-\noindent The fragment on the left produces:
-$$\includegraphics{utf8}$$
+\mpexternal[firstline=6,lastline=23,xrightmargin=-10pt]{trad-utf8.mp}
+\noindent
+Use it with \mpl{infont} like this: ‘\mpl{decode("café") infont "ptmr8r"}’
+to produce a normal \<picture> that can be passed to \mpl{draw} or saved as
+usual.\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip -9.5pt\noindent
+The fragment on the left produces:
+$$\includegraphics{trad-utf8}$$
The \texttt{label} macro automatically calls \texttt{infont} with the current value
-of \texttt{defaultfont}; notice how it also adds some extra space.
+of \texttt{defaultfont}; notice how it also adds \mpl{labeloffset} space.
\vss}}
-\begin{code}
-draw "café noir £2.50" infont "pncr8r";
-draw decode("café noir £2.50") infont "pncr8r" shifted 12 down;
-defaultfont := "pncr8r";
-label.rt("café noir £2.50", 24 down);
-label.rt(decode("café noir £2.50"), 36 down);
-\end{code}
+\mpexternal[firstline=25,lastline=29]{trad-utf8.mp}
+
+\noindent
Note that you can't just use \mpl{draw} with a string variable; you have to use
-"infont" to turn the string into a picture.
-On the other hand, "label" calls "infont" automatically, but you must explicitly set
-the default font, preferably to one with an encoding that
-is compatible with ISO Latin~1.
+\mpl{infont} to turn the string into a picture. On the other hand, \mpl{label} calls
+\mpl{infont} automatically, but you must explicitly set the default font, preferably
+to one with an encoding that is compatible with ISO Latin~1.
\newpage
@@ -3985,7 +2950,7 @@
which is the hyphen character. What we need is the mathematical minus sign instead;
this is what you get with \mpl{btex $-1$ etex} of course, but that's harder to put in a
loop with traditional \MP. Instead you can do this:\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in
-$$\includegraphics{minus}$$
+$$\includegraphics{trad-minus}$$
\vss}}
\begin{code}
string minus_sign;
@@ -3992,11 +2957,11 @@
minus_sign := char 143; % if you are using the texnansi encoding
minus_sign := char 12; % if you are using the 8r encoding
for x = -3 upto 3:
- label.bot(if x<0: minus_sign & fi decimal abs(x), (x*cm, 0));
+ label.bot(if x<0: minus_sign & fi decimal abs(x), (x*cm, 0));
endfor
\end{code}
Note that this does not work with the default encoding used in "cmr10" because
-there is no minus sign available in that font. Plain TeX uses "char 0" from
+there is no minus sign available in that font. Plain TeX uses \mpl{char 0} from
"cmsy10".
\subsubsection{Bounding boxes and clipping with \texttt{infont}}
@@ -4005,28 +2970,27 @@
metrics and the programs that draw the actual glyphs. The font metrics define the
width of each character and provide a kerning table to adjust the space between
particular pairs.\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in
-$$\includegraphics{infont-example}$$
-}} This means that certain characters will overlap each other or stick out
-beyond the bounding box of the picture produced by "infont". This is not normally a
+$$\includegraphics{trad-infont-example}$$
+}} This means that certain characters will overlap each other or stick out beyond
+the bounding box of the picture produced by \mpl{infont}. This is not normally a
problem unless the picture happens to be at the edge of your figure. In the first
-example observe how the last letter sticks out to the right; in the second a
-wider baseline has been added to prevent this.
-If you want this effect, but you
-don't want to see the baseline, then draw it
-using the colour \mpl{background}.
+example observe how the last letter sticks out to the right; in the second a wider
+baseline has been added to prevent this. If you want this effect, but you don't
+want to see the baseline, then draw it using the colour \mpl{background}.
\subsubsection{But what about the \texttt{label} command?}
-As a convenience, the plain \MP\ format provides a "label" macro that automatically
-turns strings into pictures for you using whatever font name is the current value of
-"defaultfont" and scaled to the current value of "defaultscale".\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in
+As a convenience, the plain \MP\ format provides a \mpl{label} macro that
+automatically turns strings into pictures for you using whatever font name is the
+current value of \mpl{defaultfont} and scaled to the current value of
+\mpl{defaultscale}.\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in
\noindent
-The "label" macro is defined (essentially) to do this:
+Plain \MP\ defines a \mpl{label} macro (approximately) like this:
\begin{code}
- def *label(expr s, z) =
- draw s if string s: infont defaultfont
- scaled defaultscale fi shifted z
- enddef;
+def label(expr s, z) =
+ draw s if string s: infont defaultfont
+ scaled defaultscale fi shifted z
+enddef;
\end{code}
plus some clever code to align the label for you.
}}
@@ -4036,25 +3000,24 @@
\label{infontbbox}
To allow you to align a text label on a specific point, \MP\ provides five unary
-operators to measure the bounding box of a picture; they are shown in
-\textcolor{red!67!black}{red} in the diagram, and you can use them to measure the
-width, depth, and height of a textual picture. You can also work out the location
-of the baseline of the text or the x-height, provided you know how much your picture
-has been shifted.
-The easiest way to do this is to
-measure the picture \textit{before} you shift it.\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in
-$$\includegraphics[width=4in]{infont-annotated}$$
+operators to measure the bounding box of a picture; they are shown in \red{red} in
+the diagram, and you can use them to measure the width, depth, and height of a
+textual picture. You can also work out the location of the baseline of the text or
+the x-height, provided you know how much your picture has been shifted.
+The easiest way to do this is to measure the picture \textit{before}
+you shift it.\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in
+$$\includegraphics[width=4in]{trad-infont-annotated}$$
\vss}}
\begin{code}
- picture pp; pp = "proof" infont "pplri8r";
+picture pp; pp = "proof" infont "pplri8r";
\end{code}
Here the picture \id{pp}
is created with the origin of the text sitting at coordinates $(0,0)$;
then you can get the dimensions like this
\begin{code}
- wd = xpart urcorner pp;
- ht = ypart urcorner pp;
- dp = ypart lrcorner pp;
+wd = xpart urcorner pp;
+ht = ypart urcorner pp;
+dp = ypart lrcorner pp;
\end{code}
In this particular case you will find that you have $wd=20.47292$, $ht=7.19798$, and
$dp=-2.60017$. The depth is negative because the descenders on the
@@ -4070,7 +3033,7 @@
origin at position $(x,y)$ you just need to use: \kw{draw} \id{pp} \kw{shifted} $(x,y)$.
To draw it right-aligned, you subtract
\id{wd} from the $x$-coordinate: \kw{draw} \id{pp} \kw{shifted} $(x-wd,y)$. Or to
-centre it, subtract $1/2wd$. To center it vertically on the lowercase letters,
+centre it, subtract $1/2\id{wd}$. To center it vertically on the lowercase letters,
subtract $1/2\id{xheight}$ from the $y$-coordinate. You might of course like to
wrap these adjustments up in your own convenient macro to help you maintain
consistency in a diagram with many labels.
@@ -4079,20 +3042,20 @@
it with "label" as normal. Assuming \id{wd} is set to the width of your picture
and \id{xheight} is set correctly for the current font, then
\begin{code}
- setbounds pp to unitsquare xscaled wd yscaled xheight;
+setbounds pp to unitsquare xscaled wd yscaled xheight;
\end{code}
will make the "label" alignment routines ignore any ascenders or descenders.
\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in \vss \small
\noindent\llap{\nb}Beware that if the resulting label is right at the edge of your
drawing then any parts of the text that stick out of the adjusted bounding box will
-be clipped. See also §\ref{sec:rotated-boxes} for more on what happens if you
-rotate the text.}}
+be clipped.\\
+See also §\ref{sec:rotated-boxes} for more on what happens if you rotate the text.}}
\newpage
\subsubsection{Setting Greek letters with \texttt{infont}}
\leavevmode\hbox{}
-$$\includegraphics[width=0.5\textwidth]{greek-homer}$$
+$$\includegraphics[width=0.5\textwidth]{trad-greek-homer}$$
While it's technically possible to set the whole of Homer's \textsl{Iliad} using the Greek
fonts available to \mpl{infont}, it's probably not a great use of time; on the other hand you
might want to label parts of a diagram with Greek letters, and for single Greek
@@ -4109,30 +3072,11 @@
Herman Zapf's elegant Euler font, available as "eurm10". This
makes a refreshing change for some diagrams.\vadjust{\moveright5.5in\vbox to
0pt{\hsize4in\kern-164pt
-\begin{code}
-beginfig(1);
-string ab, AB;
-ab = ("" for i=11 upto 23: & char i endfor
- & "o" for i=24 upto 33: & char i endfor);
-AB = ("AB" & char 0 & char 1 & "EZH" & char 2 & "IK"
- & char 3 & "MNO" & char 4 & char 5 & "P"
- & char 6 & "T" & char 7 & char 8 & "X"
- & char 9 & char 10);
+\mpexternal[firstline=5,lastline=18]{trad-greek-default-encoding.mp}
+\centerline{\includegraphics{trad-greek-default-encoding}}
-draw ab infont "cmmi10";
-draw AB infont "cmmi10" shifted 12 down;
-draw ab infont "eurm10" shifted 32 down;
-draw AB infont "eurm10" shifted 44 down;
-endfig;
-\end{code}
-\centerline{\includegraphics{greek-default-encoding}}
-
-\begin{code}
-string ab, AB;
-ab = "abgdezhjiklmnoxprstufqyw";
-AB = "ABGDEZHJIKLMNOXPRSTUFQYW";
-\end{code}
-\centerline{\includegraphics{greek-gfs-encoding}}
+\mpexternal[firstline=6,lastline=8]{trad-greek-gfs-encoding.mp}
+\centerline{\includegraphics{trad-greek-gfs-encoding}}
\vss}}
\medskip\noindent
@@ -4143,7 +3087,7 @@
can use as a word space, so if you want to set Greek text rather than individual
letters, see §\ref{sec:neo-otf}.
-\vbox to 0pt{\centerline{\includegraphics{porson}}\vss}
+\vbox to 0pt{\centerline{\includegraphics{trad-porson}}\vss}
@@ -4151,14 +3095,14 @@
\subsection{Setting text with \texttt{btex ... etex}}\label{btex}
As soon as you need anything complicated in a label, like multiple fonts, multiple
-lines, or mathematics, you will find it easier to switch from "infont" to the
-"btex ... etex" mechanism that calls \TeX\ to create your textual picture. In fact
+lines, or mathematics, you will find it easier to switch from \mpl{infont} to the
+\mpl{btex ... etex} mechanism that calls \TeX\ to create your textual picture. In fact
you might prefer to use \TeX\ for all your labels, even simple strings, for the sake
of consistency. The only downside is that this mechanism is a little bit slower.
-The "btex" mechanism produces a textual picture just as "infont" does with a height,
+The "btex" mechanism produces a textual picture just as \mpl{infont} does with a height,
width, and depth that you can measure, and adjust, as discussed in
-section~\ref{infontbbox}. And again, just like "infont" you can either use \mpl{draw}
+section~\ref{infontbbox}. And again, just like \mpl{infont} you can either use \mpl{draw}
to place the resulting picture directly, or pass it to the "label" macro.
What you need to be aware of is that \MP\ places everything you put between the
@@ -4200,11 +3144,12 @@
\subsubsection{Multi-line text labels}
-Another consequence of the "hbox" feature is that there is no automatic text
+Another consequence of the "\hbox" feature is that there is no automatic text
wrapping done for you, but again you can work round this easily because \TeX\ lets
you nest a "\vbox" inside an "\hbox". This gives you proper paragraph-like wrapping
but you will almost certainly need to adjust the line length, justification, and
-indentation in order to get a satisfactory result \rightarrow \vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vskip -42pt\noindent
+indentation in order to get a satisfactory result \rightarrow
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vskip -64pt\noindent
\begin{code}
...
label(btex \vbox{\hsize 2in\parindent 0pt\raggedright
@@ -4239,27 +3184,65 @@
table as it were.
Note also that the definition of "\s" as given will centre each line of the text under
the one above. If you want them left aligned or right aligned, omit one of the
-"\hfil" commands. \mpic{-160pt}{split-labels}
-The three examples from this page are typeset over here \rightarrow\break
+"\hfil" commands. \mpic{-212pt}{trad-split-labels}
+The three examples given above are typeset over here $\longrightarrow$\break
The small red circle show the reference points and the pale blue lines the
bounding boxes of the pictures that \MP\ gets back from \TeX.
You can of course achieve the same effects using \LaTeX\ tabular structures, but
-then you have to use the "-tex=latex" option to run
-\MP.
+then you have to use the "-tex=latex" option to run \MP.
\smallskip\noindent
\textbf{Note}: In case it's not obvious, if you want text wrapping or tabular
-arrangements as discussed here, you need to use \texttt{btex ... etex} to set your
-labels. There's no text wrapping with "infont". On the other hand if all of your
-labels are in "infont" but you just want one extra that has two lines, you can split
+arrangements as discussed here, you need to use \mpl{btex ... etex} to set your
+labels. There's no text wrapping with \mpl{infont}. On the other hand if all of your
+labels are done with \mpl{infont}, but you just want one extra that has two lines, you can split
the text into two separate labels and position them independently.
\newpage
+\subsubsection{Pins and braces}\label{sec:braces}
+
+\textsc{In some awkward corners}, you may find that you just can't get your label in
+the right place with \mpl{dotlabel} even if you adjust \mpl{labeloffset}. In these
+cases there are two simple techniques you can use. First, you could separate
+drawing the dot from placing the label; given a point $P$ you can try:\mpic{0pt}{trad-callout}
+\mpexternal[firstline=9,lastline=10]{trad-callout.mp}
+\noindent
+Using \mpl{dotlabeldiam} ensures that your dots match any others done with
+\mpl{dotlabel}.
+Secondly, if that's not enough, use a temporary pair to create a call out line:
+\mpexternal[firstline=11,lastline=15]{trad-callout.mp}
+\noindent
+If you want to do this sort of thing often, then it might be worth making a macro;
+it is hard to write anything completely general, but see §\ref{sec:extimage} for an
+example.
+
+\enlargethispage{24pt}
+
+\vfill\noindent
+\textsc{You might also want} to mark a straight line between two points.
+\vadjust{\moveright5.3in\vbox to 0pt{\hsize 4.2in\vspace{-2\baselineskip}
+\smallmpexternal[firstline=6,lastline=19]{trad-braces.mp}
+\smallmpexternal[firstline=28,lastline=28]{trad-braces.mp}
+\noindent
+Note that, as well as drawing the braces, the macro uses the grouping provided by \mpl{vardef} to return the
+mid point so that you can put a label next to it.
+\vss}}
+The simplest way to do this is just to use \mpl{drawdblarrow} on a copy of your straight
+path shifted to one side, like so:
+\begin{code}
+drawdblarrow (z1--z2) shifted (12 up rotated angle (z2-z1));
+\end{code}
+If you combine this with temporarily setting \mpl{ahangle:=180}, you get the simple
+dimension line shown in blue.
+$$\includegraphics{trad-braces}$$
+The red braces are a more complex variation on this theme $\longrightarrow$
+
+\newpage
\subsubsection{Dynamic labels}\label{sec:old-and-dynamic}
If you are a maven of programming language syntax you may have noticed that
-"btex ... etex" fits into the type system that \MP\ inherits from \MF\ as a "picture" and
+\mpl{btex ... etex} fits into the type system that \MP\ inherits from \MF\ as a "picture" and
not as a "string". Effectively, "btex" and "etex" act as a special pair of quotation
marks that create a picture; however the contents are used verbatim, so that the
whole construction is a syntactical atom. This means that you \textbf{cannot} write
@@ -4271,9 +3254,9 @@
\end{code}
Given this input \MP\ would attempt to get \TeX\
to typeset
-\begin{code}
+\begin{texcode}
\hbox{"$p_" & decimal i & "$"}
-\end{code}
+\end{texcode}
which would probably result in a
`Misplaced alignment tab character' error.
To get round this problem, \MP\ provides a general mechanism to write out a
@@ -4298,22 +3281,11 @@
all the labels and only writing it once.
The "write" command is a \MP\ primitive, and "EOF" is defined in "plain.mp".%
\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize4in\noindent
-\begin{code}
-path c; c = fullcircle scaled 100; draw c withcolor .67 red;
-for i=0 upto 7:
- fill fullcircle scaled 3 shifted point i of c;
- z[i] = point i of c scaled 1.15;
- write "label(btex $p_" & decimal i & "$ etex,("
- & decimal x[i] & "," & decimal y[i]
- & "));" to ".mplabels";
-endfor
-write EOF to ".mplabels";
-input ".mplabels";
-\end{code}
+\mpexternal[firstline=7,lastline=16]{trad-dynamic-labels.mp}
$$
-\includegraphics{dynamic-labels}
+\includegraphics{trad-dynamic-labels}
$$
-Note that you can't use "decimal" on a "pair" variable, but you can save the pair
+Note that you can't use \mpl{decimal} on a \<pair> variable, but you can save the pair
as a "z"-variable and then use the "x" and "y" syntax. The scaling trick used here
only works because "c" is centred on the origin. If "c" were drawn elsewhere, you
would have to write:
@@ -4322,10 +3294,11 @@
scaled 1.15
shifted center c ...
\end{code}
+\vskip -12pt
}}
\newpage
-\subsection{Matching fonts}\label{sec:fonts}
+\subsubsection{Matching fonts}\label{sec:fonts}
Despite the apparent restriction of using plain \TeX\ it is almost always possible
to match the font and format of an enclosing \LaTeX\ document.
@@ -4386,22 +3359,17 @@
\ref{sec:neo-labels}.
\newpage
-\subsection{Setting verbatim listings}\label{sec:verbatim}
+\subsubsection{Setting verbatim listings}\label{sec:verbatim}
-\textsc{There is a good chance} that you will never need to set a verbatim
+\textsc{There is a good chance} that you will never need to set a verbatim
listing in a \MP\ drawing, but if you do there are a couple of things to think
about. The issue about setting text verbatim with \TeX\ is that turning off the
control characters can be tricky, so if you have text for a label with characters
that are special in \TeX\ like the backslash or the underscore, then the simplest
thing to do is to avoid \TeX\ completely and use \mpl{infont} instead.
-\mpic{-36pt}{verbatim-with-infont}
-\begin{code}
-string s; s = "\TeX\ sets maths like this $e=mc^2$";
-draw ("1. " & s) infont defaultfont;
-draw ("2. " & s) infont "texnansi-lmr10" shifted 20 down;
-draw ("3. " & s) infont "cmtt10" shifted 40 down;
-draw ("4. " & s) infont "texnansi-lmtt10" shifted 60 down;
-\end{code}
+\mpic{-48pt}{trad-verbatim-with-infont}
+\mpexternal[firstline=6,lastline=10]{trad-verbatim-with-infont.mp}
+\noindent
But as you can see, (1) this is a bit of a disaster with the default font "cmr10"
because it does not have all the glyphs in the usual ASCII positions (as noted
above §\ref{sec:charsets}). The solution is to use the version of the font
@@ -4409,89 +3377,20 @@
as you can see "cmtt10" has the “visible space” character instead of a regular
space. If this is not what you want then use the alternative encoding (4).
+\vfill
If you want more than this, then you really need to use \LaTeX\ to process the
label, as discussed in §\ref{sec:fonts}, and load the appropriate preamble. \rightarrowfill\break
-\vadjust{\moveright5.5in\vbox to 0pt{\vskip -72pt\begin{smallcode}
-prologues := 3; outputtemplate := "%j.eps";
-verbatimtex
-\documentclass{article}
-\usepackage{listings}
-\newcommand\mpstyle{\lstset{language=Metapost, basicstyle=\ttfamily,
-columns=fullflexible, keepspaces=true, showstringspaces=false}}
-\lstnewenvironment{code}[1][]{\mpstyle\lstset{#1}}{}
-\begin{document}
-etex
-beginfig(1);
-picture P;
-P = thelabel(btex \vbox{\begin{code}
- % special operators
- vardef incr suffix $ = $:=$+1; $ enddef;
- vardef decr suffix $ = $:=$-1; $ enddef;
+\vadjust{\moveright5.5in\vbox to 0pt{\vskip -10\baselineskip
+\smallmpexternal{trad-verbatim-listing.mp}
+\noindent\hey Compile this with "mpost -tex=latex" and use "epstopdf" to make a PDF.
+\vss}}
+$$\includegraphics[width=0.9\textwidth]{trad-verbatim-listing}$$
- def reflectedabout(expr w,z) = % reflects about the line w..z
- transformed begingroup transform T_;
- w transformed T_ = w;
- z transformed T_ = z;
- xxpart T_ = -yypart T_;
- xypart T_ = yxpart T_; % T_ is a reflection
- T_ endgroup enddef;
-\end{code}} etex, origin);
-fill bbox P withcolor (1,1,31/32); draw P; draw bbox P;
-endfig; end.
-\end{smallcode}\vss}}
-
-\bigskip
-$$\includegraphics[width=0.9\textwidth]{verbatim-listing}$$
-
-
-
-%% \subsubsection{Getting full access to your system fonts}
-%%
-%% If you want full access to all of your system fonts you can
-%% approach the problem the other way round and use one of the various means to include
-%% \MP\ graphics as part of your \LaTeX\ source code. These include "gmp" for
-%% pdf\LaTeX, "luamplib" for lua\LaTeX, and the whole Context system. The great
-%% advantage of these systems is that all of your \MP\ labels directly inherit the
-%% environment of the parent document, and give you access to all your system fonts and
-%% full Unicode support -- the only disadvantages are that it's not so fast or simple as plain \MP\
-%% and you have to compile every graphic everytime you compile the document. It is of course always possible to
-%% use these systems to produce standalone PDF graphics that you can then include in a
-%% more conventional \TeX\ document. The example on the right shows how; in this case
-%% the text uses the fonts set in the \LaTeX\ preamble.\vadjust{\moveright5.5in\vbox to
-%% 0pt{\hsize 4in\vss\noindent
-%% Here is a version of the Lua logo, with a Unicode accent for show.
-%% $$\includegraphics[scale=0.7]{lulu.pdf}$$
-%% produced with "luamplib":
-%% \begin{smallcode}
-%% \documentclass[margin=5mm]{standalone}
-%% \usepackage{fontspec}
-%% \setmainfont{TeX Gyre Heros}
-%% \usepackage{luamplib}
-%% \begin{document}
-%% \begin{mplibcode}
-%% beginfig(1);
-%% color lemon, midnight; lemon = (1,1,1/2); midnight = (0,0,1/2);
-%%
-%% fill unitsquare shifted -(1/2,1/2) scaled 4cm withcolor lemon;
-%% fill fullcircle scaled 3cm withcolor midnight;
-%% draw fullcircle scaled 3.7cm dashed evenly scaled 2 withcolor .5 white;
-%%
-%% fill fullcircle scaled 8mm shifted (0.7cm,0.7cm) withcolor white;
-%% fill fullcircle scaled 8mm shifted (1.4cm,1.4cm) withcolor midnight;
-%%
-%% label.bot(btex Luã etex scaled 2.8,origin) withcolor white;
-%% endfig;
-%% \end{mplibcode}
-%% \end{document}
-%% \end{smallcode}
-%% }}
-
-
\newpage
-\section{Modern labels and annotations}\label{sec:neo-labels}
+\section{Modern labels, annotations, and other goodies}\label{sec:neo-labels}
This section is a re-working of the previous section, that attempts to show how much
-nicer it is to handle labels in the new world of "luamplib". If this is all new
+nicer it is to work in the new-fangled world of "luamplib". If this is all new
to you, you probably should start by doing "texdoc luamplib" on your system
and reading the documentation provided with the package. In order to use these
newfangled facilities you need to create your \MP\ diagrams inside a \TeX-wrapper
@@ -4500,8 +3399,8 @@
\medskip\noindent
The first thing to say is that everything in the preceding section
will continue to work more or less the same when you use "luamplib" with Lua\LaTeX.
-It is designed to be backwards-compatible, so that existing \MP\ programs using "infont" and
-"btex" \dots\ "etex" will continue to work without change. The only differences are:
+It is designed to be backwards-compatible, so that existing \MP\ programs using \mpl{infont} and
+\mpl{btex ... etex} will continue to work without change. The only differences are:
that the "TEX()" macro is re-implemented with internal library functions
so that it no longer uses temporary files, and is therefore very much faster; and it
is easier to integrate your drawings into \LaTeX\ because you no longer need to muck
@@ -4516,27 +3415,7 @@
\begin{mplibcode}
\end{texcode}
\vskip-\baselineskip
-\begin{smallcode}
- beginfig(1);
- for x = 0 upto 1:
- draw (80x,16) -- (80x, -68) withcolor 3/4[red, white];
- endfor
- for y = 0 upto 3:
- draw (0, -20y) -- (160, -20y) withcolor 3/4[red, white];
- endfor
-
- string s; s = "Hand gloves";
- draw s infont defaultfont shifted (0, 0);
- draw s infont "phvr8r" shifted (0, -20);
- draw TEX(s) shifted (0, -40);
- draw btex Hand gloves etex shifted (0, -60);
-
- dotlabel.urt(s, (80, 0));
- dotlabel.urt(s infont "phvr8r", (80, -20));
- dotlabel.urt(TEX(s), (80, -40));
- dotlabel.urt(btex Hand gloves etex, (80, -60));
- endfig;
-\end{smallcode}
+\smallmpexternal[firstline=7,lastline=25]{neo-labels.mp}
\vskip-\baselineskip
\begin{texcode}
\end{mplibcode}
@@ -4547,13 +3426,12 @@
Note that "defaultfont" is still "cmr10" with the encoding that has the small stroke
(that plain \TeX\ uses for the \L\ character) instead of a space, and that you can
still use PostScript fonts like "phvr8r". But also notice that the "TEX()" macro
-and the "btex" \dots\ "etex" construction have picked up the font set by the \LaTeX\
+and the \mpl{btex ... etex} construction have picked up the font set by the \LaTeX\
wrapper. As you can see they produce exactly the same output; "TEX()" is generally
more useful because you can pass a primary string variable as an argument, which
makes it easier to construct dynamic labels. "TEX()" also has the synonym
-"textext()" for compatibility with ConTexT. You can use either name, as you prefer.
-
-\smallskip\noindent
+"textext()" for compatibility with ConTexT. You can use either name, as you
+prefer.\\
But this isn't the clever bit\dots
\clearpage
@@ -4567,7 +3445,7 @@
\mplibtextextlabel{enable}
\end{texcode}
If you add this line to the example from the previous
-page,\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip-80pt
+page,\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip-78pt
\begin{texcode}
\documentclass[border=5mm]{standalone}
\usepackage{fontspec}
@@ -4578,27 +3456,7 @@
\begin{mplibcode}
\end{texcode}
\vskip-\baselineskip
-\begin{smallcode}
- beginfig(1);
- for x = 0 upto 1:
- draw (80x,16) -- (80x, -68) withcolor 3/4[red, white];
- endfor
- for y = 0 upto 3:
- draw (0, -20y) -- (160, -20y) withcolor 3/4[red, white];
- endfor
-
- string s; s = "Hand gloves";
- draw s infont defaultfont shifted (0, 0)0
- draw s infont "phvr8r" shifted (0, -20);
- draw TEX(s) shifted (0, -40);
- draw btex Hand gloves etex shifted (0, -60);
-
- dotlabel.urt(s, (80, 0));
- dotlabel.urt(s infont "phvr8r", (80, -20));
- dotlabel.urt(TEX(s), (80, -40));
- dotlabel.urt(btex Hand gloves etex, (80, -60));
- endfig;
-\end{smallcode}
+\smallmpexternal[firstline=8,lastline=26]{neo-labels-tte.mp}
\vskip-\baselineskip
\begin{texcode}
\end{mplibcode}
@@ -4643,23 +3501,15 @@
Lua\LaTeX, and in particular it assumes some familiarity with the packages
"fontspec" and "unicode-math" that provide complete support for Unicode and OTF
fonts; you need this familiarity in order to use "luamplib" properly.
-\mpic{1cm}{unicode}
+\mpic{1cm}{neo-unicode}
You also need an editor that will handle Unicode. \MP\ still restricts you to using
-printable ASCII in your source code, except within a string literal or a "btex"
-\dots\ "etex" picture literal. So it becomes very easy to write this sort of label:
-\begin{smallcode}
-label("café noir £2.50", origin);
-\end{smallcode}
+printable ASCII in your source code, but you can put whatever you want inside a string literal or a "btex"
+\dots\ "etex" picture literal. So it becomes very easy to produce this sort of label:
+\smallmpexternal[firstline=8,lastline=8]{neo-unicode.mp}
+\noindent
or even whole paragraphs that use Unicode:
-\begin{smallcode}
-label(btex \vbox{\hsize 4in
- Nous étions à l'Étude, quand le Proviseur entra, suivi d'un
- \textit{nouveau} habillé en bourgeois et d'un garçon de classe
- qui portait un grand pupitre. Ceux qui dormaient se réveillèrent,
- et chacun se leva comme surpris dans son travail.
-\par} etex, 40 down);
-\end{smallcode}
+\smallmpexternal[firstline=9,lastline=14]{neo-unicode.mp}
But you also need a font that actually supports the Unicode characters you use.
The default Latin Modern font used by Lua\LaTeX\ has a good range for English and
most European languages, but is a bit lacking in (say) polytonic Greek. So you will
@@ -4679,7 +3529,7 @@
\end{smallcode}
will produce the first few lines of the Iliad (just in case you wanted them).
Essentially if you can produce something in \LaTeX, you can produce exactly the same
-in \MP\ using "luamplib" (but see also §\ref{sec:verbatim}).
+in \MP\ using "luamplib".
\newpage
@@ -4688,39 +3538,28 @@
It is a rule of syntax in \MP\ that a string token has to be given all on one line.
So if you have very long labels, or paragraphs of text, then you have to split them
up into separate shorter string tokens:
-\begin{code}
-label("\vbox{\hsize 4in It is a truth universally acknowledged,"
- & " that a single man in possession of a good fortune,"
- & " must be in want of a wife.\par}", origin);
-\end{code}
+\mpexternal[firstline=7,lastline=9]{neo-multi-line-labels.mp}
+\noindent
taking care to include the necessary spaces, which can get fiddly.
-\mpic{-15mm}{multi-line-labels}
+\mpic{-15mm}{neo-multi-line-labels}
-But this is where the "btex" \dots\ "etex" construction comes into play, even with
+But this is where the \mpl{btex ... etex} construction comes into play, even with
"luamplib". As we saw in the preceding section the construction fits into the \MP\
syntax scheme as a special pair of quotation marks that produces a \<picture>.
-Unlike regular string token, a "btex" \dots\ "etex" picture token can span several
+Unlike regular string token, a \mpl{btex ... etex} picture token can span several
lines of source code, so you can (more easily) write long \TeX\ labels like this:
-\begin{code}
-label(btex \vbox{\hsize 4in
- It is a truth universally acknowledged,
- that a single man in possession of a good fortune,
- must be in want of a wife.
- \par} etex, 128 down);
-\end{code}
+\mpexternal[firstline=10,lastline=13]{neo-multi-line-labels.mp}
+\noindent
Thanks to the backward compatibility of the implementation, this works very well
even when you have "mplibtextextlabel" enabled.
-You also have full access to your \LaTeX\ environment, so you can get tables in the
-same way in \MP\ using environments like "tabular":
-\begin{code}
-label(btex
- \begin{tabular}{c}
- A way to get simple\\
- two line labels
- \end{tabular} etex, 256 down);
-\end{code}
-But recall that whatever you ask the \mpl{TEX()} macro to typeset like this is going into
+\vfill
+\noindent
+You also have comprehensive access to your \LaTeX\ environment, so with "luamplib"
+you can get tables in in \MP\ using environments like "tabular":
+\mpexternal[firstline=14,lastline=17]{neo-multi-line-labels.mp}
+
+But keep in mind that whatever you ask the \mpl{TEX()} macro to typeset is going into
a restricted horizontal mode box; so don't try to use floating environments like
"table" or "figure". And if you want automatic paragraph wrapping, you will have
to wrap your text in a suitable "\vbox", as shown above.
@@ -4731,11 +3570,10 @@
cannot use "$$ .. $$" to create display maths directly. This is not a \TeX\
\textit{v} \LaTeX\ issue, it is just that for compatibility with plain \MP\ (and
common sense), the designers of "luamplib" chose to typeset labels into
-horizontal-mode boxes This is usually what you want. If you prefer
-large integral
-operators (etc) in your labels,
-then you should either add
-"\displaystyle" at the beginning of your formula $\longrightarrow$\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
+horizontal-mode boxes This is usually what you want. If you prefer large integral
+operators (etc) in your labels, then you should either add "\displaystyle" at the
+beginning of your formula \rightarrowfill\break
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4in\vss\noindent
\begin{code}
...
label("$\displaystyle \int_0^t 3x^2\, dx$", z0);
@@ -4743,22 +3581,17 @@
label("\vbox{\hsize 2in $$\int_0^t 3x^2\, dx$$}", z1);
...
\end{code}
-}}
-\\
+\vskip-1.5\baselineskip}}%
or wrap the formula in a "\vbox" with a suitable "\hsize". Using "\displaystyle" is
probably simpler.
-\subsection{Typographical minus signs and other dynamic labels}
+\subsection{Typographical minus signs and other dynamic labels}\label{sec:new-dynamic}
This is really easy with "mplibtextextlabel" enabled, because we can assemble a string
-on the fly using standard \MP\ syntax:\mpic{0pt}{simple-number-line}
-\begin{code}
-draw (left--right) scaled 2in withcolor 2/3 red;
-for i=-4 upto 4:
- dotlabel.top("$" & decimal i & "$", (32i, 0));
-endfor
-\end{code}
+on the fly using standard \MP\ syntax:\mpic{0pt}{neo-simple-number-line}
+\mpexternal[firstline=8,lastline=11]{neo-simple-number-line.mp}
+\noindent
The normal operator precedence rules ensure that the string argument to
\mpl{dotlabel} is assembled before it is passed to the \mpl{TEX()} macro.
The individual parts of the string you assemble do not have to be
@@ -4766,31 +3599,24 @@
are actually passed to the macro. With "luamplib" there are no slow
external files being used, so the complexities used above
[§\ref{sec:old-and-dynamic}] to label points around a
-circle can be simplified without sacrificing speed:\mpic{-80pt}{simple-circle-labels}
-\begin{code}
-path C; C = fullcircle scaled 100; draw C withcolor 2/3 red;
-for i=0 upto 11:
- drawdot point 2/3 i of C withpen pencircle scaled dotlabeldiam;
- label("$p_{" & decimal i & "}$", point 2/3 i of C scaled 1.17);
-endfor
-\end{code}
+circle can be simplified without sacrificing speed:\mpic{-80pt}{neo-simple-circle-labels}
+\mpexternal[firstline=7,lastline=12]{neo-simple-circle-labels.mp}
-\smallskip\noindent\nb But note that you can't do this string concatenation with "btex" \dots\ "etex";
-although they might appear to be special quotation marks, they produce a
-\<picture>, and \mpl{&} only works with strings or paths.
+\smallskip\noindent\nb Note that you can't do this string concatenation with \mpl{btex ... etex};
+although these operators might appear to be special quotation marks, they produce
+\<picture> values, and in this context \mpl{&} only works with \<string> values.
+
\newpage
\subsection{Drawing on an external image}\label{sec:extimage}
-One of the limitations of the way that plain "mpost" uses \TeX\ is that
-any "\special" commands are removed from the intermediate file that \MP\ translates
-into a \<picture> variable. Hence, in particular, you cannot use
-"\includegraphics" in a \TeX\ label. Fortunately, "luamplib" removes this
-limitation, so it is now possible to annotate images using the full array of \MP\
-tools.
-$$\includegraphics[width=360pt]{marked-up-photo}$$
-The source is shown on the right.
-\vadjust{\moveright5.5in\vbox to 0pt{\vskip-3.75in\hsize 4in\raggedright\noindent
+A limitation of plain "mpost"'s use of \TeX\ is that
+"\special" commands are removed from the ".dvi" file that is made
+into a \<picture> variable. So, in particular, you can’t use
+"\includegraphics" in a \TeX\ label. But "luamplib" removes this
+limitation, so you can annotate images using the full array of \MP\
+tools, as shown here \rlap{$\longrightarrow$}%
+\vadjust{\moveright5.25in\vbox to 0pt{\vskip-60pt\hsize 4.5in\raggedright\noindent
\begin{texcode}
\documentclass[border=1mm]{standalone}
\usepackage{luamplib}
@@ -4800,45 +3626,71 @@
\begin{document}
\begin{mplibcode}
\end{texcode}
-\begin{smallcode}
-beginfig(1);
-draw btex \includegraphics[width=5in]{glenshiel.jpg} etex;
-if false:
-for i=1 upto 36:
- draw (origin -- 180 up) shifted (10i, 0)
- withcolor if i mod 10 = 0: red else: 1/2 fi;
-endfor
-for i=1 upto 18:
- draw (origin -- 360 right) shifted (0, 10i)
- withcolor if i mod 10 = 0: red else: 1/2 fi;
-endfor
-fi
-vardef callout@#(expr t, p, o) =
- save T; picture T; T = thelabel.@#(t, p+o);
- draw T; drawarrow p+o -- p cutbefore bbox T;
-enddef;
-ahangle := 20; ahlength := 2;
-drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 blue);
-callout.top("Sgurr na Ciste Dubhe", (80, 96), (-10, 20));
-callout.top("Sgurr nan Spainteach", (100, 91), (6, 12));
-label.top("\tiny Cuillin Ridge, Isle of Skye", (140, 81));
-label.top("Sgurr na Carnach", (190, 90));
-label.top("Sgurr Fhuaran", (282, 94));
-label.bot("\itshape View looking west ...",
- point 5/2 of bbox currentpicture shifted 4 down);
-endfig;
-\end{smallcode}
-\begin{texcode}
-\end{mplibcode}
-\end{document}
-\end{texcode}
+\vskip -\baselineskip
+\smallmpexternal[firstline=8,lastline=24,xleftmargin=0pt,xrightmargin=-10pt]{neo-marked-up-photo.mp}
+\small
+If you uncomment the \mpl{\% input neo-reference-grid} line, so that the
+code on \llap{$\leftarrow$\;}the left is included, you get this automatically-sized grid superimposed:
+$$\includegraphics[width=3in]{neo-marked-up-photo-grid}$$
+The grid makes it easier to find the coordinates for your annotations.
\vss}}
-The two loops commented out with \mpl{if false:} will add a grid
-on top of the photo like this:
-$$\includegraphics[width=200pt]{marked-up-photo-with-grid}$$
-This makes it easier to find the appropriate coordinates for your annotations.
+\medskip\noindent
+\includegraphics[width=\textwidth]{neo-marked-up-photo}
+
+\vfill\noindent
+Here is a general purpose reference grid routine:
+\smallmpexternal[firstline=3,lastline=16,xleftmargin=0pt,xrightmargin=-36pt]{neo-reference-grid.mp}
+
\newpage
+\subsection{Using PDF transparency}\label{sec:transparent}
+
+\textsc{Another limitation} of the plain "mpost" compiler is that it does not
+support any transparent colours. However, if you use the "luamplib" package with
+"lualatex" you get access to the PDF 1.4 transparency functions. Currently (2024) there
+is little documentation for this support and no ‘official’ macro for it, but you can
+add your own like this:
+\begin{code}
+def withalpha expr a =
+ withprescript "tr_alternative=2"
+ withprescript "tr_transparency=" & decimal a
+enddef;
+\end{code}
+and then use it like this, adding \mpl{withalpha} after the
+colour specification:\mpic{-144pt}{new-fangled-transparency}
+\begin{code}
+path r, g, b;
+r = fullcircle scaled 40 shifted 10 up;
+g = r rotated 120; b = g rotated 120;
+
+numeric a; a = 0.5;
+fill r withcolor 1/2[white, red] withalpha a;
+fill g withcolor 1/2[white, green] withalpha a;
+fill b withcolor 1/2[white, blue] withalpha a;
+draw r withcolor 1/2;
+draw g withcolor 1/2;
+draw b withcolor 1/2;
+\end{code}
+
+\smallskip\noindent
+The effect of changing the alpha value is shown on the right. The magic variable
+names "tr_transparency" and "tr_alternative" are only understood by the "luamplib" code,
+plain "mpost" simply ignores them. \textit{Note that since these are not documented anywhere
+except in the source code, they might change in future}.
+You can see from the figure that "tr_transparency"
+controls the alpha value, but the other variable is slightly more mysterious ---
+"tr_alternative" appears to control the PDF blending mode. A value of 1 seems to apply PDF
+‘normal’ mode, which makes colours completely opaque with when alpha is 1; a value
+of 2, as used here, seems to apply PDF ‘multiply’ mode which blends all colours
+evenly, so that the order that you fill overlaps does not matter. This mode works
+well with slightly lighter colours.
+
+\newpage\noindent
+Here is a slightly more ambitious example, using the same \mpl{withalpha}
+macro.\mpic{-12pt}{new-fangled-trilobe}
+\smallmpexternal[firstline=6,lastline=43,xleftmargin=0pt,xrightmargin=-44pt]{new-fangled-trilobe.mp}
+
+\newpage
\section{Working with pictures}
\MP\ inherits the mechanism of \<picture> variables directly from \MF, except that
@@ -4849,7 +3701,7 @@
graphics commands. This section reviews some of the things you can do with a
\<picture> variable — including putting one in a frame (see §\ref{sec:pictureframe})
like so\rlap{\ $\longrightarrow$}
-\mpic{-96pt}{youth}
+\mpic{-96pt}{pics-youth}
\bigskip\noindent
Plain \MP\ provides two built-in \<picture> variables: \mpl{nullpicture}, which is
@@ -4915,8 +3767,8 @@
\end{code}
and \MP\ will add copies of $P$ with the reference points shifted to $(20,0)$,
$(40,0)$, and $(60,0)$. A selection of other transformations is shown on the right $\longrightarrow$
-\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip-240pt\centerline{\includegraphics[width=4in]{twister}}\par
-\centerline{\textsl{\small The reference point for each compass is the small dot in the middle.}}
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize4in\vskip-240pt\centerline{\includegraphics[width=4in]{pics-twister}}\par
+\centerline{\textit{\small The reference point for each compass is the small dot in the middle.}}
\vss}}
\smallskip\noindent
@@ -4960,30 +3812,11 @@
pattern in \<picture> variable with \mpl{image}, apply \mpl{clip} to that, and
then \mpl{draw}. This works nicely if you want to repeat the clipped image.
\vadjust{\moveright 5.5in\vbox to 0pt{\hsize 4.2in \vss
-\noindent\includegraphics[width=4in]{shady-circles}
+\noindent
+\centerline{\includegraphics{pics-shady-circles}}
\medskip
-\begin{smallcode}
-path c, C; numeric r; r = 60;
-c = fullcircle scaled 2r shifted (-r, 0);
-C = fullcircle scaled 4r shifted (2r, 0);
-
-numeric t, u;
-(t, whatever) = C intersectiontimes
- C shifted (center c - center C);
-(u, whatever) = c intersectiontimes (point t of C -- center c);
-
-path s;
-s = subpath (0, u) of c -- subpath (t, 4) of C -- cycle;
-for i=0 upto r:
- draw (left--right) scaled 2r rotated -42 shifted (3i, 0)
- withpen pencircle scaled 1/4 withcolor 2/3 blue;
-endfor
-clip currentpicture to s;
-
-draw c; draw C;
-draw center c -- center C -- point t of C -- cycle;
-\end{smallcode}
+\mpexternal[firstline=6,lastline=27,xleftmargin=0pt]{pics-shady-circles.mp}
\vskip -126pt}}
You can also use this technique to fill with a gradient: just reduce the gap
@@ -5009,7 +3842,7 @@
the \mpl{bbox} is always a rectangle aligned to the edges of your page.
Effectively, the corners are determined \textit{after} any transformation,
and the \mpl{center} is strictly the intersection of the lines between opposite
-corners.\mpic{-68pt}{corners}
+corners.\mpic{-68pt}{pics-corners}
You will notice this if you use the technique given on p.\thinspace29 of the \MP\ manual to draw a
label on a coloured (or erased) background; if you have rotated the label, the
@@ -5049,8 +3882,8 @@
Sometimes it is more convenient to use \mpl{label} to place the pictures, taking
advantage of the automatic alignment provided. Note also that, unless you have
-explicitly filled them with \mpl{white} colour, the blank parts of each picture are
-really transparent so you can overlap them when appropriate.
+explicitly or implicitly filled them with the \mpl{background} colour, the blank
+parts of each picture are really transparent so you can overlap them when appropriate.
\newpage
\subsection{Adding a caption to the current picture}
@@ -5101,7 +3934,7 @@
\moveright5.5in\vbox to 0pt{\hsize 4in \vss
\noindent
Here is an example.
-$$\includegraphics[width=4in]{double-angle}$$
+$$\includegraphics[width=4in]{pics-double-angle}$$
The labels at the bottom were added like this:
\begin{smallcode}
label.bot("$\triangle ACD \sim \triangle ABC$",
@@ -5122,31 +3955,8 @@
$\longrightarrow$
\vadjust{\moveright5.5in\vbox to 0pt{\vskip
-1.5\baselineskip
-\begin{smallcode}
-numeric s; s = 21;
-path alpha;
-alpha = ((-2s, s) {right}
- .. halfcircle rotated -90 scaled 2s shifted (2s, 0)
- .. {left} (-2s, -s)) shifted (s*left);
+\smallmpexternal[firstline=8,lastline=29]{pics-draw-picture.mp}
-vardef overdraw(expr a, b, r, P, shade) =
- linecap := butt;
- undraw subpath (a+r, b-r) of P withpen pencircle scaled 2;
- draw subpath (a, b) of P withcolor shade;
-enddef;
-
-picture cb; cb = image(
- draw alpha withcolor 2/3 red;
- undraw alpha rotated 180 withpen pencircle scaled 2;
- draw alpha rotated 180 withcolor 2/3 blue;
- overdraw(0.21, 0.36, 0.02, alpha, 2/3 red);
- overdraw(0.67, 0.86, 0.02, alpha, 2/3 red);
- overdraw(3.4, 4.3, 0.1, alpha, 2/3 red);
- overdraw(5.4, 5.6, 0.02, alpha, 2/3 red);
- overdraw(5.4, 5.6, 0.02, alpha rotated 180, 2/3 blue);
-);
-\end{smallcode}
-
\vskip 48pt\noindent
\begin{minipage}{4in}
\begin{itemize}
@@ -5156,7 +3966,7 @@
\item Examples 2, 3, and 4 show what happens if you change the pen, or the
colour, or both.
- \item Example 5 shows you how to make a bagel in \MP.
+ \item Example 5 shows you how to make a pretzel in \MP.
\item Example 6 shows you the slightly tricky syntax to extract the paths, pens,
and colours from the \<picture> and adjust them as needed.
@@ -5165,50 +3975,31 @@
\vss}}
With this captured in a \<picture> variable, you can \mpl{draw} it with
different colours and pens to obtain a variety of effects:
-$$\includegraphics[width=\textwidth]{draw-picture.pdf}$$
+$$\includegraphics[width=\textwidth]{pics-draw-picture}$$
The picture is supposed to represent a fancy knot (a “Carrick bend”), and to show
the red and blue strands crossing each other. The \mpl{overdraw} macro tries to do
-this by undrawing with a thick pen, then redrawing the upper strand on top.
+this by using \mpl{undraw} with a thick pen, then drawing the upper strand on top.
\newpage
-\subsection{Simulating transparency}
+\subsection{Simulating transparency with pictures}\label{sec:simulated_alpha}
-Filling with transparent colour can sometimes be a very effective graphic technique, but the
-underlying technical implementation is often dauntingly complex. Plain \MP\
-provides no colour model that directly supports transparency for any output format,
-so if you need it you will have to resort to layering and managing the colour
-blending yourself. This page presents an example of the basic technique, that can
-be adapted to more general purpose macros as required. The technique is included in
-this section, because it involves more manipulation of \<picture> variables.
+Filling with transparent colour can sometimes be a very effective graphic technique,
+but plain \MP\ provides no colour model that directly supports transparency for any
+output format. If you are using "mpost", you will have to resort to layering and
+managing the colour blending yourself. This section presents an example of the
+basic technique, that could be adapted to more general purpose macros as
+required.\\
+\hey \red{But, the technique is quite laborious so you might prefer to switch to "luamplib"
+which provides support for the PDF transparency model, as discussed in
+§\ref{sec:transparent}}.
\vadjust{\moveright5.5in\vbox to 0pt{\vskip -128pt
-$$\includegraphics[width=3in]{fake-transparency}$$
+$$\includegraphics[width=3in]{pics-fake-transparency}$$
+
Omitting the simple grid, this drawing was produced like this:
-\begin{smallcode}
-% Large A
-label.urt("A" infont defaultfont scaled 8, origin) withcolor 1/4 green;
-% An arbitrary shape
-path shape; shape = (superellipse(right, up, left, down, 0.81))
- shifted 1/2 right scaled 30 rotated 30;
-% Parameters
-alpha = 5/8; % alpha: 0=invisible, 1=opaque
-color filler; filler = .95[red,white];
-picture fg, bg;
-bg = currentpicture; % capture the current drawing
-fg = image(
- for e within bg: % redraw everything in blended color
- draw e withcolor alpha[colorpart e, filler];
- endfor % and add some decorations
- draw shape withpen pencircle scaled 2 withcolor 3/4;
- draw subpath (2.718, 3.1415) of shape
- shifted - center shape scaled 7/8 shifted + center shape
- withpen pencircle scaled 2 withcolor white;
-);
-clip fg to shape; % now clip the fg drawing to the shape
-fill shape withcolor filler; % fill the shape
-draw fg; % and put the fg drawing on top
-draw shape withcolor 3/4 blue; % make a nice edge
-\end{smallcode}
+\smallmpexternal[firstline=28,lastline=48]{pics-fake-transparency.mp}
\vss}}%
+
+\smallskip\noindent
The two useful tools in the plain \MP\ kit bag are:
\begin{itemize}
\item The ability to loop through all the elements of a picture
@@ -5239,36 +4030,17 @@
other post-processing on your drawing. The advantage is that you do not have to
work out the size of your drawing before you start.
-\moveright5.5in\vbox to 0pt{\vskip -43pt
-Here is an example that adds graph paper behind
-a drawing.
-$$\includegraphics{graph-paper}$$
-\begin{smallcode}
-input colorbrewer-rgb
-path C; C = fullcircle scaled 120 shifted 12 up rotated 6;
-for t=0,1.2,4: draw center C -- point t of C withcolor Blues 8 8; endfor
-draw C withcolor Reds 8 8; dotlabel.urt("Start", point 0 of C);
+\moveright5.5in\vbox to 0pt{\vskip -96pt\hsize 4.2in
+\noindent\includegraphics{pics-graph-paper-example}
-vardef grid(expr ll, ur, grid_unit) =
- save llx, lly, urx, ury, G; numeric llx, lly, urx, ury;
- (llx, lly) = ll; (urx, ury) = ur;
- picture G; G = image(
- for x = floor(llx / grid_unit) + 1 upto floor(urx / grid_unit):
- draw (x * grid_unit, lly) -- (x * grid_unit, ury);
- endfor
- for y = floor(lly / grid_unit) + 1 upto floor(ury / grid_unit):
- draw (llx, y * grid_unit) -- (urx, y * grid_unit);
- endfor
- fill fullcircle; % <-- show the origin
- ); G enddef;
+\smallmpexternal[firstline=8,lastline=11, xleftmargin=0pt]{pics-graph-paper-example.mp}
+\noindent
+This is "pics-graph-paper-inch.mp":
+\smallmpexternal[xleftmargin=0pt]{pics-graph-paper-inch.mp}
-picture P; P = currentpicture; currentpicture := nullpicture;
-drawoptions(withpen pencircle scaled 1/4);
-draw grid(llcorner P, urcorner P, 1mm) withcolor Blues 8 1;
-draw grid(llcorner P, urcorner P, 10mm) withcolor Blues 8 2;
-drawoptions();
-draw P;
-\end{smallcode}
+\noindent
+And this is "automatic-grid.mp"
+\smallmpexternal[xleftmargin=0pt]{automatic-grid.mp}
\vss}
\smallskip\noindent
@@ -5280,7 +4052,7 @@
\rightarrowfill\break
In general, you draw any background you want, like this:
\begin{smallcode}
-picture P; P = currentpicture; currentpicture := nullpicture;
+picture P; P = currentpicture; clearit;
% do complex background drawing...
clip currentpicture to bbox P; draw P;
\end{smallcode}
@@ -5297,7 +4069,7 @@
If you wanted to apply one of these changes to all the figures in your "mpost" input file then
you can use the hook provided by plain \MP:
\begin{smallcode}
-extra_endfig := "picture P; P = currentpicture;" &
+extra_endfig := "picture P; P = currentpicture; clearit;" &
"fill bbox P withcolor (1,1,31/32); draw P;";
\end{smallcode}
The definition of \mpl{endfig}, includes the line \mpl{scantokens extra_endfig;} so
@@ -5315,51 +4087,29 @@
\textsc{If you wish} to check the dimensions of your drawing, it can be useful to
add a temporary ruler that shows you the dimensions of the bounding box like this:
-$$\includegraphics{icosahedron}$$
+$$\includegraphics{pics-icosahedron}$$
The red rulers were added by putting \mpl{input ruler-cm} at the end of the figure.
-\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize 4in\raggedright\noindent
+\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize 4in\noindent
Here is the implementation of "ruler.mp":
-\begin{code}
-% add a ruler along the left hand and lower edges
-% of the bounding box of the currentpicture
-path B; B = bbox currentpicture;
-for s=0, 1:
- path p; numeric a; pair o;
- p = subpath (0, 1) of if s=0: reverse fi B;
- a = arclength p;
- o = if s=0: left else: down fi;
- for i=0 upto 3:
- exitif not known u[i];
- for j=0 upto floor(a/u[i]):
- pair t; t = point arctime j*u[i] of p of p;
- draw (origin -- (6 - 2i) * o) shifted t;
- if i=0: label(decimal j, t shifted 12 o); fi
- endfor
- endfor
- draw p;
-endfor
-\end{code}
+\mpexternal{ruler.mp}
+\noindent
The inner loop draws successively shorter lines at each of the
minor units, and numbers at the major units.
+
+Note that this macro designed to be used a temporary input added at the
+bottom of a drawing to see how big it is. You would not usually leave it in place
+in a final drawing. This is why none of the variable names is protected.
+To make the macros more robust you could enclose them with \mpl{begingroup} and
+\mpl{endgroup}, and \mpl{save} the names, and clear \mpl{drawoptions}.
\vss}}
They are drawn round the bounding box, set here with the default
margin of 2\unit{bp}.
The "ruler-cm.mp" file looks like this:
-\begin{code}
-numeric u[]; u0 = 1 cm; u1 = 1 mm;
-drawoptions(withcolor 0.54 red);
-input ruler
-drawoptions();
-\end{code}
-and there is a companion "ruler-inch.mp" file that looks like this:
-\begin{code}
-numeric u[]; u0 = 1 in; u1 = 1/4 in; u2 = 1/12 in;
-drawoptions(withcolor 3/4 blue);
-input ruler
-drawoptions();
-\end{code}
-The idea is that you set a subscripted variable \mpl{u[]} to a number of unit sizes
-where you want markers and then call \mpl{input ruler}.
+\mpexternal{ruler-cm.mp}
+\noindent and there is a companion "ruler-inch.mp" file that looks like this:
+\mpexternal{ruler-inch.mp}
+\noindent The idea is that you set a subscripted variable \mpl{u[]} to a number of unit sizes
+where you want markers and then call \mpl{input ruler}.
\newpage
@@ -5369,259 +4119,552 @@
you might want to add emphasis or pick out part of a drawing. The examples here can
be applied to \mpl{currentpicture} or any other \<picture>
variable.\vadjust{\moveright 396pt\vbox to 0pt{\hsize 4in\vskip -42pt
-$$\includegraphics{border.pdf}$$
-\begin{smallcode}
-% don't take this one too seriously...
-vardef rope expr c =
-save hemp, s, w, n, A, a, b;
-color hemp; hemp = 1/256 (224, 202, 169);
-numeric s, w, n, A;
-A = arclength c; s = A/floor(A/2); w = -1; n = -1;
-path a[]; for t=0 step s until A + 1: a[incr n] =
- (0,+w) rotated angle direction arctime t-3/2s of c of c
- shifted point arctime t-3/2s of c of c
-.. (0,+w) rotated angle direction arctime t-1/2s of c of c
- shifted point arctime t-1/2s of c of c
-.. (0,-w) rotated angle direction arctime t+1/2s of c of c
- shifted point arctime t+1/2s of c of c
-.. (0,-w) rotated angle direction arctime t+3/2s of c of c
- shifted point arctime t+3/2s of c of c;
-endfor
-image(for i=1 upto n:
- path b; b = buildcycle(a[i-1], reverse a[i]);
- fill b withcolor hemp;
- draw b withpen pencircle scaled 1/8;
-endfor) enddef;
-interim bboxmargin := 16;
-draw rope rounded_corners bbox currentpicture;
-\end{smallcode}\vss}}
+$$\includegraphics{pics-border-rope}$$
+Don't take this one too seriously\dots
+\smallmpexternal[xleftmargin=0pt]{rope.mp}
+\smallmpexternal[xleftmargin=0pt,firstline=9,lastline=10]{pics-border-rope.mp}
+\vss}}
-$$\vbox{\halign{$\vcenter{\hbox{\includegraphics[width=150bp]{#}}}$&\quad$\vcenter{\hbox{#}}$\cr
-border-shadow&
-\begin{smallcode}
-picture P; P = currentpicture;
-fill bbox P shifted (3,-3) withcolor 3/4;
-unfill bbox P; draw bbox P;
-draw P;
-\end{smallcode}\cr
-border-dashed&
-\begin{smallcode}
-vardef rounded_corners expr p =
- for i=1 upto length p:
- subpath (i-15/16, i-1/16) of p ..
- endfor cycle
-enddef;
+\bigskip
-interim bboxmargin := 16;
-draw rounded_corners bbox currentpicture
- dashed evenly scaled 3/4;
-\end{smallcode}\cr
-}}$$
+\noindent\includegraphics[width=.95\textwidth]{pics-border-shadow}
+\bigskip
+
+\noindent\includegraphics[width=\textwidth]{pics-border-dashed}
+
\newpage
\subsection{Adding a frame}\label{sec:pictureframe}
As promised at the start of this section, here is the code for the picture
frame drawn round Raphael's young man.
-\begin{code}
-input picture_frame
-beginfig(1);
- picture F;
- F = thelabel(TEX("\includegraphics{youth.jpg}"), origin);
- draw F; draw frame bbox F;
-endfig;
-\end{code}
+\smallmpexternal[firstline=6,lastline=11]{pics-youth.mp}
+\noindent
All the heavy lifting is done by "frame" macro defined in
"picture_frame.mp" $\longrightarrow$
-\vadjust{\moveright5.2in\vbox to 0pt{\hsize 4in\vskip-184pt
-\begin{smallcode}
-vardef frame expr P =
- save base, side, f, t, u, xx;
- picture base, side; path f; numeric t, u, xx;
- % work out some measurements
- t = arclength subpath (0,1) of P;
- u = arclength subpath (1,2) of P;
- xx = max(t, u) + 2 pf_wd;
- f = unitsquare xscaled xx yscaled pf_wd;
- % convenience / nonce function
- vardef paint_strip(expr y, wd, shade) =
- draw subpath (0, 1) of f
- shifted (0, if y < 0: pf_wd + fi y)
- withpen pencircle scaled wd
- withcolor shade
- enddef;
- base = image(
- % background colour
- fill f withcolor gold;
- % grey strips
- paint_strip(2, 3, 5/4 grey);
- paint_strip(3.5, 1/4, grey);
- paint_strip(5, 1/4, 1/2[gold, dark]);
- paint_strip(-6.5, 1/4, 1/2[gold, dark]);
- paint_strip(-6, 1/4, 1/2[gold, dark]);
- paint_strip(-2, 2, 5/4 grey);
- % spatter with random spots
- for i=0 upto 4 * arclength(subpath (0,1) of f):
- fill fullcircle scaled uniformdeviate 3/4
- shifted (uniformdeviate xx, uniformdeviate pf_wd)
- withcolor dark;
- endfor
- % decorative balls
- for x = 2 step 3 until xx:
- draw ball shifted (x, 2);
- endfor
- );
- % make two trapezium shapes
- side = base;
- clip side to (pf_wd, 0) -- (pf_wd + u, 0)
- -- (2 pf_wd + u, pf_wd) -- (0, pf_wd) -- cycle;
- clip base to (pf_wd, 0) -- (pf_wd + t, 0)
- -- (2 pf_wd + t, pf_wd) -- (0, pf_wd) -- cycle;
- % arrange the pieces around path P
- image(
- draw base rotated 180 shifted point 1 of P shifted (+pf_wd, 0);
- draw base rotated 0 shifted point 3 of P shifted (-pf_wd, 0);
- draw side rotated 90 shifted point 0 of P shifted (0, -pf_wd);
- draw side rotated 270 shifted point 2 of P shifted (0, +pf_wd);
- )
-enddef;
-\end{smallcode}
+\vadjust{\moveright5in\vbox to 0pt{\hsize 4.2in\vskip-164pt
+\smallmpexternal[firstline=18,lastline=64,xrightmargin=-40pt]{picture_frame.mp}
\vss}}
\noindent This macro also needs some colours:
+\smallmpexternal[firstline=4,lastline=7]{picture_frame.mp}
+\noindent a picture of a small silvery-gold ball:
+\smallmpexternal[firstline=9,lastline=14]{picture_frame.mp}
+\noindent and an internal variable that defines the width of the frame:
+\smallmpexternal[firstline=16,lastline=16]{picture_frame.mp}
+\noindent The macro takes a path or picture $P$ as an argument, and makes a thin rectangle $f$
+that is scaled to the desired width and the longer of the two sides of the bounding
+box. This thin rectangle is then decorated with background colour, strips of colour
+to suggest depth, a random spatter-pattern, and a row of little balls. The macro
+then makes two trapezium shaped copies of the decorated rectangle, pieces them
+together around $P$, and returns the result as a \<picture>.
+
+\newpage
+\section{Drawing and decorating lines}
+
+\textsc{This section} is all about making marks along a \<path> using
+\mpl{draw} and a number of other more sophisticated techniques.
+
+\subsection{Choosing a pen}
+
+\MP\ inherits a rather complicated system of pens from \MF. As explained in \mfbook,
+the original intention of this system was to improve the digitisation of font
+characters so that low-resolution raster versions would look aesthetically pleasing.
+This is not really a problem for graphics that you might produce with \MP, and so
+for most purposes you can stick to the default circular pen, and not worry about
+using \mpl{pensquare}, \mpl{penrazor}, and \mpl{penspeck}, nor creating your own
+\<pen> variables. On the other hand, you probably will need to change the size and
+shape of the pen occasionally, and it is good to understand the mechanisms
+available.
+
+The default, built-in, pen is \mpl{pencircle} -- at the start of every job
+this pen is scaled to $0.5\unit{bp}$ and saved as \mpl{currentpen} and
+\mpl{defaultpen}. Every time you use \mpl{draw}, \MP\ automatically adds
+\mpl{withpen currentpen} unless you have added your own \mpl{withpen}.
+\begin{code}[xrightmargin=-42pt]
+draw origin -- 20 right; % uses "currentpen"
+draw (0,10) -- (20,10) withpen pencircle scaled 2; % thick pen
+\end{code}
+If you get tired of typing \mpl{withpen},
+you can change pens with the \mpl{pickup} macro; essentially this just updates the value of
+\mpl{currentpen}.\vadjust{\moveright 4in\vbox to 0pt{\bigskip
+\begin{mplibcode}
+draw origin -- 42 right; % uses "currentpen"
+pickup pencircle scaled 2; % use a thick pen
+draw (0,-24) -- (42,-24);
+draw (0,-36) -- (42,-36);
+pickup defaultpen; % change back to default
+\end{mplibcode}\vss}}
+\begin{code}
+draw origin -- 42 right; % uses "currentpen"
+pickup pencircle scaled 2; % use a thick pen
+draw (0,-24) -- (42,-24);
+draw (0,-36) -- (42,-36);
+pickup defaultpen; % change back to default
+\end{code}
+If you are using a fat pen and you don't like the big rounded ends, then
+you can use \mpl{cutdraw} or set \mpl{linecap := butt;} — see
+§\ref{sec:linecaps} for more.
+\vadjust{\moveright5.5in\vbox to 0pt{\vss\hsize 4.4in\noindent
+Here is an example that makes use of a circular pen transformed to a thin ellipse.
+\begin{texcode}
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\newcommand\fleuron{\begin{mplibcode}
+\end{texcode}
+\vskip-\baselineskip
\begin{smallcode}
-color gold, dark, grey;
-gold = 1/256(243, 197, 127);
-dark = 1/256(144, 87, 50);
-grey = 1/256(156, 147, 138);
+beginfig(1);
+ -z1 = z4 = 7 dir 8;
+ y2 - y1 = y4 - y3 = 3(y4 - y1);
+ z2 - z1 = z4 - z3 = whatever * dir 50;
+ draw z1 .. controls z2 and z3 .. z4
+ withpen pencircle xscaled 1.2 yscaled 0.2 rotated 50;
+ currentpicture := currentpicture rotated - angle z4;
+endfig;
\end{smallcode}
-a picture of a small silvery-gold ball:
+\vskip-\baselineskip
+\begin{texcode}
+\end{mplibcode}}
+\begin{document}
+Here is a \fleuron\ mark.
+\end{document}
+\end{texcode}
+This example shows how to use an elliptical pen to draw a little twiddle mark
+— and incidentally how to define a La\TeX\ command that draws a \MP\
+figure — that comes out looking like this: \fleuron. The idea is that you could use
+it as a decoration.
+
+\medskip
+\centerline{\fleuron\quad \textit{A typographical ornament} \quad\fleuron}
+\medskip
+
+\noindent
+With a little work, you could also use it as a fancy rule between
+sections.
+$$\includegraphics{pens-fleuron}$$
+The important parts are that \mpl{pencircle} is scaled to be wider than it is tall,
+and then rotated so that it is at the correct angle at the start and at the end of
+the path. Think of it as a calligraphic nib. For another example, look at
+§\ref{sec:braces}, which uses a similar pen to draw the braces for the dimension
+label.}}
+
+
+\newpage
+\subsection{Multiple lines}
+
+\textsc{The pens available} in \MP\ are all simple convex polygons without holes, so
+if you want to draw double or triple lines, you have to draw the individual parts of
+the marks you want along the path.
+
+The simplest approach is to draw the path with a thicker pen, then draw over it with
+a thinner pen using the background colour, like this:
+\begin{code}
+path a; a = origin -- (48, 3) -- (96, -3) -- 144 right;
+draw a withpen pencircle scaled 3/2;
+draw a withpen pencircle scaled 1/2 withcolor background;
+\end{code}
+which produces this:
+\begin{mplibcode}
+path a; a = origin -- (48, 3) -- (96, -3) -- 144 right;
+draw a withpen pencircle scaled 3/2;
+draw a withpen pencircle scaled 1/2 withcolor background;
+\end{mplibcode}\enspace
+Notice that the lines have been drawn with the default rounded ends. If you don't
+want this then use \mpl{cutdraw} for the background lines (or set \mpl{linecap :=
+butt}), so that you get ends that look open, like this:
+\begin{mplibcode}
+path a; a = origin -- (48, 3) -- (96, -3) -- 144 right;
+cutdraw a withpen pencircle scaled 3/2;
+draw a withpen pencircle scaled 1/2 withcolor background;
+\end{mplibcode}\enspace
+For triple lines, you will need to draw three times: first broad, then medium with
+the background colour, then thin in the middle; and so on.
+
+Beware that you will need to be careful if the line needs to have an arrowhead or to
+touch another object. Beware also that drawing with the background colour does not
+erase anything, it just draws over the path with an opaque line that happens to be
+the same colour as the background, so you will not see
+anything that happens to lie under the line even if you want to.
+
+If you want to draw real separate parallel lines, then the simplest approach is just to shift
+the path sideways using something like this:
\begin{smallcode}
-picture ball; ball = image(for i=0 upto 16:
- fill interpath(i/16,
- fullcircle scaled 10,
- fullcircle scaled 3 shifted (-2, 2)
- ) withcolor (i/16)[gold, 15/16 white];
-endfor) scaled 1/4;
+path p; p = origin -- 100 dir 30; draw p;
+draw p shifted 4 unitvector(direction 1/2 of p rotated 90);
\end{smallcode}
-and an internal variable that defines the width of the frame:
+If your path is a regular cycle, like a circle or a polygon, then another approach
+is to draw a scaled copy.
+\begin{smallcode}[xrightmargin=-20pt]
+path p; p = fullcircle scaled 100 shifted 42(normaldeviate, normaldeviate);
+draw p; draw p shifted -center p scaled 0.98 shifted center p;
+\end{smallcode}
+but if your path is more complex, then you need something like the macro
+shown at the right. The piano-shaped path $p$ is drawn in black; the outer blue path
+was drawn with \mpl{draw beside(p, 2)} and the red one with
+\mpl{draw beside(p, -2)}.
+
+\moveright5.5in\vbox to 0pt{\vss\hsize 4.4in\noindent
+\smallmpexternal[firstline=8,lastline=32,xleftmargin=0pt]{pens-besides.mp}
+\noindent\includegraphics[width=4in]{pens-besides}
+\vskip -60pt
+}
+
+\newpage
+\subsubsection*{Making tubes}
+
+Drawing with multiple lines can also produce a three-dimensional effect for
+knot diagrams (provided that you don't think of toothpaste).
+$$
+\begin{mplibcode}
+path a; a = origin .. (72, 10) .. (144, -10) .. (216, 0);
+for i=4 step -1/8 until 1/2:
+ draw a withpen pencircle scaled i withcolor (i*i/16)[white, 1/2 blue];
+endfor
+\end{mplibcode}
+$$
+This tube-like effect can be created with a loop like this:
\begin{smallcode}
-newinternal pf_wd; pf_wd := 21;
+path a; a = origin .. (72, 10) .. (144, -10) .. (216, 0);
+for i=4 step -1/8 until 1/2:
+ draw a withpen pencircle scaled i withcolor (i*i/16)[white, 1/2 blue];
+endfor
\end{smallcode}
-The macro takes a rectangular path $P$ as an argument, and
-makes a thin rectangle $f$ that is scaled to the desired width and
-the longer of the two sides of the path. This thin rectangle is then
-decorated with background colour, strips of colour to suggest depth, a random
-spatter-pattern, and a row of little balls. The macro then makes two trapezium
-shaped copies of the decorated rectangle, pieces them together around $P$, and returns the result as a
-\<picture>.
+The idea is to
+draw a path repeatedly with lines that get thinner and use a lighter shade
+Notice the colour fades from white to dark blue using the mediation syntax.
+You might like to experiment with linear or quadratic transitions until you get a
+gradient that you like. In the loop above as $i$ varies from 4 down to $\frac12$,
+the mediation fraction varies from 1 down to $\frac1{64}$, like this:
+$$\vbox{\halign{\hss #:\quad&&\hss #\hss\cr
+$i$ & 4.00 & 3.75 & 3.50 & 3.25 & 3.00 & 2.75 & 2.50 & 2.25 & 2.00 & 1.75 & 1.50 & 1.25 & 1.00 & 0.75 & 0.50 \cr
+$i^2/16$ & 1.00 & 0.88 & 0.77 & 0.66 & 0.56 & 0.47 & 0.39 & 0.32 & 0.25 & 0.19 & 0.14 & 0.10 & 0.06 & 0.04 & 0.02 \cr
+}}$$
+which makes the gradient steeper nearer the edges.
+If you don't want the rounded ends, then you should use \mpl{cutdraw} instead of
+\mpl{draw}.
+\subsection{Showing crossings}
+
+In general it is a good idea to avoid line crossings completely, but
+occasionally you may end up with a diagram where at least one line
+has to cross another. The simple way to deal with this is to use the technique
+shown in §\ref{sec:cd}; capture the line to be drawn in a \<path>
+variable, and then do
+\begin{smallcode}
+cutdraw line withpen pencircle scaled 4 withcolor background; draw line;
+\end{smallcode}
+so that you erase behind the line before you draw it. Alternatively you could use
+the ideas in §\ref{sec:allxp} to find all the intersections between two paths
+and mark them appropriately. But the marks might not improve legibility; compare
+these two \rlap{$\longrightarrow$}\mpic{-6in}{pens-crossings}
+
+
\newpage
-\section{Annotations}
+\subsection{Using dash patterns with extra precision}
-\textsc{In some awkward corners}, you may find that you just can't get your label in
-the right place with \mpl{dotlabel} even if you adjust \mpl{labeloffset}. In these
-cases there are two simple techniques you can use. First, you could separate
-drawing the dot from placing the label; given a point $P$ you can try:\mpic{0pt}{callout}
+\textsc{As you may know}, plain \MP\ provides two
+built-in dash patterns, so that you can draw a path \mpl{dashed withdots} or
+\mpl{dashed evenly}.
+\vadjust{%
+\moveright384pt\vbox to 0pt{\vskip-46pt\hsize 4.2in\small
+$$
+\begin{mplibcode}
+vardef exactly(expr a) =
+ save m; numeric m; 2m = (a-6) / round(a/6);
+ dashpattern(on m off m)
+enddef;
+vardef gooddots(expr a) =
+ save m; numeric m; 2m = (a-5) / round(a/5);
+ dashpattern(off m on 0 off m)
+enddef;
+ for i=2 upto 8:
+ path c[];
+ c1 = fullcircle scaled 16i shifted 80 left;
+ c2 = fullcircle scaled 16i shifted 80 right;
+ draw c1 dashed evenly withcolor 2/3 blue;
+ draw c2 dashed exactly(arclength c2) withcolor 1/2 red;
+ %draw c1 shifted 160 down dashed withdots withcolor 2/3 blue;
+ %draw c2 shifted 160 down dashed gooddots(arclength c2) withcolor 1/2 red;
+ endfor
+\end{mplibcode}
+$$
+
+\noindent
+The blue circles on the left were drawn with \mpl{dashed evenly}, and the uneven
+gaps are noticeable at the “three o’clock” positions where the paths begin and end.
+As you can see the default dash spacing looks fine at some sizes but bad on others.
+On the right you can see the same circular paths coloured red, and drawn with
+\mpl{dashed exactly(arclength c, 6)}.
+
+$$
+\begin{mplibcode}
+vardef exactly(expr a, u) =
+ save m; numeric m; 2m = a / round(a/u);
+ dashpattern(on m off m)
+enddef;
+ for i=2 upto 8:
+ path c[];
+ c1 = unitsquare shifted -(1/2, 1/2) scaled 16i shifted 80 left;
+ c2 = unitsquare shifted -(1/2, 1/2) scaled 16i shifted 80 right;
+ draw c1 dashed evenly withcolor 2/3 blue;
+ draw c2 dashed (exactly(arclength c2, 8) shifted 6 right) withcolor 1/2 red;
+ endfor
+\end{mplibcode}
+$$
+Other paths may require a bit more ingenuity and thought. Because the square paths
+have four equal sides, they work better with a target dash length that is a multiple
+of 4. Here the blue squares on the left use the default \mpl{dashed evenly}, and the
+red squares on the right were done with:
\begin{code}
-drawdot P withpen pencircle scaled dotlabeldiam;
-label("$P$", P shifted 10 dir 68);
+dashed (exactly(arclength s, 8) shifted 6 right)
\end{code}
-Using \mpl{dotlabeldiam} ensures that your dots match any others done with
-\mpl{dotlabel}.
-Secondly, if that's not enough, use a temporary pair to create a call out line:
+The right shift made the corners look better.
+\vss}}
+
+The keyword \mpl{dashed} gives you access to the PostScript "setdash" command, whose
+argument is a special \<picture> defined with the \MP\ \mpl{dashpattern} function.
+If you look in "plain.mp" you will find these declarations:
\begin{code}
-z0 = P + 20 dir -20;
-draw z0 -- P
- cutafter fullcircle scaled 8 shifted P
- withpen pencircle scaled 1/4;
-label.rt("\textit{pole}", z0);
+picture evenly,withdots;
+evenly = dashpattern(on 3 off 3); % dashed evenly
+withdots = dashpattern(off 2.5 on 0 off 2.5); % dashed withdots
\end{code}
-If you want to do this sort of thing often, then it might be worth making a macro.
-It is hard to write anything completely general, but see §\ref{sec:extimage} for an
-example.
+The detailed syntax is explained in §9.4 of the \MP\ manual, but essentially
+\mpl{withdots} creates a unit 5 points long with a dot in the middle, and
+\mpl{evenly} creates a unit 6 points long with the dashes 3pt long (plus the round
+bit at the end of each dash, unless you have changed \mpl{linecap}) and gaps 3pt
+long (minus any round bits).
-\medskip\noindent
-\textsc{You might also want} to mark a straight line between two points.
-\vadjust{\moveright5.3in\vbox to 0pt{\hsize 4.2in
-\begin{smallcode}
-vardef do_brace(expr a,b,m,r) =
- save d, e, n, bb; numeric d, n; pair e; path bb;
- n = 1/2 m; d = angle (b-a);
- e = up scaled m rotated d shifted r[a,b];
- bb = ((origin {0,n} .. {right} (abs n,n))
- rotated d shifted a --
- ((-abs n,-n){right} .. {0,n} origin {0,-n} .. {right}(abs n,-n))
- rotated d shifted e --
- ((-abs n,n){right} .. {0,-n} origin)
- rotated d shifted b
- ) shifted (up scaled n rotated d);
- draw bb withpen pencircle yscaled .6 xscaled .1666 rotated d;
- point 3 of bb
+You might be tempted to get creative with this and make complex dot-dot-dash patterns,
+but they rarely look very good and they may puzzle your readers. Scaling the two
+default patterns is probably all you ever need; so if you want a denser dotted line
+try \mpl{dashed withdots scaled 1/2},
+or to get very long dashes you could use
+\mpl{dashed evenly scaled 4}.
+
+But you may also notice that the dash patterns (particularly the longer ones) do not
+always fit your paths exactly -- this is especially noticeable with closed paths,
+where you may end up with one unsightly long dash or a very short gap at the point
+where the path begins and ends.
+
+There is a simple solution: adjust the length of the dash pattern
+so that an integer number of dash units exactly fit your path.
+\begin{code}
+vardef exactly(expr a, u) =
+ save m; numeric m; 2m = (a-u) / round(a/u);
+ dashpattern(on m off m)
enddef;
+\end{code}
+Here $a$ is supposed to be the \mpl{arclength} of your path, and $u$ the desired
+unit size, so you can use it like this:
+\begin{code}
+path c; c = fullcircle scaled 200;
+draw c dashed exactly(arclength c, 6);
+\end{code}
+to get a close approximation to \mpl{dashed evenly} that exactly fits the path.
-label.lrt("Here",do_brace(z1, z2, -12, 3/4));
-\end{smallcode}
-Note that, as well as drawing the braces, the macro uses the grouping provided by \mpl{vardef} to return the
-mid point so that you can put a label next to it.
-\vss}}
-The simplest way to do this is just to use \mpl{drawdblarrow} on a copy of your straight
-path shifted to one side, like so:
+\newpage
+\subsection{Decorating a path}
+
+\textsc{A little decoration} generally goes a long way, so you may want to restrain
+your creativity before you apply too many of the ideas from this page. There are
+two basic techniques shown here: creative use of dash patterns; and drawing shapes
+along the path.\mpic{-48pt}{pens-strokes}
+
+\smallskip\noindent
+With a curved path $S$, the first “with a dash pattern” was drawn like this:
+\smallmpexternal[firstline=21,lastline=21,xleftmargin=0pt]{pens-strokes.mp}
+\noindent
+Notice that the default rounded pen makes dots and dashes with rounded ends.
+The second line “with a sharp dash pattern” uses \mpl{cutdraw} to change the line
+ends.
+\smallmpexternal[firstline=26,lastline=26,xleftmargin=0pt]{pens-strokes.mp}
+\noindent
+The “railway line” uses a combination of three drawing operations:
+\smallmpexternal[firstline=31,lastline=33,xleftmargin=0pt,xrightmargin=-30pt]{pens-strokes.mp}
+
+\smallskip\noindent
+The “plainer railway line” was done like this:
+\smallmpexternal[firstline=40,lastline=44,xleftmargin=0pt]{pens-strokes.mp}
+\noindent
+Note that it's essential to use \mpl{arctime} and \mpl{arclength} in order to get
+the markers evenly spaced. But you don't need to worry about the rotation in order
+to get the “fading away” effect:
+\smallmpexternal[firstline=49,lastline=52,xleftmargin=0pt]{pens-strokes.mp}
+\noindent
+The remaining three are just fancy variations on the same theme. You might
+like to try to re-create them as an exercise, or you can look in the source file.
+
+\newpage
+\subsection{Morphing a path}
+
+A more flexible, but more complicated, decoration technique is to use a macro
+to morph your path before you actually draw it. This is how the venerable "feynmp"
+package marks photons and gluons etc in Feynman diagrams. Since "feynmp" is a
+standard part of the base \MP\ distribution you can use these macros in normal
+drawings; so to draw a zigzag line you can do:
\begin{code}
-drawdblarrow (z1--z2) shifted (12 up rotated angle (z2-z1));
+input feynmp
+path S; S = (left {dir 30} .. right {dir 30}) scaled 100;
+draw zigzag S;
\end{code}
-If you combine this with temporarily setting \mpl{ahangle:=180}, you get the simple
-dimension line shown in blue.
-$$\includegraphics{braces}$$
-The red braces are a more complex variation on this theme $\longrightarrow$
+The package also provides "curly", and "wiggly", as shown at the
+right\mwpic{-100pt}{pens-feynmp-styles}, and defines a number of parameters
+to control the sizes of the shapes:
+\begin{itemize}[itemsep=0pt]
+ \item "curly_len" sets the wave length of the loops, default 8.5
+ \item "wiggly_len" ditto for waves, default 11.34
+ \item "zigzag_len" ditto for zigs, default 5.67
+ \item "wiggly_slope" steepness of waves, default 60°
+ \item "zigzag_width", amplitude of zigs, default 4
+\end{itemize}
+\noindent
+You might like to try your hand at defining your own. Here is one that does
+a vaguely hellenic meander pattern, adapted to cope with curved
+paths.\mwpic{80pt}{pens-greek-meander}
+\smallmpexternal[firstline=6,lastline=21,xrightmargin=-42pt]{pens-greek-meander.mp}
+
\newpage
-\section{Line caps and line joins}
+\subsection{Arrow styles}
+Plain \MP\ provides just two commands for drawing arrows: \mpl{drawarrow} and
+\mpl{drawdblarrow}. The default arrows are shown at
+\sep{"1"}\mwpic{-48pt}{pens-arrow-styles} in the drawing on the
+right.\rlap{$\rightarrow$}
+
+There are two parameters that you can set to control the shape. The length of the
+arrow head is defined by \mpl{ahlength} which is set to 4pt, and the angle is
+defined by \mpl{ahangle} which starts at 45°. In some diagrams your arrows may look
+more elegant if they are a bit longer and slightly sharper. The arrows shown at
+\sep{"2"} were created by setting \mpl{ahangle := 20;} and \mpl{ahlength := 6;}
+(note that you need to use the assignment operator to update them).
+
+\bigskip
+
+If your diagram needs a wider range of arrow head styles, perhaps because you are
+drawing UML, then you can use the "mparrows" package from CTAN. If
+you have a complete \TeX\ distribution installed, you can just put \mpl{input
+mparrows} near the top of your program, and then use the "setarrows" macro
+to change the arrow style.
+In the drawing on the right
+\begin{itemize}
+ \item \sep{"mp1"} shows the result of \mpl{setarrows(open)},
+ \item \sep{"mp2"} shows \mpl{setarrows(defaultunfilled)}, and
+ \item \sep{"mp3"} shows \mpl{setarrows(barbed)}.
+\end{itemize}
+
+\noindent
+The package uses the same length and angle parameters as the default arrows. It also
+provides an extra parameter called "barbedarrowindent" to control the shape of the
+barbed arrows. For full details try: "texdoc mparrows"
+
+\bigskip
+
+If you would rather have arrows in your drawings that match the various arrows
+provided by the Computer Modern font, then you can use the "cmarrows" package from CTAN. You can
+include this package by adding \mpl{input cmarrows} near the top of your program.
+It is slightly more complicated to control, but the details are explained in the
+manual. At \sep{"cm1"} you can see the result of
+\begin{smallcode}[xrightmargin=-40pt]
+setup_cmarrows(macro_name="drawarrow"; arrow_name="texarrow"; ... );
+setup_cmarrows(macro_name="drawdblarrow"; arrow_name="twowayarrow"; ...);
+\end{smallcode}
+Here I have chosen to override the built-in command, but you can assign a
+different macro name if you prefer. The arrow names used at \sep{"cm2"} were
+"lefthalfarrow" and "paralleloppositelefthalfarrows".
+
+\newpage
+\subsection{Line caps and line joins}\label{sec:linecaps}
+
The PostScript language defines parameters that affect how the ends of each line are
drawn and how lines are joined together. Plain \MP\ provides access to these
-parameters through internal variables called "linecap" and "linejoin"; it sets both
-of them to the value "rounded" at the start of each job.
-\mpic{0pt}{line-caps-and-joins}
+parameters through internal variables called \mpl{linecap} and \mpl{linejoin}; it
+sets both of them to the value \mpl{rounded} at the start of each job.
+\mwpic{-20pt}{pens-line-caps-and-joins}
-The figure on the right shows the affect of the different settings, using an
+The figure on the right shows the effect of the different settings, using an
exaggerated line width of 2 points (instead of the usual 0.5 points). Some
observations
to note:
\begin{itemize}
- \item When $\id{linecap}=\id{squared}$ then \kw{drawdot} produces diamond-shaped
+ \item When \mpl{linecap = squared} then \mpl{drawdot} makes diamond-shaped
dots, even when you are drawing with the default circular pen.
- \item When $\id{linecap}=\id{butt}$ then \kw{drawdot} produces invisible dots.
+ \item When \mpl{linecap = butt} then \mpl{drawdot} produces invisible dots.
They still count towards the bounding box of the picture but there's no mark
on the page.
- \item When $\id{linecap}=\id{squared}$ then \kw{drawarrow} produces some
- unpleasant results; even when $\id{linejoin}=\id{mitered}$, you can still
+ \item When \mpl{linecap = squared} then \mpl{drawarrow} produces some
+ unpleasant results; even when \mpl{linejoin = mitered}, you can still
see small jaggies on the slopes of the arrows.
\item The arrows are nice and sharp when
- $\id{linejoin}=\id{mitered}$, but they over shoot the mark slightly.
+ \mpl{linejoin = mitered}, but they over shoot the mark slightly.
- \item If you zoom in, you can see the effect of $\id{linejoin}$ on the corners of the grey box
- as well as on the arrow heads, but you might not notice the difference when
- the picture is printed unless you have a very high resolution printer.
+ \item If you zoom in, you can see the effect of \mpl{linejoin} on the corners in
+ the centre as well as on the arrow heads, but you might not notice the
+ difference when the picture is printed unless you have a very high
+ resolution printer.
\item
This drawing was done with \mpl{pencircle scaled 2}, so that the dots
would be easy to see. This does make the arrows drawn with the
default line modes (rounded caps and rounded joins) looks a bit fat;
- they look better with the usual \mpl{pencircle scaled .5}.
+ they look better with the usual \mpl{pencircle scaled .5}, Like this:
+ \begin{mplibcode}drawdblarrow (left--right) scaled 20;\end{mplibcode}
\end{itemize}
-There is one more PostScript parameter affecting line joins. \MP\ makes it available as "miterlimit"
-and it affects how much a mitered join is allowed to stick out at each corner. Plain \MP\ sets
-"miterlimit=10;" which is correct for nearly all drawings. If you set
-"miterlimit:=0;" then the mitered line join mode becomes more or less the same as the
-beveled mode.
+There is one more PostScript parameter affecting line joins. \MP\ makes it available
+as \mpl{miterlimit} and it affects how much a mitered join is allowed to stick out
+at each corner. Plain \MP\ sets \mpl{miterlimit = 10;} which works well for most
+drawings. If you set \mpl{miterlimit := 0;} then the mitered line join mode becomes
+more or less the same as the beveled mode.
\newpage
+\subsection{Line caps and line joins with square pens}
+
+\textsc{The parameters explained} in the previous section were designed (or at least
+named) for use with the default pen \mpl{pencircle}.\mwpic{-60pt}{pens-pen-oddity}
+You will get some rather odd shapes if you use them with any other pen, such as
+\mpl{pensquare}, especially if you use a large pen. In the drawings on the right,
+the thin red lines are drawn with each pen scaled to $0.5\unit{bp}$ (the default
+size), and
+the large grey and blue areas show what would be draw with the same pens scaled to
+16\unit{bp}, so that you can see the artefacts more clearly.
+From these drawings you can see:
+\begin{itemize}
+ \item The default setting \mpl{linecap := rounded} actually seems to mean “draw
+ a dot with the current pen at each end of the path”, so with
+ \mpl{pensquare} you get a square dot on the end and it's not rounded at all.
+
+ \item With \mpl{linecap := butt}, \MP\ appears to draw the terminal dots using
+ half of the current pen. With the square pen, this has the unfortunate
+ effect of cutting the pen at 45°, so that the end of the lines appear
+ bevelled rather than squared off. Notice also that the cut is correctly
+ rotated with the circular pen, but remains at 45° with the square pen.
+
+ \item You get a similar effect with \mpl{linecap := squared}. \MP\ uses the
+ same cut “across” the pen, but pushes it out so that it just touches the
+ far edge of the pen-sized dot that would be drawn with \mpl{linecap := rounded}.
+
+\end{itemize}
+
+You can also see from the drawings that the effect of the \mpl{linejoin} setting, which is
+admittedly pretty subtle with a circular pen, is null with the square pen. And
+that the single point dots disappear unless you have \mpl{linecap := rounded}.
+
+\bigskip
+\noindent
+If you need to use a large square pen, then you can mitigate some of the artefacts
+if you rotate the pen by 45°. Using \mpl{pensquare rotated 45} corrects most of the
+faults, except that \mpl{linecap := rounded} will give you lines with pointed ends,
+and that the squared off ends of the lines with the other settings may not be
+exactly orthogonal to the direction of the path at each end.
+
+\newpage
\section{Plotting functions}\label{func}
\textsc{A selection} of graphs of mathematical functions is presented in this
@@ -5634,163 +4677,48 @@
\subsection{Making axes}
-You can start by drawing a simple set of axes.\mpic{-124pt}{plain-axes}
-\begin{smallcode}
-path xx, yy;
-xx = (left -- right) scaled 130;
-yy = (down -- up) scaled 80;
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-\end{smallcode}
+You can start by drawing a simple set of axes.\mpic{-124pt}{func-plain-axes}
+\smallmpexternal[firstline=6,lastline=10]{func-plain-axes.mp}
+\noindent
Here the axes are scaled arbitrarily to 130\,pt and 80\,pt, but you will probably
find it useful to set consistent units, and express sizes in terms of them. Purely
from habit, I use $u$ for the horizontal unit and $v$ for the vertical unit. This
makes it more convenient when you want to add a grid and/or a number
-scale.\mpic{-16pt}{numbered-axes}
+scale.\mpic{-16pt}{func-numbered-axes}
\vskip -12pt
\vbox to 0pt{
-\begin{smallcode}
-numeric u, v; u = 40; v = 29;
-path xx, yy;
-xx = (3/2 left -- 5 right) scaled u;
-yy = (3/2 down -- 4 up) scaled v;
-for x=-1, 1, 2, 3, 4:
- draw yy shifted (x * u, 0) withcolor 7/8; % grid
- draw (down--up) shifted (x * u, 0); % ticks
- label("$" & decimal x & "$", (x * u, -8));
-endfor
-for y=-1, 1, 2, 3:
- draw xx shifted (0, y * v) withcolor 7/8; % grid
- draw (left--right) shifted (0, y * v); % ticks
- label("$" & decimal y & "$", (-10, y * v));
-endfor
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-\end{smallcode}\vss}
+\smallmpexternal[firstline=7,lastline=21]{func-numbered-axes.mp}
+\vss}
\newpage
\subsection{Drawing linear functions}
-\textsc{For simple} linear graphs, you just need to define two points and draw a
+\textsc{For simple} linear graphs, you just need to define two points and draw a
line between them; it is tempting to try to make some generalized macro to do this,
but it is hard to make something completely general, so for most graphs it is easier
just to specify two points and use \mpl{draw}; often it is handy to making your line
longer than you need, then trim it using \mpl{cutbefore} and/or \mpl{cutafter} so
that it fits neatly.
-\vadjust{\moveright 384pt\vbox to 0pt{\hsize 4in\vskip -100pt\begin{smallcode}
-numeric u, m, m', b, b';
-u = 1.44cm;
-b = 3.6u; b' = b + 1/2 u;
-m = -1; m' = 3/4 m;
-
-path xx, yy;
-xx = (left -- 5 right) scaled u;
-yy = xx rotated 90;
-
-numeric minx, maxx; path ff, gg;
-minx = xpart point 1/16 of xx;
-maxx = xpart point 15/16 of xx;
-ff = (minx, minx * m + b) -- (maxx, maxx * m + b);
-gg = (minx, minx * m' + b') -- (maxx, maxx * m' + b');
-
-z0 = point 0.4 of ff;
-z1 = point 0.54 of ff;
-z1 0 = whatever [point 0 of gg, point 1 of gg]; x1 0 = x0;
-z1 1 = whatever [point 0 of gg, point 1 of gg]; x1 1 = x1;
-
-forsuffixes @=0, 1:
- draw (x@, 0) -- z@ -- (0, y@) dashed evenly scaled 3/4;
- draw z@ -- z1 @ -- (0, y1 @) dashed withdots scaled 1/2;
- label.bot("$x_{" & decimal @ & "}$", (x@, 0));
- label.lft("$y_{" & decimal @ & "}$", (0, y@));
- label.lft("$y'_{" & decimal @ & "}$", (0, y1 @));
-endfor
-draw ff withcolor 2/3 red;
-draw gg withcolor 3/4 blue;
-drawarrow xx; drawarrow yy;
-
-label.rt("$x$", point 1 of xx);
-label.top("$y$", point 1 of yy);
-
-dotlabel.urt("$b$", (0, b));
-dotlabel.urt("$b'$", (0, b'));
-
-draw thelabel("slope: $m=" & decimal m & "$", 7 up)
- rotated angle (1, m) shifted point 2/3 of ff;
-draw thelabel("slope: $m'=" & decimal m' & "$", 7 up)
- rotated angle (1, m') shifted point 2/3 of gg;
-\end{smallcode}\vss}}
-$$\includegraphics[width=0.84\textwidth]{linear-graph.pdf}$$
+\vadjust{\moveright 384pt\vbox to 0pt{\hsize 4in\vskip -100pt
+\smallmpexternal[firstline=6,lastline=49]{func-linear-graph.mp}
+\vss}}
+$$\includegraphics[width=0.84\textwidth]{func-linear-graph}$$
But in this example it was easier to calculate them using $y=mx+b$.
Note also that spaces are allowed in suffixes, which makes the loop a bit simpler.
-\newpage
-In this second example of a linear function, the emphasis of the diagram was on
+\newpage\noindent
+In this second example of a drawing with linear functions, the emphasis of the diagram was on
the angles at the $x$-axis made by the two lines, so the lines were defined using
\mpl{rotated}, \mpl{shifted}, and \mpl{cutbefore} instead.
-\vadjust{\moveright 384pt\vbox to 0pt{\hsize 4in\vskip -24pt\begin{smallcode}
-path ell, tee, arc;
-ell = (left--right) scaled 10u rotated theta shifted P cutbefore xx;
-tee = (left--right) scaled 10u rotated psi shifted P cutbefore xx;
-arc = subpath (1.6, 3.2) of halfcircle rotated -180 shifted 1/2 up
- scaled 10u shifted P rotatedabout(P, psi);
-% the rest of the points then follow...
-Q = ell intersectionpoint subpath (1.5, 3) of arc;
-H = P + whatever * dir psi;
-xpart H = xpart Q = xpart M; ypart M = ypart N = 0;
-xpart N = xpart P;
-L = point 0 of ell;
-T = point 0 of tee;
-% now get on with the drawing
-draw arc dashed withdots scaled 1/4 withcolor 1/2 red;
-draw P--N dashed withdots scaled 1/2;
-draw Q--M dashed withdots scaled 1/2;
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-drawoptions(withcolor 2/3 blue);
-draw fullcircle scaled 32 shifted T cutafter tee;
-draw fullcircle scaled 28 shifted L cutafter ell;
-label("$\psi$", 24 right rotated 1/2 psi shifted T);
-label("$\theta$", 20 right rotated 1/2 theta shifted L);
-drawoptions();
-% trim the function lines neatly
-path boundary;
-z1 = point .95 of xx;
-z2 = point .95 of yy;
-boundary = z1--(x1,y2)--z2;
-draw ell cutafter boundary;
-draw tee cutafter boundary;
-% and finally label the points.
-label.bot("$T$", T);
-label.bot("$L$", L);
-label.bot("$N$", N);
-label.bot("$M$", M);
-dotlabel.ulft("$P$", P);
-dotlabel.lrt("$Q$", Q);
-dotlabel.lrt("$H$", H);
-\end{smallcode}\vss}}
-$$\includegraphics[width=\textwidth]{angles-lines.pdf}$$
-The lines are both trimmed to a convenient path (\id{boundary}) when they are
-drawn.\vadjust{\moveright296pt\vbox to 0pt{\vskip 80pt\begin{mplibcode}beginfig(0);drawarrow
-origin {right} .. {dir 70} 42 dir 60;
- label.lft("\small \dots continues", origin);
-endfig;\end{mplibcode}\vss}}
+$$\includegraphics[width=\textwidth]{func-angles-lines}$$
+The lines are both trimmed to a convenient path (\id{boundary}) when they are drawn.
+\smallmpexternal[firstline=6,lastline=12]{func-angles-lines.mp}
+\vskip-12pt\continued
+\moveright 384pt\vbox to 0pt{\hsize 4in\vss
+\smallmpexternal[firstline=14,lastline=51]{func-angles-lines.mp}
+\vskip -12pt}
-\begin{smallcode}
-numeric u; u = 1cm;
-
-path xx, yy;
-xx = (2 left -- 10 right) scaled u;
-yy = (down -- 7 up) scaled u;
-
-numeric theta, psi; psi = 28; theta = 50;
-
-pair P, Q, H, N, M, T, L;
-P = (4u, 3u);
-\end{smallcode}
-
-
\newpage
\subsection{Making curves for functions with a loop}
@@ -5800,15 +4728,15 @@
\begin{code}
vardef f(expr x) = x ** 2 enddef;
path ff;
-ff = (for x = minx step s until maxx - s:
- (x, f(x)) ..
- endfor (maxx, f(maxx))) xscaled u yscaled v;
+ff = (for x = minx step s until maxx - s:
+ (x, f(x)) ..
+ endfor (maxx, f(maxx))) xscaled u yscaled v;
\end{code}
provided you have first defined variables \id{minx} and \id{maxx} to represent the
domain of $x$, and worked out appropriate values for horizontal and vertical
-units, $u$, and $v$ so that the range of $f(x)$ fits neatly on your graph.
+units, $u$, and $v$ so that the range of $f(x)$ fits neatly on your graph.
-The loop
+The loop
above also uses a variable $s$ to control the number of points used to define the
path.\mwpic{-180pt}{func-powers}
The figures on the right show that over the domain $-3$ to $3$ a step of $\frac12$
@@ -5829,9 +4757,9 @@
vardef f(expr x) = x ** 2 enddef;
vardef fp(expr x) = 2x enddef; % NB "fp" because "f'" is illegal
path ff;
-ff = (for x = minx step s until maxx - s:
- (x, f(x)){1, fp(x)} ..
- endfor (maxx, f(maxx))) xscaled u yscaled v;
+ff = (for x = minx step s until maxx - s:
+ (x, f(x)){1, fp(x)} ..
+ endfor (maxx, f(maxx))) xscaled u yscaled v;
\end{code}
\vfill
@@ -5842,22 +4770,12 @@
\newpage
\subsection{Making curves for functions from path pieces}\label{sec:pathpieces}
-\textsc{In some situations}, you might find it easier to stich together various
+\textsc{In some situations}, you might find it easier to stitch together various
\<path> pieces to make your curve. This can be especially elegant if there is a
symmetry in the path. For example:\mwpic{-48pt}{func-reflection}
-\begin{code}
-path ff, negative_ff;
+\mpexternal[firstline=15,lastline=23]{func-reflection.mp}
-ff = (1,1) for x = 3/2 step 1/2 until 6: ... (x, 1/x) endfor;
-ff := reverse ff reflectedabout(origin, dir 45) & ff;
-ff := ff scaled 24;
-negative_ff = ff reflectedabout(origin, dir -45);
-
-draw ff withcolor 2/3 red;
-draw negative_ff withcolor 2/3 red;
-\end{code}
-
-\smallskip\centerline{\small (Omitting code for the axes, the grid, and the dots at
+\centerline{\small (Omitting code for the axes, the grid, and the dots at
each \mpl{point} of the paths).}
\smallskip
@@ -5865,7 +4783,7 @@
\begin{itemize}
\item Notice that you can update the path using the assignment operator
“\mpl{:=}”.
- \item You need to \mpl{reverse} the reflected portion so that the two ends coincide.
+ \item You need to \mpl{reverse} the reflected portion so that the two ends coincide.
\item The two path segments are spliced together with \mpl{&}. You could use
a path join like \mpl{..} instead, but then the joined path would have an extra
\mpl{point} at \mpl{(1,1)}.
@@ -5873,12 +4791,13 @@
the more horizontal part.
\end{itemize}
+\vfill\noindent
Reflection of a function in the line at 45° gives the inverse of the function, which
is especially useful for $y=1/x$, but it applies to functions generally. So if you want to
plot $y=\sqrt x$ it may be easier to define a path for $y=x^2$ and then reflect it.
This is particularly useful if you want to plot, say, $y=\sqrt[3]x$, over a domain
that includes negative numbers, because \MP\ will not calculate reciprocal powers of
-negative numbers.\mwpic{-60pt}{func-cuberoot}
+negative numbers.\mwpic{-90pt}{func-cuberoot}
The curve in this chart was created by reflecting the line $y=x^3$.
\newpage
@@ -5886,89 +4805,23 @@
\textsc{A further example} of creating paths by
transformation.\mpic{-36pt}{func-exponential}
-\begin{smallcode}
-numeric u; u = 42;
-path xx, yy;
-xx = (-3u, 0) -- (5u, 0);
-yy = xx rotated 90;
-path ee, ll, nn;
-numeric minx, maxx, s;
-minx = -3; maxx = 1/256 mlog(4.5); s = 1/4;
-ee = (for x = minx step s until maxx - s:
- (x, mexp(256x)){1, mexp(256x)} ...
-endfor (maxx, mexp(256 maxx)){1, mexp(256 maxx)}) scaled u;
-ll = ee reflectedabout(origin, dir 45);
-nn = (for x=1 step s until 4-s: (x, 1/x) ... endfor (4, 1/4)) scaled u;
-nn := reverse nn reflectedabout(origin, dir 45) & nn;
-
-draw unitsquare xscaled mexp(256) scaled u withcolor 7/8;
-draw unitsquare yscaled mexp(256) scaled u withcolor 7/8;
-path T[];
-numeric p; p = directiontime dir 45 of ee;
-T1 = (precontrol p of ee -- postcontrol p of ee)
- shifted - point p of ee scaled 1/2 u shifted point p of ee;
-T2 = (precontrol p of ll -- postcontrol p of ll)
- shifted - point p of ll scaled 1/2 u shifted point p of ll;
-drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
-draw T1; draw T2; draw interpath(1/2, T1, T2) dashed evenly;
-drawoptions();
-
-draw nn; label.urt("$1/x$", point 0 of nn);
-draw ee withcolor 2/3 blue; label.top("$e^x$", point infinity of ee);
-draw ll withcolor 3/4 red; label.top("$\ln(x)$", point infinity of ll);
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-dotlabel.lft("$e$", (0, mexp(256) * u));
-dotlabel.bot("$e$", (mexp(256) * u, 0));
-dotlabel.ulft("$1$", (0, u));
-dotlabel.lrt("$1$", (u, 0));
-\end{smallcode}
-\moveright6in\vbox to 0pt{\vss\noindent
+\vadjust{\moveright5.5in\vbox to 0pt{\vskip5in\noindent
If you prefer more ‘normal’ functions, you can define:
\begin{smallcode}
vardef exp(expr x) = mexp(256x) enddef;
vardef log(expr x) = 1/256 mlog(x) enddef;
-\end{smallcode}}
+\end{smallcode}\vss}}
+\smallmpexternal[firstline=6,lastline=40,xleftmargin=0pt]{func-exponential.mp}
+
\newpage
\subsection{Functions using trigonometric functions}
\textsc{As noted} in §\ref{trig}, \MP’s built-in trigonometric functions work in
degrees, this example shows how you might use them in a graph.%
-\vadjust{\moveright5in\vbox to 0pt{\vskip-24pt\begin{code}
- numeric u, pi; u = 50; pi = 3.141592653589793;
-
- path xx, yy;
- xx = (3.5 left -- 3.6 right) scaled u;
- yy = (1.1 down -- 1.2 up) scaled u;
-
- path ss;
- ss = origin for t=1 upto 360: -- (t, sind(t)) endfor;
- ss := ss shifted 360 left & ss;
- ss := ss xscaled (pi/180) scaled u;
-
- draw ss cutbefore yy shifted point 0 of xx
- cutafter yy shifted point 1 of xx
- withcolor 3/4 blue;
- draw ss shifted (-1/2 pi * u ,0)
- cutbefore yy shifted point 0 of xx
- cutafter yy shifted point 1 of xx
- withcolor 2/3 red;
-
- drawoptions(dashed withdots scaled 1/4);
- draw ((1/4 pi, 0) .. (1/4 pi, sind(45))) scaled u;
- draw ((1/2 pi, 0) .. (1/2 pi, sind(90))) scaled u;
- draw ((3/4 pi, 0) .. (3/4 pi, sind(135))) scaled u;
- drawoptions();
-
- drawarrow xx; label.rt("$t$", point 1 of xx);
- drawarrow yy; label.top("$u(t)$", point 1 of yy);
-
- for i=-4, -3, -2, -1, 1, 2, 3, 4:
- draw (down--up) scaled 2 shifted (pi * i/4 * u, 0);
- label.bot(pi_quarters(i), (pi * i/4 * u, -2));
- endfor
-\end{code}\vss}}
+\vadjust{\moveright5.25in\vbox to 0pt{\vskip-30pt
+\mpexternal[firstline=15,lastline=50]{func-sines.mp}
+\vss}}
$$\includegraphics[width=\textwidth]{func-sines}$$
For this diagram, the sine wave path ("ss", shown in \blue{blue})
@@ -5977,24 +4830,10 @@
\mpl{--} and still get a smooth path. Secondly the cycle is duplicated by splicing
itself to a shifted copy. Thirdly it is $x$-scaled to radians, and then scaled in both
directions to the chosen unit size, and drawn chopped off to the width of
-the $x$-axis. The cosine path is the same path, shifted $\frac12\pi$ left,
+the $x$-axis. The cosine path is the same path, shifted $\frac12\pi$ left,
drawn in \red{red}, and chopped off to fit the same width.
-
The fancy fraction labels were produced with this subroutine:
-\begin{smallcode}
-vardef pi_quarters(expr n) =
- save s, f, q; string s, f; numeric q;
- s = if n < 0: "-" else: "" fi; q = abs(n);
- if q mod 4 = 0:
- f = if q > 4: decimal 1/4 q else: "" fi;
- elseif q mod 2 = 0:
- f = "\frac{" & decimal 1/2 q & "}{2}";
- else:
- f = "\frac{" & decimal q & "}{4}";
- fi
- "$\scriptstyle" & s & f & "\pi$"
-enddef;
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=13]{func-sines.mp}
\newpage
\subsection{Manipulating functions}
@@ -6001,170 +4840,56 @@
\textsc{This second example} with trigonometric functions shows one way to add
two functions, by combining the \MP\ paths themselves.%
-\vadjust{\moveright5in\vbox to 0pt{\vskip-24pt\begin{code}
- numeric u, pi; u = 50; pi = 3.141592653589793;
-
- path xx, yy;
- xx = (3.5 left -- 4 right) scaled u;
- yy = (1.2 down -- 1.3 up) scaled u;
-
- path ss, tt, uu;
- ss = origin for x=1 upto 360: -- (x, sind(x)) endfor;
- tt = origin for x=1 upto 360: -- (x, 1/2 sind(3x)) endfor;
- uu = origin for x=1 upto 360: --
- (x, ypart point x of ss + ypart point x of tt) endfor;
-
- forsuffixes $=ss, tt, uu:
- $ := $ shifted 360 left & $;
- $ := $ xscaled (pi/180) scaled u;
- $ := $ cutbefore yy shifted point 0 of xx
- cutafter yy shifted point 1 of xx;
- endfor
-
- draw ss withcolor 1/2[blue, white];
- draw tt withcolor 1/2[red, white];
- draw uu withcolor 1/4 green;
-
- label.top("$f(x)=sin(x)$", point 290 of ss);
- label.bot("$g(x)=\frac12 sin(3x)$", point 295 of tt);
- label.urt("$f(x) + g(x)$", point 350 of uu);
-
- drawarrow xx; label.rt("$x$", point 1 of xx);
- drawarrow yy; label.top("$y$", point 1 of yy);
-
- for i=-6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7:
- draw (down--up) scaled 2 shifted (pi * i/6 * u, 0);
- label.bot(pi_sixths(i), (pi * i/6 * u, -2));
- endfor
-\end{code}\vss}}
+\vadjust{\moveright5.25in\vbox to 0pt{\vskip-28pt
+\mpexternal[firstline=22, lastline=56, xrightmargin=-20pt]{func-addition-of-sines.mp}
+\vss}}
$$\includegraphics[width=\textwidth]{func-addition-of-sines}$$
Notice how the same extension, scaling, and trimming operations
-can be applied to all three paths using a \mpl{forsuffixes} loop.
-Note that you can use any regular variable name for the loop index;
-you don't have to use \mpl{$}, but like \mpl{@} it is a
+can be applied to all three paths using a \mpl{forsuffixes} loop.
+Note that you can use any regular variable name for the loop index;
+you don't have to use \mpl{$}, but like \mpl{@} it is a
valid variable name in \MP, and it looks a bit like a placeholder marker in other
languages.
Note that you need to start with the first point of the path outside the loop
-so that you don't end up with a dangling \mpl{--} path connector. Using
+so that you don't end up with a dangling \mpl{--} path connector. Using
\mpl{origin} is just a short cut for writing \mpl{(0, sind(0))}. If you were
plotting a different function this would not work. For example, \mpl{(0, cosd(0))}
is \mpl{(0,1)}.
-\bigskip\noindent
-\hey The missing \mpl{pi_sixths} macro is left as an exercise for the reader.
+\vfill\noindent
+\hey The missing \mpl{pi_sixths} macro is left as an exercise for the reader.
Hint: you can adapt the \mpl{pi_quarters} on the previous page, allowing for halves,
thirds, and sixths instead of halves and quarters.
\newpage
\subsection{Focus on a specific region of a function}
-\textsc{This visual proof} required a large $y$-axis scale.\mwpic{-24pt}{func-epi-v-pie}
-The axes are separated to show the
+\textsc{This visual proof} required a large $y$-axis scale.\mwpic{-36pt}{func-epi-v-pie}
+The axes are separated to show the
discontinuity in scales, and that the origin is not on the chart.\enlargethispage\baselineskip
-\begin{smallcode}[xleftmargin=0pt]
-numeric minx, maxx, s, u, v;
-minx = 13/8; s = 1/16; maxx = 19/4; u = 89; v = 3072;
+\smallmpexternal[xleftmargin=0pt, firstline=8, lastline=42]{func-epi-v-pie.mp}
+\vskip-12pt\continued
+\moveright384pt\vbox to 0pt{\vss\hsize 4in\null\bigskip
+\smallmpexternal[firstline=44, lastline=57]{func-epi-v-pie.mp}
+}
-def f(expr x) = 1/256 mlog(x) / x enddef;
-path ff, xx, yy;
-ff = for x=minx step s until maxx-s: (x, f(x)) .. endfor (maxx, f(maxx));
-ff := ff xscaled u yscaled v;
-xx = origin -- right scaled (maxx-minx) scaled u;
-yy = origin -- up scaled 0.09v;
-xx := xx shifted point 0 of ff shifted 20 down;
-yy := yy shifted point 0 of ff shifted 20 left;
-
-numeric pi, e, fpi, fe;
-pi = 3.141592653589793 u; fpi = f(3.141592653589793) * v;
-e = 2.718281828459045 u; fe = f(2.718281828459045) * v;
-path ee, pp;
-ee = (e, ypart point 0 of xx) -- (e, fe) -- (xpart point 0 of yy, fe);
-pp = (pi, ypart point 0 of xx) -- (pi, fpi) -- (xpart point 0 of yy, fpi);
-
-draw ee dashed withdots scaled 1/4 withcolor 2/3 red;
-draw pp dashed withdots scaled 1/2 withcolor 2/3 red;
-draw ff withcolor 3/4 blue;
-
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-for x=2 upto 4:
- draw (down--up) scaled 2 shifted (x * u, ypart point 0 of xx);
- label.bot("$" & decimal x & "$", (x * u, ypart point 0 of xx - 2));
-endfor
-for y=31 upto 38:
- draw (left--right) scaled 2 shifted (xpart point 0 of yy, y/100*v);
-endfor
-for y=32, 35, 38:
- label.lft("$" & decimal (y/100) & "$", (xpart point 0 of yy-2, y/100*v));
-endfor
-\end{smallcode}
-
-\moveright384pt\vbox to 0pt{\vss\hsize 4in\begin{smallcode}
-drawoptions(withcolor 1/2 red);
-label.bot("$e$", point 0 of ee shifted 4 down);
-label.lft("$1/e$", point 2 of ee shifted 2 left);
-
-label.bot("$\pi$", point 0 of pp shifted 4 down);
-label.lft("$\ln\pi/\pi$", point 2 of pp shifted 2 left);
-
-drawoptions(withcolor 2/3 blue);
-label.urt("$\displaystyle y={\ln x\over x}$", point 42 of ff);
-
-drawoptions();
-label("\dots\ hence\enspace $e^\pi > \pi^e$.", (4u, 0.38v));
-\end{smallcode}}
-
\newpage
\subsection{Approximate function diagrams}
\textsc{Sometimes} you may need to plot a function that does not have a simple
-mathematical definition. You can use \MP’s normal path definitions to make a likely
-looking approximation.\mwpic{-48pt}{func-stress}
-\begin{smallcode}[xleftmargin=0pt, xrightmargin=-140pt]
-z1 = 377 right; z2 = 233 up;
-path ff; ff = origin .. (72, 144){1,2} .. (84, 144) .. (96, 144){1,1}
- .. (220, 220){right} .. (370, 160){2,-1.3};
+mathematical definition. You can a \MP \<path> to make a likely looking approximation.
+\mwpic{-48pt}{func-stress}
+\vskip-12pt
+\smallmpexternal[firstline=6,lastline=40,xleftmargin=0pt, xrightmargin=-300pt]{func-stress.mp}
-for t=2, 4, 4.9:
- draw point t of ff -- (xpart point t of ff, y2 + 6)
- dashed evenly scaled 1/2;
-endfor
-label.top("Strain hardening",
- (1/2 (xpart point 2 of ff + xpart point 4 of ff), y2));
-label.top("Necking",
- (1/2 (xpart point 4 of ff + xpart point 4.9 of ff), y2));
-
-path rr;
-rr = point 0.4 of ff -- (xpart point 0.8 of ff, ypart point 0.4 of ff) -- point 0.8 of ff;
-draw rr; label.bot("Run", point 1/2 of rr); label.rt("Rise", point 3/2 of rr);
-
-vardef pin_label@#(expr p, a, b)=
- draw a -- b cutbefore fullcircle scaled 8 shifted a withpen pencircle scaled 1/4 withcolor 1/2 white;
- label@#(p, b);
-enddef;
-pin_label.lrt("Yield strength", point 1.2 of ff, point 2 of ff + (8, -18));
-pin_label.bot("Ultimate strength", point 4 of ff, point 4 of ff + (4, -24));
-pin_label.bot("Fracture", point 5 of ff, point 5 of ff + (-8, -18));
-
-draw ff withpen pencircle scaled 1 withcolor 2/3 blue;
-clip currentpicture to unitsquare scaled 400; % clip thick pen at origin
-
-drawdblarrow z1 -- origin -- z2;
-label.ulft("Strain, $\epsilon$", z1);
-label.urt("Stress, $\sigma$", z2);
-
-label("$\displaystyle\hbox{Young's modulus} = \hbox{Slope} = {\hbox{Rise}\over\hbox{Run}}$",
- 1/2 z1 shifted 36 up) withcolor 2/3 blue;
-\end{smallcode}
-
\newpage
\subsubsection{Taming Bezier paths with controls}
-\textsc{It takes some} practice to translate a sketch of a curve into a smooth
+\textsc{It takes some} practice to translate a sketch of a curve into a smooth
path. Plain \MP\ inherits from \MF\ a useful \id{flex} macro, that takes a list of \<pair>s
(any number of them) and produces a pleasing path through them. As Knuth says in the
-\mfbook:
+\mfbook:
“The idea is to specify two endpoints, $z_1$ and $z_n$, together with
one or more intermediate points where the path is traveling in the
same direction as the straight line from $z_1$ to~$z_n$; these
@@ -6176,7 +4901,6 @@
\end{code}
(with appropriate definitions of the points), produces this:
\lower 12pt\hbox{\smash{\begin{mplibcode}
-beginfig(0);
z1=(0,509);
z2=(-14,492);
z3=(-32,481);
@@ -6190,27 +4914,14 @@
flex(z5,z6,z7) & flex(z7,z8,z9,z1) & cycle;
for i=1 upto 9: draw z[i] withpen pencircle scaled 2 withcolor red; endfor
currentpicture := currentpicture scaled 0.7071 rotatedabout(z3, -20);
-endfig;
\end{mplibcode}}}
\bigskip\noindent
\textsc{Another approach} is just to define the end-points and some control points,
and then define a path that is shaped by the control points but does not actually go
-through them. Consider this program:\mwpic{-20pt}{func-pulse}
-\begin{code}
-vardef pulse(expr w, h, d) =
-for i=0 upto 4: x[i] = w/4 * i; endfor
- y0 = y1 = 0;
- y3 = y4 = d;
- y2 = h;
- z0 .. 1/2[z0, z1] .. controls z1
- .. 1/2[z1, z2] .. controls z2
- .. 1/2[z2, z3] .. controls z3
- .. 1/2[z3, z4] .. z4
-enddef;
-draw pulse(300, 100, -40);
-\end{code}
-This produces the smooth blue line shown on the right. A second copy of the line is
+through them. Consider this program:\mwpic{-36pt}{func-pulse}
+\mpexternal[firstline=7,lastline=16]{func-pulse.mp}
+\noindent This produces the smooth blue line shown on the right. A second copy of the line is
shown below, decorated with the three control points $z_1$, $z_2$, and $z_3$ in red,
and showing the six points of the path as small black circles. You can tweak this
curve by adjusting the controls left or right, or changing the mediation parameters
@@ -6219,51 +4930,33 @@
\newpage
\subsection{Parametric plots}
-\textsc{If you want to plot} one function against another, then you can make each
+\textsc{If you want to plot} one function against another, then you can make each
coordinate a function of an independent variable. All functions can be converted,
trivially, to this form:
\begin{code}
vardef f(expr x) = x enddef;
vardef g(expr x) = sind(x) enddef; % or whatever function ...
-path ff; ff = for t = mint step s until maxt - s:
- (f(t), g(t)) ..
+path ff; ff = for t = mint step s until maxt - s:
+ (f(t), g(t)) ..
endfor (f(maxt), g(maxt));
\end{code}
-But you can make more complicated curves, for example curves
+But you can make more complicated curves, for example curves
that can have more than one value for $y$ for a given $x$, if you change $f(x)$ and
$g(x)$ appropriately.
The first example\mwpic{-24pt}{func-lemniscate} shows the lemniscate of Bernoulli
and was drawn like this:
-\begin{smallcode}
-numeric a, c; c = 128; a = sqrt(2) * c;
-vardef f(expr x) = a * cosd(x) / (1 + sind(x) ** 2) enddef;
-vardef g(expr x) = f(x) * sind(x) enddef;
-numeric mint, maxt, s; mint = 0; s = 30; maxt = 360;
-path p;
-p = for t = mint step s until maxt - s:
- (f(t), g(t)) ...
-endfor cycle;
-draw p withcolor 3/4 blue;
-path xx, yy;
-xx = (left -- right) scaled 200;
-yy = (down -- up) scaled 64;
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-dotlabel.bot("$F_1$", c * left);
-dotlabel.bot("$F_2$", c * right);
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=21]{func-lemniscate.mp}
+\noindent
Although sometimes, especially when you know the domain is 0° to 360° and that the
path is cyclic, it is simpler to write the two expressions directly in the
loop:\mwpic{-108pt}{func-parametric}
-\begin{smallcode}
-path p;
-p = for t = 0 upto 360: (144 cosd(3t), 89 sind(2t)) ... endfor cycle;
-draw p withcolor 2/3 red;
-\end{smallcode}
+\smallmpexternal[firstline=12,lastline=14]{func-parametric.mp}
+\noindent
which produces this Lissajous curve $\longrightarrow$
\newpage
-\subsubsection{Parametric plots with polar coordinates: Maurer roses}
+\subsection*{Parametric plots with polar coordinates: Maurer roses}
+
\textsc{Instead of} defining separate functions for the $x$ and $y$ coordinates in a
parametric plot, it is sometimes convenient to use \MP’s polar coordinate notation (discussed in
§\ref{polar}). The family of “rose” plots, based on $r=\cos(n\theta)$, is easy to
@@ -6270,41 +4963,25 @@
do in this way. Here is a Maurer rose, based on $r=\cos(2\theta)$ and connecting
every 29th point on the curve.\mpic{-24pt}{func-maurer-rose}
-\begin{code}
- numeric n; n = 2;
- path r; r = (for t=0 upto 360:
- cosd(n * t) * dir t ...
- endfor cycle) scaled 150;
+\mpexternal[firstline=6,lastline=23]{func-maurer-rose.mp}
- numeric d; d = 29;
- path k; k = for t = 0 upto 360:
- point d * t mod 360 of r --
- endfor cycle;
-
- draw k dashed withdots scaled 1/8
- withpen pencircle scaled 1/4
- withcolor 1/2[blue, white];
+\noindent
+Different values of the parameters in $r$ and $k$ give an endless variety of patterns. But note that if
+you put anything higher than \mpl{point 91t of r} in $k$, you will need to use
+"-numbersystem=double" to avoid arithmetic overflow (because $360\times92 > 32768$).
+You get prettier curves if the parameter in $k$ is a prime number.
- draw r withcolor 2/3 red;
-
- path xx, yy; % you might not need the axes...
- xx = (left -- right) scaled 160;
- yy = (down -- up) scaled 160;
- drawarrow xx; label.rt("$x$", point 1 of xx);
- drawarrow yy; label.top("$y$", point 1 of yy);
-\end{code}
-Different values of $n$ and $d$ give an endless variety of patterns. But note that if
-your choice of $d$ exceeds $2^{15}/360 \simeq 91$ you will need to use
-"-numbersystem=double" to avoid arithmetic overflow.
-
\newpage
\section{Drawing plane curves}
-{\textsc{“Plane curves offer} a rich \dots\ field of study which may be approached
+\moveright72pt\vbox{\begingroup\hsize4in
+\raggedleft\fontsize{8}{10}\selectfont\textsf{%
+Plane curves offer a rich \dots\ field of study which may be approached
from a quite elementary level. Anyone who can draw a circle with a given centre and
a given radius can draw a cardioid or a limaçon. Anyone who can use a set square
-can draw a parabola or a strophoid” \hfill — \textsl{A Book of Curves}, E.\@ H.\@
-Lockwood\parfillskip0pt\par}
+can draw a parabola or a strophoid \hfill — \textsl{A Book of Curves}, E.\@ H.\@
+Lockwood\parfillskip0pt
+}\par\endgroup}
\subsection{Parabola}
@@ -6312,72 +4989,29 @@
\le 1$ and then transform as required (see next page), but it can be illuminating to follow more
traditional constructions, such as that shown on the
right.\mwpic{-180pt}{curves-parabola}
-\vadjust{\moveright7.2in\vbox to 0pt{\hsize 200pt\noindent
+\vadjust{\moveright7.2in\vbox to 0pt{\vskip48pt\hsize 200pt\noindent
The idea here is that you put the right angle of your set square on the vertical
-axis with the short side touching $S$, and then draw the long side. If you do this
+axis with the short side touching $S$, and then draw the long side. If you do this
in enough places, the edges form a parabola. In the \MP\ code here, the intersection
of each ray with the one before is captured as variable $t$ and then added one at a
time to the \<path> \id{parabola}, (using a neat trick at the beginning).
\vss}}
-\begin{smallcode}[xleftmargin=0pt]
-pair A, S; A = origin; S = 66 right;
-path parabola, last;
-for q = -144 step 8 until 144:
- pair Q; Q = (0, q);
- path ray;
- ray = (origin -- unitvector(S - Q)) scaled 300
- rotated if q < 0: - fi 90 shifted Q;
- draw S -- ray withcolor 7/8;
- if known last:
- pair t;
- t = whatever[point 0 of ray, point 1 of ray]
- = whatever[point 0 of last, point 1 of last];
- parabola := if known parabola: parabola .. fi t;
- fi
- last := ray;
-endfor
+\mpexternal[firstline=6,lastline=26,xleftmargin=0pt,xrightmargin=-36pt]{curves-parabola.mp}
-draw parabola withcolor 3/4[red, white];
-for t=0 upto length parabola:
- draw point t of parabola withpen pencircle scaled 3/2 withcolor red;
-endfor
-draw (up--down) scaled 300;
-
-dotlabel.lft("$A$", A);
-dotlabel.rt("$S$", S);
-\end{smallcode}
-
\newpage
-\subsubsection{Parabola from directrix and focus}
+\subsubsection*{Parabola from directrix and focus}
-\textsc{The classical definition} of the parabola is the locus of points that are
+\textsc{The classical definition} of the parabola is the locus of points that are
equidistant from a given line (the \textit{directrix}, shown as $A\to B$ on the
right) to a given focus point (shown as $S$).\mpic{-24pt}{curves-parabola-directrix}
-Each point on the parabola path is related to each point, and you can construct an
+Each point on the parabola path is related to each point on the directrix, and you can construct an
equilateral parallelogram at each point as shown. This leads to a macro that
generates a parabola given two \<pair> variables to define the directrix and another
to define the focus:
-\begin{code}
-vardef parabola(expr A, B, S) =
- save m, q, n, parabola;
- pair n; % n = nearest point to S on A--B
- n = whatever[A, B]; n - S = whatever * (A-B) rotated 90;
- path parabola;
- for t=0 step 1/64 until 1:
- pair m, q;
- m = 1/2[S, t[A, B]];
- q = whatever[S, n];
- q - m = whatever * (S - m) rotated 90;
- parabola := if known parabola: parabola -- fi
- q reflectedabout(S, m);
- endfor
- parabola
-enddef;
+\mpexternal[firstline=17,lastline=31]{curves-parabola-directrix.mp}
-\end{code}
+\subsubsection*{Parabola from $y=x^2$ and $dy/dx=2x$}
-\subsubsection{Parabola from $y=x^2$ and $dy/dx=2x$}
-
Alternatively you could define a “unit parabola” like this:
\begin{code}
path ff; ff = (-1, 1){1, -2} .. (-1/2, 1/4){1, -1} ..
@@ -6400,8 +5034,8 @@
$S$. When the ratio of $OS/OA = \sqrt2$, the asymptotes are at right angles.
You can also draw the hyperbola as the function $y=1/x$ (as shown in
-§\ref{sec:pathpieces}), which can be transformed to any desired shape.
-The untransformed function is shown on the bottom left, with the focus $S$
+§\ref{sec:pathpieces}), which can be transformed to any desired shape.
+The untransformed function is shown on the bottom left, with the focus $S$
at the point $(\sqrt2, \sqrt2)$. If the desired angle between the asymptotes is
$2\alpha$, the transformation can be created like this:
\begin{code}
@@ -6421,52 +5055,45 @@
path by a different amount in each direction. By convention, the $y$-axis is the
minor axis of an ellipse.\mwpic{-24pt}{curves-ellipse}
The ellipse shown on the right, was defined like this:
-\begin{code}
-path ellipse;
-ellipse = fullcircle scaled 320 yscaled 5/8 rotated 13;
-\end{code}
+\mpexternal[firstline=10,lastline=11]{curves-ellipse.mp}
+\noindent
Then the lengths of the semi-major axes, $a$ and $b$, were extracted like this:
-\begin{code}
-numeric a, b;
-2a = abs (point 4 of ellipse - point 0 of ellipse);
-2b = abs (point 6 of ellipse - point 2 of ellipse);
-\end{code}
+\mpexternal[firstline=13,lastline=15]{curves-ellipse.mp}
+\noindent
If you already had $a$ and $b$, then you could use them directly to scale your
ellipse; the following snippet would produce the same elliptical path:
\begin{code}
-numeric a, b; a = 160; b = 100; path ellipse;
-ellipse = fullcircle xscaled 2a yscaled 2b rotated 13;
+numeric a, b; a = 160; b = 100; path ellipse;
+ellipse = fullcircle xscaled 2a yscaled 2b rotated 13;
\end{code}
-
-\bigskip\noindent
The “eccentricity”, $e$, of the ellipse is the ratio between the distance from the centre
to each focus and the semi-major axis, $a$. By definition, the distance from $F_1$
to $T$ to $F_2$ is constant as $T$ moves round the ellipse and is equal to $2a$.
Hence when $T$ lies on the minor axis, you have $TF_1=a$, and so $a^2 = b^2 +
a^2e^2$, and $e^2=1-b^2/a^2$:
-\begin{code}
-numeric e; e = 1 +-+ b/a; % the Pythagorean difference operator
-\end{code}
+\mpexternal[firstline=17,lastline=17]{curves-ellipse.mp}
+\noindent
The focus points can then be found like this:
-\begin{code}
-z0 = 1/2[point 0 of ellipse, point 4 of ellipse];
-z1 = e[z0, point 0 of ellipse];
-z2 = e[z0, point 4 of ellipse];
-\end{code}
+\mpexternal[firstline=19,lastline=21]{curves-ellipse.mp}
+\noindent
+Note that in the example above the ellipse is centred at the origin, because
+the \mpl{fullcircle} path was only scaled and rotated, not shifted. But the method
+shown will find the centre of any ellipse no matter where you have placed it.
+
\vfill
-\moveright 384pt\vbox to 0pt{\vss
-The tangent and the normal at $T$ were added like this:
-\begin{code}
-numeric t; t = 1.732;
-draw (left--right) scaled 21
- rotated angle direction t of ellipse
- shifted point t of ellipse;
-draw (1/2 down--up) scaled 21
- rotated angle direction t of ellipse
- shifted point t of ellipse;
-\end{code}}
+
+\noindent
+\hey If you already have the two focus points, then the distance between them will be
+$2ae$, so if you also have $a$ or $e$ you can calculate $b$ and hence draw your
+ellipse appropriately scaled, rotated, and shifted.
+
+\moveright 5.5in\vbox to 0pt{\vss\noindent
+The tangent and the normal at $T$ above were added like this:
+\mpexternal[firstline=39,lastline=46]{curves-ellipse.mp}
+}
+
\newpage
-\subsubsection{Tangent from external point to ellipse}
+\subsection*{Tangent from external point to ellipse}
$$\includegraphics[width=\textwidth]{curves-ellipse-tangents}$$
To find the tangent points from an external point $A$ to an ellipse, the classical
@@ -6475,78 +5102,30 @@
$P$ and $Q$, of these two arcs are the images of the first focus point in the
required tangents (because $F_2TF_1=2a$ by definition, and $F_2P=2a$ by
construction), and so the tangent points $T$ and $T'$ are the intersections of
-$F_2P$ and $F_2Q$ with the ellipse.
+$F_2P$ and $F_2Q$ with the ellipse.
-\vfill\noindent
There is no such direct construction for the nearest point on an ellipse to a given
point, but you can use the macro \id{solve} to find it numerically. The blue arrow
shows the shortest distance from $A$ to the ellipse.
-\vadjust{\moveright 384pt\vbox to 0pt{\vss
-\begin{smallcode}
-secondarydef a through b =
- begingroup; save d; numeric d; d = abs(a-b);
- (1+12/d)[b,a]--(1+12/d)[a,b] endgroup
-enddef;
-path ellipse; ellipse = fullcircle scaled 300 yscaled 5/8 rotated 13;
-z0 = 1/2[point 4 of ellipse, point 0 of ellipse];
-numeric a, b, e;
-2a = abs (point 4 of ellipse - point 0 of ellipse);
-2b = abs (point 6 of ellipse - point 2 of ellipse);
-e = 1 +-+ b/a;
-z1 = e[z0, point 0 of ellipse];
-z2 = e[z0, point 4 of ellipse];
-z3 = 240 dir 25;
-path pp, qq;
-pp = fullcircle scaled 2 abs (z1 - z3) shifted z3;
-qq = fullcircle scaled 4a shifted z2;
-z4 = pp intersectionpoint qq;
-z5 = reverse pp intersectionpoint qq;
-numeric t, u;
-(t, whatever) = ellipse intersectiontimes (z2 -- z4);
-(u, whatever) = ellipse intersectiontimes (z2 -- z5);
-vardef f(expr x) =
- angle (z3 - point x of ellipse) + 90 > angle direction x of ellipse
-enddef;
-drawarrow z3 -- point solve f(0, t) of ellipse withcolor 2/3 blue;
-drawoptions(dashed evenly withcolor 7/8);
-draw point 0 of ellipse through point 4 of ellipse;
-draw point 2 of ellipse through point 6 of ellipse;
-drawoptions(withcolor 3/4);
-draw z4 -- z1 -- z5;
-draw z2 -- z4 -- z3 -- z5 -- cycle;
-draw point t of ellipse -- z1 -- point u of ellipse;
-drawoptions();
-draw point t of ellipse -- z3 -- point u of ellipse withcolor 2/3 red;
-dotlabel.llft("$F_1$", z1); dotlabel.llft("$F_2$", z2);
-dotlabel.urt("$A$", z3);
-dotlabel.ulft("$P$", z4); dotlabel.lrt ("$Q$", z5);
-dotlabel.ulft("$T$", point t of ellipse);
-dotlabel.lrt("$T'$", point u of ellipse);
-draw ellipse;
-picture P; P = currentpicture; currentpicture := nullpicture;
-draw pp dashed withdots scaled 1/2;
-draw qq dashed withdots scaled 1/2;
-bboxmargin := 24; clip currentpicture to bbox P; draw P;
-\end{smallcode}
-\vskip -48pt}}
+\vadjust{\moveright 382pt\vbox to 0pt{\vss
+\mpexternal[firstline=7,lastline=44,xleftmargin=0pt,xrightmargin=-36pt]{curves-ellipse-tangents.mp}
+\vskip -36pt}}
\newpage
\subsection{Cardioid}
-\textsc{To draw a cardioid by hand}, you can draw a base circle, mark a fixed point $A$ on it, and
-then draw a circle centred at any point $Q$ on the circle that passes through point
-$A$. If you then repeat this for many different positions of Q, the cardioid is the
-curve that encloses all the circles.\mpic{-24pt}{curves-cardioid-simple}
+\textsc{To draw a cardioid by hand}, you can draw a base circle, mark a fixed point
+$A$ on it, and then draw a circle centred at any point $Q$ on the circle that passes
+through point $A$. If you then repeat this for many different positions of Q, the
+cardioid is the curve that encloses all the circles.\mpic{-24pt}{curves-cardioid-simple}
But for \MP, you want only a single point $P$ from the circumference of each circle;
-this turns out to be the image of $A$ reflected in the tangent at each point $Q$, like so:
+this turns out to be the image of $A$ reflected in the tangent at each point $Q$,
+like so:
$$\includegraphics[width=0.7\textwidth]{curves-cardioid-construction}$$
\vskip -84pt\noindent
-With a small step size $s$ and a base circle \id{base}, this suggests: \begin{smallcode}
-pair A; A = point 0 of base;
-path cardioid; cardioid = for t = 0 step s until length base:
- A reflectedabout(precontrol t of base, postcontrol t of base) ..
-endfor cycle;
-\end{smallcode}
+With a small step size $s$ and a rotated circle \id{base}, this suggests:
+\smallmpexternal[firstline=13,lastline=16]{curves-cardioid-construction.mp}
+\noindent
You can also show that $AP=2a(1+\cos\theta)$, where $a$ is the radius of the
base circle and $\theta$ is the angle that $AP$ makes with the diameter through
$A$, so you might use:
@@ -6557,7 +5136,7 @@
\newpage
\subsection{Limaçon}
-\textsc{The limaçon can be seen} as a generalization of the cardioid, obtained by
+\textsc{The limaçon can be seen} as a generalization of the cardioid, obtained by
moving point $A$ off the base circle.
\vadjust{\moveright356pt\vbox to 0pt{\vskip -20pt\noindent
\rlap{\includegraphics[scale=0.833]{curves-limacon-simple}}\vss}}
@@ -6565,15 +5144,10 @@
reflected in the tangent at each $Q$. The “hole” gets larger as $A$ moves away from
the \id{base} circle; when $A$ touches the \id{base} the hole disappears and the
curve becomes the cardioid, as before.
-
Following this ruler-and-compasses approach, the red limaçon path in the figure here
was generated from the \id{base} circle shown in blue.
-\begin{smallcode}
-pair A; A = 2[center base, point 0 of base];
-path limacon; limacon = for t = 0 step s until length base:
- A reflectedabout(precontrol t of base, postcontrol t of base) ..
-endfor cycle;
-\end{smallcode}
+\smallmpexternal[firstline=12,lastline=15]{curves-limacon-simple.mp}
+\noindent
Or if you prefer a more trigonometrical approach:
\begin{smallcode}
limacon = for t=0 upto 359: 2a*(1+2cosd(t))*dir t .. endfor cycle;
@@ -6583,12 +5157,12 @@
\vfill
\noindent
-An alternative approach (due to Albrecht Dürer) is shown below. In this dia-
+\textsc{An alternative approach} (due to Albrecht Dürer) is shown below. In this
\par\kern 2pt
-\vbox{\halign{#&\quad\vbox{\hsize=2.4in\noindent #}\cr
+\vbox{\halign{#&\kern 1em\vbox{\hsize=18em\noindent #}\cr
$$\includegraphics{curves-limacon-durer}$$
-&gram the base circle is divided into 12 parts like a
-clock face. At 1 o’clock, you draw a line segment of a given
+&diagram, the base circle is divided into 12 parts like a
+clock face. At 1 o’clock, you draw a line segment of a given
length parallel to the radius to 2 o’clock; at 2 you draw the same length
segment parallel to 4 o’clock, and so on. The limaçon is the curve through
the far ends of each segment (plus any intermediate points required).
@@ -6613,46 +5187,33 @@
$$\includegraphics[scale=0.8]{curves-astroid-construction}$$
Then the point $P$ on $A \to B$ that is closest to $T$ will lie on the astroid, so you
can make the path with:
-\begin{smallcode}
-path astroid; astroid = for t=0 step 1/16 until 8:
- hide(pair a, b, p;
- a = (xpart point t of base, 0); b = (0, ypart point t of base);
- p = whatever[a, b]; p-point t of base = whatever * (a-b) rotated 90;
- ) p -- endfor cycle;
-\end{smallcode}
+\smallmpexternal[firstline=8,lastline=12,xleftmargin=0pt]{curves-astroid.mp}
+\noindent
Note that you need to use “\mpl{--}” so that the cusps stay neatly
pointed.\marginpar{\vskip-38pt\small\noindent
-\llap{\hey\,}The geometry of the subtended angles shows that the length of the arc
+\hey The geometry of the subtended angles shows that the length of the arc
$T\to S$ equals the length of the arc from $T\to P$ on the quarter-sized circle
through $T$ and $M$. So the astroid is also the path of a point on the smaller
circle rolling around the inside of the base circle.}
\newpage
-\subsubsection{Astroid and cousins}
+\subsubsection*{Astroid and cousins}
The geometry of the astroid also allows us to define a simple parametric equation
for the point $P$.
$$\includegraphics[scale=0.8]{curves-astroid-construction}$$
If the distance $OT = a$, then $OA = BT = a\cos\theta$.
-But then $BP = BT\,\cos\theta = a\cos^2\theta$, and the
+But then $BP = BT\,\cos\theta = a\cos^2\theta$, and the
$x$-coordinate of $P = BP\,\cos\theta=a\cos^3\theta$. By a similar
-argument the $y$-coordinate is $a\sin^3\theta$, so the parametric
+argument the $y$-coordinate is $a\sin^3\theta$, so the parametric
equations for $P = (x, y)$:
$$\centerline{$x=a\cos^3\theta$ \quad and \quad $y=a\sin^3\theta$}$$
This is used to make this rather psychedelic family of astroid cousins $\longrightarrow$
\moveright384pt\vbox to 36pt{\vss
-$$\includegraphics[scale=0.9]{curves-astroid-family}$$
-\begin{smallcode}
-numeric a; a = 144; input colorbrewer-rgb
-for n=1 upto 7:
- path p; p = a * right for t=6 step 6 until 90:
- .. a * (cosd(t) ** n, sind(t) ** n)
- endfor;
- p := for i=0 upto 3: p rotated 90i & endfor cycle;
- fill p withcolor Oranges[9][n]; draw p;
-endfor
-\end{smallcode}}
+$$\includegraphics[scale=0.95]{curves-astroid-family}$$
+\mpexternal[firstline=7,lastline=14]{curves-astroid-family.mp}
+}
\newpage
@@ -6662,103 +5223,48 @@
rolling wheel. In the first diagram the cycloid is drawn in red and the
corresponding rolling wheel in blue. The main idea in this diagram is to make the
whole drawing depend on just a few parameters; here there are two: the radius $r$
-and the amount of rotation $θ$. If we make $r$ bigger, the drawing will be
-scaled up; if we change $θ$, the wheel will appear to have rolled along.
-\mpic{-66pt}{cycloids}
+and the amount of rotation $\theta$. If we make $r$ bigger, the drawing will be
+scaled up; if we change $\theta$, the wheel will appear to have rolled along.
+$$\includegraphics[width=0.9\textwidth]{curves-cycloids}$$
-
-\marginpar{\par\kern1in
\begin{itemize}
- \item Near the beginning we define $\pi=3.14159265$, as there’s no such constant
- built in, but it makes the source more understandable to write "pi/180"
- instead of "0.017453". It would be nice to use the Greek letters themselves
- in the source, but \MP\ only lets you use plain ASCII characters, to you
- have to write "pi" instead. Later on "t" is used instead of $\theta$.
- \item The path of the cycloid $c$ is defined using an inline "for" loop. There’s a
- slight awkwardness to doing this as you have to repeat yourself either at
- the beginning or the end, because you can’t have a dangling "--" or ".." at
- the end of the path. With a closed path it’s easier because you can just
- put "--cycle" after the "endfor". The strange numbers here are because
- we are going from a rotation of $-100°$ to $+460°$; $360°$ corresponds to
- one hop of the cycloid.
+ \item The path of the cycloid is defined using an inline "for" loop, using a
+ neat trick to avoid a leading "--" in the path. The strange numbers here
+ are because we are going from a rotation of $-80°$ to $+440°$; $360°$
+ corresponds to one hop of the cycloid.
\item The axes are done in the usual way, except that we use "xpart" and the
"point .. of .." notation to make the $x$-axis neatly line up with the ends
of the cycloid path.
- \item To label points with dots but no text it’s convenient just to fill a
- circle scaled to "dotlabeldiam"; this internal parameter is the current size
- to be used for the dots in "dotlabel".
+ \item To label points with dots but no text it’s convenient just to draw
+ the point with \mpl{pencircle scaled dotlabeldiam};
+ this internal parameter is the current size
+ to be used for the dots in \mpl{dotlabel}.
-\end{itemize}}
+\end{itemize}
-\mpexternal[xleftmargin=0pt]{cycloids-code.mp}
+\moveright 384pt\vbox to 0pt{\hsize 320pt\vss
+\smallmpexternal[firstline=5,lastline=46,xleftmargin=-10pt]{curves-cycloids.mp}
+\vskip -64pt}
-\noindent
-You can generalize the picture to make cycloids where the point tracing the
-cycloid is not on the circumference doing the rolling; the classic example is the
-wheel of the train with a flange. Here I have added $R$ to define the radius of an
-outer rim, while the wheel still rolls along a circle of radius $r$.
-\mpic{-40pt}{cycloids-extra}
-You might like to experiment with making $R<r$. Note also that variable names are
-case sensitive in \MP.
-
-\mpexternal[xleftmargin=0pt]{cycloids-extra-code.mp}
-
-\noindent The output\mpic{-122pt}{cycloids-extra} is repeated at the right to save you flicking pages.
-
\newpage
-\subsubsection{The cycloid compared to other curves}
+\subsubsection*{The cycloid compared to other curves}
\noindent\textsc{You can't easily} draw a cycloid through two arbitrary points, but
-if you get the size of the generating circle right, you can make it pass through
-points at each end of a quarter circle, and then it's easy to draw other curves
-between the two points. \vadjust{\moveright5.25in\vbox to 0pt{\vskip-48pt\begin{smallcode}
-numeric r; r = 164;
-path Y, L, C, P, S;
+taking the equations for $x$ and $y$ from the previous page, we can use \mpl{solve}
+to find a value $a$ for $\theta>0$ where $\theta-\sin\theta=1-\cos\theta$, and then
+you have two points for $\theta=0$ and $\theta=a$ which are
+at each end of a quarter circle, and it's easy to draw other curves
+through them.\vadjust{\moveright5.25in\vbox to 0pt{\vskip-48pt
+\smallmpexternal[firstline=6,lastline=42]{curves-brachisto.mp}
+\vss}}
+The cycloid is drawn here inverted, to make the \textit{brachistochrone} (the curve
+joining two points such that a body travelling along it under gravity takes a
+shorter time than is possible along any other curve between the points).
+$$\includegraphics{curves-brachisto}$$
-Y = origin for t=5 step 5 until 140:
- -- (0, r) rotated t shifted (t/57.29577951308232*r, -r)
-endfor cutafter (origin -- (4r, 0) rotated -45);
-
-z0 = point 0 of Y;
-z1 = point infinity of Y;
-
-L = z0 -- z1;
-C = quartercircle rotated 180 scaled 2x1 shifted (x1, y0);
-% The idea here is to use the derivative as the direction at each point.
-% If you treat A as x=-1, and B as x=0 and used x=-1/2 in the middle,
-% then three points are enough to make the curves look realistic.
-% parabola f = x^2, f' = 2x
-P = z0{1,-2}
- ... (xpart 1/2[z1, z0], ypart 1/4[z1, z0]){1,-1} ... z1 {1, 0};
-% sixth degree f = x^6, f' = 6x^5
-S = z0{1,-6}
- ... (xpart 1/2[z1, z0], ypart 1/64[z1, z0]){1, -6/32} ... z1 {1, 0};
-
-draw z0 -- (x0,y1) -- z1 withcolor 3/4;
-
-drawoptions(withcolor 2/3 red);
- draw L; dotlabel.urt("Line", point 1/4 of L);
-drawoptions(withcolor 1/2 green);
- draw C; dotlabel.urt("Circle", point 1 of C);
-drawoptions(withcolor 1/4[red, green]);
- draw P; dotlabel.urt("Parabola", point 1/2 of P);
-drawoptions(withcolor 3/4[red, green]);
- draw S; dotlabel.llft("Sixth degree", point 3/4 of S);
-drawoptions(withcolor 1/2 blue);
- draw Y; dotlabel.urt("Cycloid", point 22 of Y);
-drawoptions();
-dotlabel.ulft(btex $A$ etex, z0);
-dotlabel.urt(btex $B$ etex, z1);
-\end{smallcode}\vss}}
-Here is an example with an inverted cycloid, the
-so-called \textit{brachistochrone} (the curve joining two points such that a body
-travelling along it under gravity takes a shorter time than is possible along any
-other curve between the points).
-$$\includegraphics{brachisto}$$
-
\newpage
\subsection{Spirals}
@@ -6770,7 +5276,7 @@
$r=a\theta$.\mpic{-36pt}{curves-spiral-archimedes}
This is very simple to program in \MP.
\begin{code}
-numeric a; a = 1/8; path S;
+numeric a; a = 1/8; path S;
S = origin for t=1 upto 360: .. a * t * dir t endfor;
\end{code}
except that you are unlikely to need one point for every degree of turn in your spiral, so you are
@@ -6783,112 +5289,51 @@
S = origin for t=1 upto 90: .. 1/12 t * dir 16t endfor;
\end{code}
which would give you four complete turns with a tighter spacing.\marginpar{\small
-The rope was drawn (very slowly) with the \mpl{rope} macro from §\ref{pics-border}.}
+The rope was drawn (quite slowly) with the \mpl{rope} macro from §\ref{pics-border}.}
-\bigskip\noindent
-The next simplest is the logarithmic spiral where you have
-$r=a^\theta$.\mwpic{10pt}{curves-spiral-equiangular} This is also very simple to
-program in \MP, provided you are careful about the scaling. The complete program
-for the spiral shown on the right was:
-\begin{code}
-numeric a; a = 2.6; path S;
-S = right for t=1 upto 360: .. a ** (t/64) * dir 4t endfor;
-drawarrow S;
-\end{code}
+\vfill\noindent
+\textsc{The next simplest} is the logarithmic spiral where you have
+$r=a^\theta$.\mwpic{-72pt}{curves-spiral-equiangular} This is also very simple to
+program in \MP, provided you are careful about the scaling.
+For the spiral shown on the right, the complete program was:
+\mpexternal[firstline=7,lastline=9,xleftmargin=0pt]{curves-spiral-equiangular.mp}
+\noindent
Note that $a$ was carefully chosen to get a curve that would fit the page, and that
$t$ has been divided by 64 to bring it into a suitable range to work with the
-default number system.
+default number system.
\newpage
-\subsubsection{Logarithmic spiral and the golden rectangle}
+\subsubsection*{Logarithmic spiral and the golden rectangle}
-\textsc{The logarithmic spiral} is connected to growth in nature. If you start with
-a small square and keep adding squares scaled to the longer side of the resulting
+\textsc{The logarithmic spiral} is connected to growth in nature. If you start with
+a small square and keep adding squares scaled to the longer side of the resulting
rectangle, you get the golden rectangle and the logarithmic spiral emerges from
it.\mpic{-48pt}{curves-spiral-gnomon-sq}
-\begin{code}[xleftmargin=0pt, xrightmargin=-20pt]
-drawoptions(withpen pencircle scaled 1/4 withcolor 1/4);
-path s[]; s0 = unitsquare;
-fill s0 withcolor 1/2[2/3 blue, white]; draw s0;
-numeric a, b, t, n; a = 1; b = 1; n = 11;
-for i = 1 upto n:
- t := b; b := b + a; a := t; % Fibonacci sequence
- s[i] = unitsquare scaled a;
- s[i] := s[i] shifted (point i of s[i-1] - point i-1 of s[i]);
- fill s[i] withcolor (1/2 + i/32)[2/3 blue, white];
- draw s[i];
-endfor
-% cross hairs
-for i = n-1 upto n:
- draw point i-2 of s[i-2] -- point i of s[i];
-endfor
-drawoptions();
-% Draw the spiral as a red arrow
-drawarrow origin for i=0 upto n: .. point i of s[i] endfor
- withcolor 2/3 red;
-% Show the Fibonacci sizes for the bigger boxes
-for i = 5 upto n:
- label(TEX(decimal arclength subpath (0, 1) of s[i])
- scaled 0.8 rotated angle point n of s[n], center s[i]);
-endfor
-% Rotate whole picture to show off the spiral
-currentpicture := currentpicture rotated - angle point n of s[n];
-\end{code}
+\mpexternal[firstline=6,lastline=33,xleftmargin=0pt]{curves-spiral-gnomon-sq.mp}
\moveright 396pt \vbox to 0pt{\vss\hsize 4in\small
\noindent\llap{• }You can't assign to a pair literal in \MP, so you cannot write
\mpl{(a,b) := (b,a+b)}; use a temporary numeric instead.
\noindent\llap{• }The uses of \mpl{point} with the square paths \mpl{s[]}
-exploit the fact the the \mpl{unitsquare} path is cyclic, so point 4 is the same
+exploit the fact the the \mpl{unitsquare} path is cyclic, so point 4 is the same
as point 0, and so on.
-\noindent\llap{• }Note also the rotation of the labels, so that they are horizontal
+\noindent\llap{• }Note also the rotation of the labels, so that they are horizontal
when the whole picture is rotated at the end to show the spiral better.
\par}
-
\newpage
-\subsubsection{Logarithmic spiral and similar triangles}
+\subsubsection*{Logarithmic spiral and similar triangles}
-\textsc{This drawing} starts with a large triangle and transforms it to make
+\textsc{This drawing} starts with a large triangle and transforms it to make
smaller similar copies. The spiral is drawn through the apex of successive
transformed triangles.\mpic{0pt}{curves-spiral-gnomon-trig}
-\begin{code}[xleftmargin=0pt, xrightmargin=-80pt]
-path t[], base; pair apex;
-base = (left--right) scaled 100;
-apex = whatever * dir +72 shifted point 0 of base
- = whatever * dir -72 shifted point 1 of base;
-t0 = (base -- apex -- cycle);
-
-transform S;
-r = arclength subpath (0, 1) of t0 / arclength subpath (2, 3) of t0;
-point 0 of t0 transformed S = (r*r)[point 0 of t0, point 2 of t0];
-point 1 of t0 transformed S = point 0 of t0;
-point 2 of t0 transformed S = point 1 of t0;
-
-n = 16;
-for i=1 upto n:
- t[i] = t[i-1] transformed S;
- draw subpath (2,3) of t[i] withpen pencircle scaled 1/4;
-endfor
-
-drawoptions(withpen pencircle scaled 1/8 withcolor blue);
-draw point 0 of t0 -- point 3/2 of t0;
-draw point 0 of t1 -- point 3/2 of t1;
-drawoptions();
-draw t0;
-drawarrow point 2 of t[n] for i=n-1 downto 0:
- .. point 2 of t[i] endfor withcolor 2/3 red;
-
-z0 = whatever[point 0 of t0, point 3/2 of t0]
- = whatever[point 0 of t1, point 3/2 of t1];
-currentpicture := currentpicture rotated - angle (point 2 of t0 - z0);
-\end{code}
+\mpexternal[firstline=6,lastline=36,xleftmargin=0pt, xrightmargin=-80pt]{curves-spiral-gnomon-trig.mp}
\moveright 396pt \vbox to 0pt{\vss\hsize 4in\small
-\noindent The \<transform> $S$ is defined implicitly. It is sufficient
-to give equations for three non-collinear points, and \MP\ will work out
-the rest. In order to do this, you need to know the ratio of $x/a$, but by
-definition $a/b=b/x$, so $x=b^2/a$, hence $x/a=(b/a)^2$. The code shown
+\noindent The \<transform> $S$ is defined implicitly. It is sufficient
+to give equations for three non-collinear points, and \MP\ will work out
+the rest. In order to do this, you need to know the ratio of $x/a$, but by
+definition $a/b=b/x$, so $x=b^2/a$, hence $x/a=(b/a)^2$. The code shown
sets $r=b/a$, and then uses $r^2$ as the required fraction along $a$.
\smallskip\noindent\hey
@@ -6901,7 +5346,7 @@
\newpage
\section{Eggs}\label{eggs}
-\textsc{Drawing bird's eggs} excites a curious fascination in some people. This
+\textsc{Drawing hens' eggs} excites a curious fascination in some people. This
section shows some possible ways to make eggs with \MP. The first few
compass-and-ruler constructions are taken from Robert Dixon's
\textsl{Mathographics}. They all follow the same basic idea of constructing the
@@ -6910,63 +5355,29 @@
\subsection{Euclidean egg}
-The first is made of four circular arcs, defined here as parts of
+The first is made of four circular arcs, defined here as parts of
circles $a$, $b$, $c$, \& $d$.\mwpic{0pt}{eggs-moss}\marginpar{\par\kern 3in
\begin{itemize}
\item "eggs-common.mp" defines the colours, and the \mpl{numbered_points}
routine that is used to show the points of the "egg" path.
\item Note that it is not necessary that the parts of the arcs touch;
- in fact it is better to join them with the \mpl{..} connector in case the
+ in fact it is better to join them with the \mpl{..} connector in case the
ends are not close enough for you to use \mpl{&}.
- \item The rigmarole with saving the current picture, is to show a copy
+ \item The rigmarole with saving the current picture, is to show a copy
of the egg path with and without the construction lines.
\end{itemize}
}
-\begin{code}[xleftmargin=0pt]
-input eggs-common
-path a, b, c, d, egg; numeric r; r = 100;
-a = fullcircle scaled 2r;
-b = fullcircle scaled 4r shifted point 4 of a;
-c = fullcircle scaled 4r shifted point 0 of a;
-d = fullcircle scaled 2 abs (point 2 of a - point 1 of b)
- shifted point 2 of a;
-egg = subpath (0, 1) of b .. point 2 of d ..
- subpath (3, 4) of c .. subpath (5, 7) of a .. cycle;
-beginfig(1);
-fill egg withpen pencircle scaled 2 withcolor eggshell;
-picture P; P = currentpicture;
-drawoptions(withpen pencircle scaled 1/4 withcolor dark_eggshell);
-draw a; draw d;
-drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
-draw point 1 of egg -- point 4 of egg --
- point 0 of egg -- point 3 of egg;
-draw egg;
-drawoptions(withpen pencircle scaled 2 withcolor 7/16);
-draw center a;
-draw center d;
-draw numbered_points(egg);
-drawoptions();
-draw P shifted 240 right;
-endfig;
-\end{code}
+\mpexternal[firstline=5,lastline=29,xleftmargin=0pt]{eggs-moss.mp}
+\noindent
\newpage
\subsection{Pythagorean egg}
The centres of the arcs are determined by the 3-4-5 triangle at the
origin.\mwpic{0pt}{eggs-thom}
-\begin{code}
-numeric r, a, b, t; a = 60; 4b = 3a; r = a ++ b;
-path base, cap, egg;
-base = subpath (4, 8) of fullcircle scaled 2(2r-b);
-cap = subpath (0, 4) of fullcircle scaled 2r shifted (0, a)
- cutbefore ((b, 0) -- (b, 2r))
- cutafter ((-b, 0) -- (-b, 2r));
-egg = point 4 of base {up} .. cap .. {down} base & cycle;
-% more naturally "base {up} .. cap .. {down} cycle"
-% but then point 0 would not be at 3 o'clock
-\end{code}
+\mpexternal[firstline=8,lastline=17]{eggs-thom.mp}
+\noindent
Note that you can use $\to$ to create reasonably large circular arcs.
-The parts of the drawing for filling the egg,
+The parts of the drawing for filling the egg,
and showing the construction are similar to the first example.
\subsection{A taller Pythagorean egg}
@@ -6973,72 +5384,28 @@
A slightly different approach using a $\sqrt3$-$\sqrt4$-$\sqrt7$
triangle.\mwpic{20pt}{eggs-357}
-\begin{code}
-path base, cup, cap, egg;
-base = fullcircle scaled 200;
-z1 = point -2/3 of base;
-z2 = point 2/3 of base;
-z3 = point 10/3 of base;
-z4 = point 14/3 of base;
-z5 = 1/2[z2, z3];
-z6 = 1/2[z4, z1];
-numeric a, b;
-a = abs(z3 - z1) - abs(z4 - z6);
-b = abs(z3 - z1) - abs(z4 - z5);
-cup = subpath (4, 8) of fullcircle scaled 2a shifted z6;
-cap = fullcircle scaled 2b shifted z5
- cutbefore (z5 -- 2[z4, z5])
- cutafter (z5 -- 2[z1, z5]);
-egg = point 4 of cup {up} .. cap .. {down} cup & cycle;
-\end{code}
+\mpexternal[firstline=9,lastline=22]{eggs-357.mp}
\newpage
\subsection{Golden section egg}
-An alternative construction.\mwpic{-10pt}{eggs-gold}
-\begin{code}[xleftmargin=0pt]
-path base, aa, bb; pair m, n, n';
-base = fullcircle scaled 200; m = 1/2 point 0 of base;
-aa = halfcircle scaled 2 abs (point 2 of base - m)
- shifted m cutbefore (origin -- 1000 up);
-n = point infinity of aa; n' = n reflectedabout(up, down);
-bb = subpath (0, 2) of base shifted n cutafter (origin -- 1000 up);
+Another alternative construction, for Callicrates.\mwpic{-10pt}{eggs-gold}
+\mpexternal[firstline=9,lastline=23,xleftmargin=0pt]{eggs-gold.mp}
-path dome, cap, cup, egg;
-dome = fullcircle
- scaled 2 (abs(n - point 0 of base) - abs(n - point 0 of bb))
- shifted point infinity of bb;
-cap = dome cutbefore (point 4 of bb -- 2[n, point 4 of bb])
- cutafter (point 4 of bb -- 2[n', point 4 of bb]);
-cup = subpath (4, 8) of base;
-egg = point 4 of cup {up} .. cap .. {down} cup & cycle;
-\end{code}
+\subsection{Four point egg}
-\subsection{Four point egg}
-% eggs-four-point.mp
So far all the eggs have been drawn with semi-circular big end, but this
-can be improved.
+can be improved.
To get a smoother curve, you can use four different sized arcs with four different
-centres of rotation to make up
+centres of rotation to make up
each side of the egg.\mwpic{-36pt}{eggs-four-point}
-\begin{code}[xleftmargin=0pt]
-path egg, a, b, c, d;
-a = fullcircle scaled 80;
-b = a scaled 2 shifted point 6 of a;
-c = halfcircle
- scaled 2 (abs(point 0 of a - point 5 of b) - abs(point 0 of a));
-d = fullcircle
- scaled 2 abs(point 2 of a - point 2 of c) shifted point 2 of c;
+\mpexternal[firstline=9,lastline=17,xleftmargin=0pt]{eggs-four-point.mp}
-egg = point 0 of c {up} .. subpath (1,3) of d .. {down} point 4 of c
- .. subpath (5, 7) of b .. cycle;
-\end{code}
-
\newpage
\subsection{Five point egg}
-The next level of sophistication is to use five different arcs,
-but this is more complex and you lose the
+The next level of sophistication is to use five different arcs,
+but this is more complex and you lose the
points at exactly E, N, W, and S.\mwpic{0pt}{eggs-five-better}\marginpar{\par\vskip 3in
\noindent\hey Instead of defining and joining circular arcs, this construction defines
the points for the egg and the desired directions at each point;
@@ -7047,46 +5414,13 @@
rotation $o_1$ to $o_8$ which are either points on the rings or intersections of
lines between them. Then eight directions $u_1$ to $u_8$ are defined at right
angles to lines between pairs of centre points. Finally the handy
-\mpl{directionpoint} macro is used to find the points where the relevant circle is
-moving in that direction. To make the egg, these points are joined up with $\to$
+\mpl{directionpoint} macro is used to find the points where the relevant circle is
+moving in that direction. To make the egg, these points are joined up with $\to$
constrained by the matching direction to make circular arcs.\\
\llap{$\longleftarrow$\ }{\small Like so.}
-}
-\begin{smallcode}[xleftmargin=0pt]
-numeric a; a = 56;
-path r[]; % the rings
-r1 = fullcircle scaled 2a shifted (0, -3/2 a);
-r2 = fullcircle scaled 2a shifted (0, -1/2 a);
-r3 = fullcircle scaled 2a shifted (0, +1/2 a);
-r4 = fullcircle scaled 2a shifted (0, +3/2 a);
-r5 = r2 rotatedabout(point 2 of r2, -60);
-r6 = r2 rotatedabout(point 2 of r2, +60);
-pair o[]; % the centres of rotation for each arc
-o1 = point 6 of r5;
-o2 = point 2 of r3;
-o3 = point 6 of r6;
-o4 = whatever[o3, point 2+4/3 of r2] = whatever[o2, point 2-4/3 of r1];
-o8 = whatever[o1, point 2-4/3 of r2] = whatever[o2, point 2+4/3 of r1];
-o6 = 1/2[point 2-4/3 of r1, point 2+4/3 of r1];
-o5 = whatever[o6, point 2-4/3 of r3] = whatever[o4, point 2+4/3 of r1];
-o7 = whatever[o6, point 2+4/3 of r3] = whatever[o8, point 2-4/3 of r1];
-pair u[], t[]; % directions and points for the egg path
-u0 = (o8 - o1) rotated 90; t0 = directionpoint u0 of r6;
-u1 = (o2 - o1) rotated 90; t1 = directionpoint u1 of r4;
-u2 = (o2 - o3) rotated 90; t2 = directionpoint u2 of r4;
-u3 = (o4 - o3) rotated 90; t3 = directionpoint u3 of r5;
-u4 = (o5 - o4) rotated 90;
-u5 = (o6 - o5) rotated 90;
-u6 = (o6 - o7) rotated 90;
-u7 = (o7 - o8) rotated 90;
-t4 = directionpoint u4 of fullcircle scaled 2 abs (t3 - o4) shifted o4;
-t5 = directionpoint u5 of fullcircle scaled 2 abs (t4 - o5) shifted o5;
-t6 = directionpoint u6 of fullcircle scaled 2 abs (t5 - o6) shifted o6;
-t7 = directionpoint u7 of fullcircle scaled 2 abs (t6 - o7) shifted o7;
+}
+\smallmpexternal[firstline=6,lastline=37,xleftmargin=0pt]{eggs-five-better.mp}
-path egg; egg = for i=0 upto 7: t[i] {u[i]} .. endfor cycle;
-\end{smallcode}
-
\newpage
\subsection{A superellipse egg}
@@ -7093,27 +5427,18 @@
All this construction is a good exercise in ingenuity, but if you just want
a simple quick egg path, then the \mpl{superellipse} macro gives you a \MP-specific
option. All you need is this:\mwpic{-36pt}{eggs-super}
-\begin{code}[xleftmargin=0pt]
-path egg;
-egg = superellipse(right, 1.6 up, left, 1.2 down, 0.69);
-egg := egg scaled 100;
-\end{code}
+\mpexternal[firstline=6,lastline=8]{eggs-super.mp}
-
-\vfill \centerline{\tiny [This space intentionally left blank]}
\vfill
+\centerline{\tiny [This space intentionally left blank]}
+\vfill
\subsection{The perfect egg}
The last word in egg curve perfection is the algebraic solution provided by the TDCC
Laboratory in Japan [{\small \mpl{https://nyjp07.com/index_E.html}}].\mwpic{0pt}{eggs-perfect}
-\begin{code}
-path egg;
-egg = for t=-180 step 15 until 180 - eps:
- (0.78 cosd(1/4 t) * sind(t), -cosd(t)) ..
- endfor cycle;
-egg := egg scaled 128;
-\end{code}
+\mpexternal[firstline=9,lastline=13]{eggs-perfect.mp}
+\noindent
Note that, unlike all the others, this path has 24 points and the path starts at the
top. You can draw it starting at 3 o’clock, and with only 8 points but the egg is slightly less perfect.
Just replace the loop above with:
@@ -7127,46 +5452,14 @@
\subsection{Egg kitsch}
If you want eggs that look solid, then you can use \mpl{interpath}:\mpic{-24pt}{eggs-shaded}
-\begin{smallcode}[xleftmargin=0pt]
-path egg, spot;
-egg = (for t=-180 step 15 until 180 - eps:
- (0.78 cosd(1/4 t) * sind(t), -cosd(t)) ..
-endfor cycle) scaled 100;
-spot = fullcircle scaled 4 shifted 3/4 point 3 of egg;
-vardef fade_filled(expr egg, spot, dark, light, n) = image(
- for i = 0 upto n:
- fill interpath(i/n, egg, spot) withcolor ((i/n)**1/3)[dark,light];
- endfor)
-enddef;
-beginfig(1);
- color a, b;
- a = 1/256(150, 100, 60);
- b = 1/256(256, 220, 180);
- draw fade_filled(egg, spot, a, b, 256) rotated -30;
-endfig;
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=20,xleftmargin=0pt]{eggs-shaded.mp}
+\noindent
This works nicely with any of the "egg" paths defined in this section.
+
+\vfill\noindent
And finally, if all that has made you feel peckish, then how about
-these?\mwpic{12pt}{eggs-fried}
-\begin{smallcode}[xleftmargin=0pt, xrightmargin=-24pt]
-path yolk, base;
-color cooked_egg_yolk, cooked_egg_white;
-cooked_egg_yolk = 1/256(216, 136, 49);
-cooked_egg_white = 1/256(235, 237, 233);
-vardef fried_egg(expr r) =
- save base, yolk; path base, yolk;
- yolk = for i=0 upto 17: (r + 1/8 normaldeviate) * dir 20i .. endfor cycle;
- base = for i=0 upto 17: (2r + 1/8r * normaldeviate) * dir 20i .. endfor cycle;
- base := base shifted (uniformdeviate r/2, uniformdeviate r/2);
- image(
- fill base withcolor cooked_egg_white;
- fill yolk withcolor cooked_egg_yolk;
- fill subpath (6.7, 9.6) of yolk scaled 0.8 --
- subpath (9.6, 6.7) of yolk scaled 0.66 -- cycle
- withcolor 1/2[cooked_egg_yolk, white];
- ) enddef;
-for i=0 upto 1: draw fried_egg(40) shifted 120 dir 120i; endfor
-\end{smallcode}
+these?\mwpic{0pt}{eggs-fried}
+\smallmpexternal[firstline=6,lastline=20,xleftmargin=0pt,xrightmargin=-24pt]{eggs-fried.mp}
%===============================================================
\newpage
@@ -7175,17 +5468,34 @@
\textsc{Graphs and other displays} that show data, rather than a mathematical
function, are presented in this section, with a focus on illustrations for books and
technical papers. Most of the examples here follow those developed in Edward
-Tufte's \textsl{The Visual Display of Quantitative Information}.
+Tufte's books on graphics.\vadjust{\moveright5.5in\vbox to 0pt{\vskip-42pt\noindent
+\begin{itemize}
+\item \textsl{The Visual Display of Quantitative Information}
+\item \textsl{Visual Explanations}
+\item \textsl{Beautiful Evidence}
+\item \dots\ and others, at \texttt{https://edwardtufte.com}
+\end{itemize}\vss}}
-\bigskip\noindent
-Most of them have a pale manilla background, which was added using the technique
-from §\ref{backgrounds}, like this:
+\vfill\noindent
+Most of the drawings in this section have a pale manila background, which was added
+using the technique from §\ref{backgrounds}. At the beginning, the background
+colour is changed like this:
\begin{code}
-picture p; p = currentpicture; currentpicture := nullpicture;
-bboxmargin := 12;
-fill bbox p withcolor 1/32(32, 32, 31);
-draw p;
+background := (1, 1, 31/32); % change at start so "unfill" works
\end{code}
+Then at the end of the figure, the background is applied like this:
+\begin{code}
+picture p; p = currentpicture; clearit;
+bboxmargin := 12; unfill bbox p; draw p;
+\end{code}
+But there are lots of figures in this section, so this “wrapping” is actually
+applied using the begin- and end-figure “hooks”. If you examine the source code,
+you will see that each figure inputs a file
+called "tufte-manila-paper" which contains this:
+\mpexternal{tufte-manila-paper.mp}
+\noindent
+The \mpl{beginfig} and \mpl{endfig} macros provided by plain \MP\ automatically apply
+anything that is set in the two "extra" strings.
\newpage
\subsection{Simple time lines}
@@ -7197,131 +5507,126 @@
\item The data is stored as \<pair> values in a \<path> variable. This only
works if both data values are numeric. If the values are larger than 4096
you either need to scale them or use the "double" number system.
- \item Notice how the horizontal unit $u$ is set by measuring the width of a label using
+ \item Notice how the horizontal unit $u$ is set by measuring the width of a label using
the technique discussed in §\ref{textsize}. And that you have to shift the data
path left before applying the $x$-scaling to avoid overflow.
\end{itemize}
}
-\begin{texcode}[xleftmargin=0pt]
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{fontspec}
-\setmainfont[Numbers=OldStyle]{TeX Gyre Pagella}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-\end{texcode}\vskip -8pt
-\begin{smallcode}[xleftmargin=2pt]
-beginfig(1);
-path data, p;
-data = (1978, 18) -- (1979, 19) -- (1980, 20) -- (1981, 22)
- -- (1982, 24) -- (1983, 26) -- (1984, 27) -- (1985, 27.5);
-numeric u, v;
-u = xpart urcorner textext("1980\kern 0.75em"); v = 8;
-p = data shifted -(xpart point 0 of data, 0) xscaled u yscaled v;
-draw (xpart point 0 of p, 20) -- p -- (xpart point infinity of p, 20);
-draw (xpart point 0 of p, 0) -- (xpart point infinity of p, 0);
-for t=0 upto length p:
- numeric x, y; (x, y) = point t of p;
- undraw (x, y) withpen pencircle scaled 2 dotlabeldiam;
- draw (x, y) withpen pencircle scaled dotlabeldiam;
- label("\strut" & decimal ypart point t of data, (x, y + 8));
- draw (x, 0) -- (x, 4);
- label("\strut" & decimal xpart point t of data, (x, 12));
-endfor
-dotlabel.rt(btex \vbox to 6pt{\halign{\small #\hss\cr
-13.7 mpg, average\cr for all cars on\cr road, 1978\cr}\vss} etex,
-(xpart point 0 of p, 13.7v));
-dotlabel.lft(btex \vbox to 6pt{\halign{\small #\hss\cr
-19.5 mpg, expected\cr average for all cars\cr on road, 1985\cr}\vss} etex,
-(xpart point infinity of p, 19.5v));
-label.top(btex \vbox{\halign{\hss\textsc{#}\hss\cr
-required fuel economy standards:\cr
-new cars built from 1978 to 1985\cr}} etex,
-point 5/2 of bbox currentpicture shifted 21 up);
-endfig;
-\end{smallcode}\vskip -10pt
-\vbox to 0pt{\begin{texcode}[xleftmargin=0pt]
-\end{mplibcode}
-\end{document}
-\end{texcode}\vss}
+\enlargethispage{36pt}\vskip-12pt
+\smalltexternal[firstline=1,lastline=7,xleftmargin=0pt]{tufte-mpg.mp}
+\vskip-12pt
+\smallmpexternal[firstline=8,lastline=36,xleftmargin=0pt]{tufte-mpg.mp}
+\vskip-12pt
+\smalltexternal[firstline=37,lastline=38,xleftmargin=0pt]{tufte-mpg.mp}
\newpage
\subsection{Time line with minimal annotation}
\noindent\mpic{120pt}{tufte-budget}\marginpar{
\begin{itemize}
- \item This one has an even sparser frame, and
- uses the \mpl{ahangle} trick to make the neat
- I-beam annotation mark.
+ \item This one has an even sparser frame, and dispenses
+ with the labels on each data point.
\item It is suggested that you resist the temptation to make very many
- special macros to do charts like this; the ideas here are mainly
+ special macros to do charts like this; the ideas here are mainly
to show that \MP\ makes a good environment for following Tufte’s advice
- about charts: to maximize data ink, and minimize chart junk.
+ about charts: to maximize data ink and minimize chart junk;
+ albeit at the cost of some pains-taking.
\end{itemize}}
-\begin{smallcode}[xleftmargin=0pt]
-beginfig(1);
-path data, p;
-data = (1967, 311) -- (1968, 332) -- (1969, 372) -- (1970, 385)
- -- (1971, 385) -- (1972, 393) -- (1973, 387) -- (1974, 381)
- -- (1975, 387) -- (1976, 400) -- (1977, 380);
-numeric u, v;
-u = xpart urcorner textext("1980\kern 0.75em"); v = 1.414;
-p = data shifted -(xpart point 0 of data, 300) xscaled u yscaled v;
-draw p;
-for d = 300 step 20 until 400:
- numeric y; y = (d - 300) * v;
- label.lft("\strut\scriptsize\$\,\small" & decimal d, (-12, y));
- draw (-8, y) -- (-12, y);
- if d > 370:
- draw (xpart point 3 of p, y) -- (xpart point infinity of p + 8, y)
- dashed evenly scaled 1/4 withpen pencircle scaled 1/4;
- fi
-endfor
-path a; a = (xpart point infinity of p + 21, (380 - 300) * v)
- -- (xpart point infinity of p + 21, (400 - 300) * v);
-interim ahangle := 180;
-interim ahlength := 2;
-drawdblarrow a withpen pencircle scaled 1/4;
-label("\small 5\%", point 1/2 of a shifted 12 right);
-for t=0 upto length p:
- numeric x, y; (x, y) = point t of p;
- undraw (x, y) withpen pencircle scaled 2 dotlabeldiam;
- draw (x, y) withpen pencircle scaled dotlabeldiam;
- draw (x, -8) -- (x, -12);
- label("\strut\small" & decimal xpart point t of data, (x, -20));
-endfor
-label.urt(btex \vbox{\halign{\small #\hfill\cr
-Per capita\cr budget expenditure\cr in constant dollars\cr}} etex,
-(0, (410 - 300) * v));
-endfig;
-\end{smallcode}
+\smallmpexternal[firstline=10,lastline=44,xleftmargin=0pt,xrightmargin=-30pt]{tufte-budget.mp}
\newpage
\subsection{Time line with more complex dates}
-If the dates in your time line are more granular than years, then you need a
-better way to deal with them. This chart shows the £/€ exchange rate by month.
-$$\includegraphics[width=\textwidth]{tufte-currency}$$
-The dates on the horizontal axis where transformed from calendar dates to a
-serial number using this routine:
+If the dates in your time line are more granular, then you need a
+better way to deal with them. This chart below shows the £/€ exchange rate by month.
+The dates on the horizontal axis were transformed from calendar dates to a
+serial number using the routine shown on the right,
+which allows you to do this:
\begin{code}
-vardef base(expr Y, M, d) =
- save m, y; numeric m, y;
- if M < 3: m = M + 9; y = Y - 1;
- else: m = M - 3; y = Y; fi
- 365/1024 y + (floor(y/4) - floor(y/100) + floor(y/400)
- + floor((2+3m)/5) + 30m + d - 307) / 1024
-enddef;
-\end{code}
-which allows you to add events like this:
-\begin{code}
dotlabel.bot("Brexit vote", (base(2016, 6, 24) * u, 78 v));
\end{code}
for suitable values of $u$ and $v$.
+\vadjust{\moveright5.5in\vbox to 0pt{\vss
+\mpexternal[xleftmargin=0pt]{basedate.mp}
+}}
+\bigskip
+\noindent\hbox to \textwidth{\includegraphics{tufte-currency}\hss}
+
+
\newpage
-\section{Commutative diagrams}
+\subsection{Daily events with annotation}
+\textsc{This chart} is adapted from Edward Tufte's \textsl{Visual explanations},
+p.33;
+it presents the data from John Snow's table of daily deaths in the London
+cholera epidemic of 1854 in a simple bar chart form, with annotation pointing out
+that the epidemic was already declining when the supposedly decisive intervention of
+removing the handle from the water pump at the centre of the outbreak was made.
+\vadjust{\moveright5.5in\vbox to 0pt{\hsize=4in\vskip -76pt
+\smallmpexternal[firstline=11,lastline=48,xleftmargin=0pt]{tufte-snow.mp}
+\noindent\hey
+\textit{The code for the annotation and the title was omitted to save space.\\
+See the source file for details}.\vss}}
+
+\medskip\noindent\includegraphics[width=\textwidth]{tufte-snow}
+
+\bigskip
+\noindent
+The data for the chart was edited directly into the \MP\ source, using a text editor
+to copy the data from the source table, and format them into lists so that you can use
+loops to capture the values in two parallel indexed numeric variables \mpl{deaths[]}
+and \mpl{day_number[]}. It is useful to be able to group the data visually into weeks to
+reduce the chance of errors, but there is no other significance.
+
+Note that the bars are drawn with a wide pen and \mpl{cutdraw} in order to get nice square ends
+on the bars; then \mpl{undraw} is used to make implicit grid lines.
+
+\newpage
+\subsection{Scatter plot with annotations and simple jitter}
+
+\textsc{This chart} is from Tufte’s analysis of the Challenger space shuttle
+disaster. His objective here was to show all the available
+data relating launch temperature and damage to the booster rockets, and to point
+out that the forecast for 28 January 1986 was very much colder than any other
+launch.\vadjust{\moveright5.5in\vbox to 0pt{\hsize 4.2in\vskip -48pt
+\begin{smallcode}[xleftmargin=0pt]
+numeric r; r = 1/5; % adjustment of the marks where required...
+path damage; damage = origin .. (53, 11) .. (57, 4) .. (58, 4) ..
+ (63, 2)..
+ (66, 0)..
+ (67, 0 + 2r) .. % because the data set is quite small
+ (67, 0) .. % the simplest way to show multiple points
+ (67, 0 - 2r) .. % at the same (x, y) location is to add
+ (68, 0).. % this little vertical shift by hand
+ (69, 0)..
+ (70, 4 + r).. % the data is captured in a path, but only the
+ (70, 4 - r).. % points are drawn, not the lines between them
+ (70, 0 + r)..
+ (70, 0 - r)..
+ (72, 0)..
+ % and so on
+\end{smallcode}
+\vss}}
+
+The data was again edited directly into the \MP\ source, but this time captured
+as a \<path> variable. One advantage of this is that it allows you to process
+all the values in parallel using \mpl{scaled} or \mpl{shifted} on the whole path.
+\begin{smallcode}[xleftmargin=0pt]
+numeric u, v; u = 10.8; 5u = 4v;
+damage := damage xscaled u yscaled v;
+\end{smallcode}
+The individual points are accessed using the \mpl{point n of p} syntax:
+\begin{smallcode}[xleftmargin=0pt, xrightmargin=-36pt]
+for i = 1 upto length damage:
+ draw point i of damage withpen pencircle scaled (3/2r * v) withcolor 2/3 red;
+endfor
+\end{smallcode}
+
+\vbox to 0pt{\hbox to \textwidth{\includegraphics{tufte-srm-damage}\hss}\vss}
+
+\newpage
+\section{Commutative diagrams}\label{sec:cd}
+
\textsc{If you want lots} of complex bells and whistles on your commutative diagrams, then
you probably want to use specialist tools like "tikz-cd" or "xypic", but if your
needs are simpler, plain \MP\ is more than capable, and if you are already
@@ -7330,62 +5635,21 @@
Here are two examples to illustrate some general techniques. They may be familiar to
readers of the manuals for the tools referred to above.
$$
-\includegraphics{tikzcd-example}
+\includegraphics{cd-tikzcd-example}
\qquad
-\includegraphics{xypic-example}
+\includegraphics{cd-xypic-example}
$$
The complete code used to generate the right-hand picture is shown on the
right.\rlap{\rightarrow}%
\vadjust{\moveright5.5in\vbox to 0pt{\kern-218pt
-\begin{smallcode}
-picture U, XY, X, Y, Z;
-z1 = -z2 = (-61, 42);
-
-U = thelabel("$U$", z1);
-XY = thelabel("$X\times_ZY$", origin);
-X = thelabel("$X$", (x2, 0));
-Y = thelabel("$Y$", (0, y2));
-Z = thelabel("$Z$", z2);
-
-forsuffixes @=U, XY, X, Y, Z: draw @; endfor
-
-ahangle := 20;
-vardef curved_connect@#(expr s, a, b, d) =
- save line, mark;
-
- path line;
- line = center a {d} .. center b;
- interim bboxmargin := 4;
- drawarrow line cutbefore bbox a cutafter bbox b;
-
- picture mark;
- mark = thelabel@#("$\scriptstyle " & s & "$", point 1/2 of line);
- interim bboxmargin := 1;
- unfill bbox mark; draw mark;
-enddef;
-
-vardef connect@#(expr s, a, b) =
- curved_connect@#(s, a, b, center b - center a)
-enddef;
-
-connect.bot("p", XY, X);
-connect.rt ("q", XY, Y);
-connect.top("g", Y, Z);
-connect.lft("f", X, Z);
-
-curved_connect.urt("x", U, X, right);
-curved_connect.llft("y", U, Y, dir -80);
-
-drawoptions(dashed withdots scaled 1/2);
-connect("(x,y)", U, XY);
-drawoptions();
-\end{smallcode}
-\noindent\textit{\small This example assumes you are using "mplibtextextlabel" – §\ref{ttlabel}}
+\mpexternal[firstline=6,lastline=42,xleftmargin=0pt,xrightmargin=-20pt]{cd-xypic-example.mp}
+\noindent
+\textit{\small This example assumes you are using "mplibtextextlabel" – §\ref{ttlabel}}
\vss}}
The approach taken for both examples is first to define the node labels as pictures
placed as needed, and then write a special-purpose "connect" macro to make
consistent arrows between the nodes, using \mpl{center}, \mpl{bbox},
-\mpl{cutbefore}, and \mpl{cutafter} as appropriate.
+\mpl{cutbefore}, and \mpl{cutafter} as appropriate.
The $X\times_ZY$ example needs two variations. The "curved_connect" macro
takes a string for the label, the two nodes to be connected, and the initial
@@ -7397,313 +5661,32 @@
For the $f^*E$ example, "connect" is simpler, because all the arrows are
straight and there are no labels, but needs to allow for arrows crossing:
-\begin{smallcode}
-vardef connect(expr a, b) =
- save line; path line; interim bboxmargin := 4;
- line = center a .. center b cutbefore bbox a cutafter bbox b;
- cutdraw line withpen pencircle scaled 4 withcolor background;
- drawarrow line
-enddef;
-\end{smallcode}
+\mpexternal[firstline=26,lastline=31]{cd-tikzcd-example.mp}
\newpage
-\section{Tilings and tessellations}
+\section{Recursion and iteration}
-\textsc{In mathematical terms}, a “tiling” is a countable set of tiles
-that cover the plane without gaps or overlaps.\footnote{Adapted from \textsl{Tilings
-and Patterns}, Branko Grünbaum \& G.\@ C.\@ Shephard, Freeman, 1987}
-This section loosely follows that idea, and presents some ideas and general
-techniques for creating tilings and other patterns or textures.
+\vpic{10pt}{rec-bush}
-You can make an effective grid by drawing repeated lines and then clipping to the
-size you want:\mpic{-42pt}{tiling-simple}
-\begin{code}
-for i = -10 upto 10:
- draw (left--right) scaled 200 shifted (0, 20i);
- draw (down--up) scaled 200 shifted (20i, 0);
-endfor
-clip currentpicture to fullcircle scaled 200;
-\end{code}
-but this is a bit limited. If you want to produce more interesting tilings, you
-need to define a unit shape or picture, and a pair of vectors to repeat it.
-\begin{code}
-path unit; pair u, v; color a, b;
-unit = unitsquare scaled 24;
-u = point 1 of unit - point 0 of unit;
-v = point 3 of unit - point 0 of unit;
-a = 3/4[red, white]; b = 3/4[blue, white];
-for i=-5 upto 5:
- for j=-5 upto 5:
- fill unit shifted (i*u + j*v)
- withcolor if odd (i+j): a else: b fi;
- draw unit shifted (i*u + j*v);
- endfor
-endfor
-clip currentpicture to fullcircle scaled 200;
-\end{code}
-In tilings with more complex shapes you may find that using \mpl{fill} and
-\mpl{draw} in the same loop causes uneven lines because the fill overlaps part of
-the line. In these cases it is a good idea to duplicate the loops; use the first
-set for filling, the second for drawing.
-
-\newpage
-\subsection{Tiling with regular polygons}\label{sec:regtiling}
-
-\textsc{After tiling with squares}, the two simplest tilings are with triangles and
-hexagons\mwpic{-24pt}{tiling-hex-trig}
-(using the regular polygons from §\ref{polygons}). The basic loop is the same as the
-previous page except
-that the vectors $u$ and $v$ are now at 60° to each other (as shown in blue and
-red in the examples to the right). All of these examples where drawn with the same
-basic loop as before:
-\begin{code}
-for i = -n upto n:
- for j = -n upto n:
- draw P shifted (i * u + j * v);
- endfor
-endfor;
-\end{code}
-In the first row, $P$ was set to a simple polygon path:
-\begin{code}
-triangle = for i=0 upto 2: (0, 16) rotated 120i -- endfor cycle;
-hexagon = for i=0 upto 5: (0, 16) rotated 60i -- endfor cycle;
-\end{code}
-The vectors $u$ (in red) and $v$ (in blue) were defined as (for both tilings):
-\begin{code}
-u = point 0 of triangle - point 1 of triangle;
-v = u rotated -60;
-\end{code}
-To make the coloured versions, $P$ was defined as an appropriate \<picture>.
-For the triangular tiling, it looked like this: $\vcenter{
-\begin{mplibcode}
-input colorbrewer-rgb
-path t, tt;
-t = for i=0 upto 2: (0,8) rotated 120i --endfor cycle;
-tt = t reflectedabout(point 2 of t, point 0 of t);
- beginfig(0);
-fill t withcolor Reds 8 2; fill tt withcolor Blues 8 2; draw t; draw tt; endfig;
-\end{mplibcode}}$ so that the tiling actually filled the plane. In the hexagonal
-tiling there are no gaps to fill, but in order to get a non-adjacent colouring, the
-unit picture was defined as three shifted copies of the hexagon each filled with a
-different color. The unit vectors were therefore scaled by $\sqrt3$ and rotated by
-30° (as shown).
-
-The bottom row the unit pictures were replaced with drawings that connect the centre
-of each shape to the midpoint of each side (in red), like this:
-$$
-\begin{mplibcode}
-path p[]; input colorbrewer-rgb
-p3 = for i=0 upto 2: (0, 14) rotated 120i -- endfor cycle;
-p6 = for i=0 upto 5: (0, 14) rotated 60i -- endfor cycle;
-picture P[];
-for i=3,6:
- P[i] = image(
- for j=1 upto length p[i]:
- draw origin -- point j+1/2 of p[i] withcolor Reds 7 6;
- endfor
- draw p[i]);
-endfor
- beginfig(0); draw P3; draw P3 reflectedabout(point 0 of p3, point 2 of p3);
- draw P6 shifted (60, 3); endfig;
-\end{mplibcode}
-$$
-This has the effect of
-connecting the centres of adjacent shapes in the tiling, which reveals that each
-tiling is the dual of the other.
-
-\newpage
-\subsection{Separating filling and drawing}
-
-\textsc{Repeating a unit image} can sometimes cause unwanted overlaps, so as noted
-above, the solution is to make a filler unit and a drawing unit and do the filling
-first and the drawing second. In this example\mwpic{-32pt}{arch-4-8-8} the drawing
-unit (the octagon) is simple so you can just draw that path instead of making another
-\<picture> for it.
-\begin{smallcode}
-input colorbrewer-rgb
-path o, r[]; % o is the octagon, r[] are the "corners"
-o = (for i=0 upto 7: 21 dir 45i -- endfor cycle) rotated -90/4;
-pair t; t = whatever[point 0 of o, point 1 of o]
- = whatever[point 2 of o, point 3 of o];
-r1 = subpath (1,2) of o -- t -- cycle;
-r2 = r1 rotated 90;
-r3 = r2 rotated 90;
-r4 = r3 rotated 90;
-picture filler; filler = image(
- filldraw r1 withcolor Reds 8 3;
- filldraw r3 withcolor Reds 8 3;
- filldraw r2 withcolor Blues 8 3;
- filldraw r4 withcolor Blues 8 3;
- filldraw o withcolor Purples 8 2;
-);
-pair u, v;
-u = point 0 of o - point 5 of o; v = u rotated 90;
-beginfig(1);
-numeric n; n = 5;
-for i=-n upto n:
- for j=-n upto n:
- draw filler rotated ((i+j) mod 2 * 90) shifted (i*u + j * v);
- endfor
-endfor
-for i=-n upto n:
- for j=-n upto n:
- draw o shifted (i*u + j * v);
- endfor
-endfor
-\end{smallcode}
-Rotating every other \mpl{filler} allows you to get the alternate colours in the squares.
-\mpic{-60pt}{arch-4-8-8-parts}%
-Using \mpl{filldraw} ensures that there are no gaps between adjacent segments.
-
-\newpage
-\subsection{Tilings with more complex patterns}
-
-\textsc{The next example} also uses the square lattice,\mwpic{0pt}{arch-3-4-3-4}
-but the unit is more complicated, so the drawing needs two \<picture>
-variables, one for the colour fill and a second for the grid.
-\begin{smallcode}
-input colorbrewer-rgb
-path s[], t[];
-s1 = unitsquare scaled 21 rotated 15;
-s2 = s1 rotated 150;
-t1 = subpath (4, 3) of s1 -- point 1 of s2 -- cycle;
-t2 = t1 reflectedabout(point 1 of t1, point 2 of t1);
-t3 = t1 rotated 150;
-t4 = t1 rotated 210;
-picture color_unit, grid_unit;
-color_unit = image(
- fill s1 withcolor Oranges 8 1;
- fill s2 withcolor Oranges 8 2;
- fill t1 withcolor Blues 8 1;
- fill t2 withcolor Blues 8 2;
- fill t3 withcolor Blues 8 3;
- fill t4 withcolor Blues 8 4;
-);
-grid_unit = image(
- draw s1; draw s2;
- draw t2; draw t3; draw t4;
-);
-pair u, v;
-u = point 1 of s1 - point 1 of s2;
-v = u rotated 90;
-numeric n; n = 4;
-forsuffixes $=color_unit, grid_unit:
- for i=-n upto n:
- for j=-n upto n:
- draw $ shifted (i * u + j * v);
- endfor
- endfor
-endfor
-\end{smallcode}
-
-
-
-\newpage
-\subsection{Showing the dual tiling}
-
-\textsc{These tilings can be classified} by the configuration of the polygons that meet
-at each vertex. This one is $(3^4, 6)$ because each vertex has four triangles and one
-hexagon. It exists in two enantiomorph forms.\mxpic{-80pt}{3.6in}{arch-snub-hexagon}
-The unit pictures look like this:
-\par\bigskip
-\vbox{\halign{#&\qquad\qquad\vbox to 48pt{\hsize=2.7in\noindent #\par\vss}\cr
-\includegraphics[scale=0.75]{arch-snub-hexagon-unit}
-&\hey\itshape To reveal the dual of the tiling, you can draw a line from
-the median (or centroid if you prefer) of each polygon to the centre of each
-edge.\cr}}
-
-\bigskip
-\noindent They are drawn like this, where $h$ is the hexagon, $t_1 \dots\ t_6$ are the blue
-triangles surrounding it, and $t_7$ \& $t_8$ are the two “connecting” triangles,
-which swap sides to make the enantiomorphs.
-\begin{code}
-unit[k] = image(
- for i=1 upto 6:
- fill t[i] withcolor Blues 8 if odd i: 2 else: 3 fi;
- endfor
- for i=7 upto 8:
- fill t[i] withcolor Oranges 8 if odd i: 3 else: 2 fi;
- endfor
- fill h withcolor Oranges 8 2;
- forsuffixes S=h, t1, t2, t3, t4, t5, t6, t7, t8:
- draw S withpen pencircle scaled 1/4 withcolor 3/4;
- pair m; m = median(S);
- for i=1 upto length S:
- draw m -- point i - 1/2 of S withcolor 3/4;
- endfor
- endfor);
-\end{code}
-The $\id{median}()$ routine is from §\ref{polygons-given-side} and the colours are from
-§\ref{colorbrewer}. This tiling is generated using the loop-with-triangular-grid-vectors
-from §\ref{sec:regtiling}.
-
-\newpage
-\subsection{Tiling with a dynamic unit}
-
-\textsc{In order to reveal} patterns in a tiling, you might want to vary the colours
-or line styles used in each repeated drawing unit. In this case, you can write a
-macro that takes a parameter and returns a picture to draw.\mwpic{-36pt}{arch-3-4-6-4}
-
-\begin{smallcode}
-\mplibsetformat{metafun} % <-- for the "transparent" macro
-\begin{mplibcode}
-input colorbrewer-rgb
-beginfig(1);
-numeric r; r = 5;
-path d; d = for i=1 upto 12:
- (0, r) shifted (r * (sqrt(3)+2), 0) rotated 30i --
-endfor cycle;
-color shade[];
-shade0 = Oranges 8 3; shade2 = Greens 8 3;
-shade1 = Blues 8 3; shade3 = Reds 8 3;
-vardef unit(expr n) = image(
- fill d withcolor transparent (2, .9, shade[n mod 4]);
- draw d;
-) enddef;
-pair u, v;
-u = point 0 of d - point 3 of d;
-v = u rotated 60;
-numeric n; n = 6;
-for i=-n upto n:
- for j=-n upto n:
- draw unit(i*j) shifted ((i - floor(j / 2)) * u + j * v);
- endfor
-endfor
-clip currentpicture to unitsquare shifted -(1/2, 1/2) scaled (n * 9 r);
-endfig;
-\end{mplibcode}
-\end{smallcode}
-Instead of defining six triangles, six squares, and a hexagon, you can just define
-the dodecagon and overlap each one. Using a macro to create the unit, allows you to
-choose a different colour for each filler. Using the \mpl{transparent} macro from
-Metafun automatically mixes the colours for the overlaps. But the edges don't look
-so good, so you need to clip the whole picture to a neat square.
-
-
-\newpage
-\section{Recursion and iteration}
-
+\noindent
\textsc{This chapter is not a tutorial} on recursion or iteration \textit{per se}, but rather
more of an exploration of the \MP\ techniques you can use to create some particular types
-of drawing such as trees, plane-filling curves, non-periodic tilings, and fractals.\mwpic{-48pt}{rec-bush}
+of drawing such as trees, plane-filling curves, fractals, and some types of tiling pattern [§\ref{aperiodic}].
\medskip\noindent
-Even so,
-it is perhaps useful to review some of the basic programming ideas
-involved.
-Consider for example the greatest common divisor algorithm presented in
+Even so, it is perhaps useful to review some of the basic programming ideas
+involved. Consider for example the greatest common divisor algorithm presented in
§\ref{sec:gcd}.
-\begin{smallcode}
-vardef gcd(expr a, b) = if b = 0: a else: gcd(b, a mod b) fi enddef;
-\end{smallcode}
+\smallmpexternal[firstline=1,lastline=1]{rec-gcd-comparison.mp}
+\noindent
The reason this works is that we know (mathematically) that $0 \le a \bmod b < b$,
and therefore that the arguments to the recursive call must get smaller each time
and eventually we must get to $b=0$ when the answer will be $a$. This is the basic
recursive approach: ensure at least one argument gets smaller each time and stop
-when you get to a given limit.
+when you get to a given limit.
The examples in this chapter use one of two simple approaches:
\begin{itemize}
- \item Explicitly pass a \mpl{level} argument that is decremented on each
+ \item Explicitly pass a \mpl{level} argument that is decremented on each
recursive call, and stop the recursion when the level gets to zero
\item Pass a \<path> or two \<pair> arguments, and stop the recursion when the
path is too short or the pairs are too close together.
@@ -7710,14 +5693,8 @@
\end{itemize}
If you find recursion confusing, you can nearly always use an iterative approach
instead. For example, you can implement the \mpl{gcd} function like this:
-\begin{smallcode}
-vardef gcd(expr A, B) = save r, a, b; numeric a, b, r; a := A; b := B;
- forever:
- r := a mod b; exitif r = 0;
- a := b; b := r;
- endfor b
-enddef;
-\end{smallcode}
+\smallmpexternal[firstline=15,lastline=20]{rec-gcd-comparison.mp}
+\noindent
Notice that you have to use assignment in the loop to update the variables, and
that you cannot assign to the arguments of a macro. Notice also that this version
requires both arguments to be positive integers. You need to use your judgement to
@@ -7729,25 +5706,13 @@
\textsc{The Swedish mathematician} Helge von Koch\mpic{-30pt}{rec-koch-steps} originally devised the
Koch curve as an example of a non-differentiable curve that could be constructed with
elementary geometry. It makes a good introduction to recursive paths with \MP. The
-construction is recursive: each straight line segment in the path is replaced with
+construction is recursive: each straight line segment in the path is replaced with
four copies of itself, scaled down $\frac13$ and arranged as shown
at Level 1 \rightarrowfill\break
At each level of the construction, the number of points in the path increases
-four-fold and the \mpl{arclength} of the path gets $\frac43$ longer.
-\begin{code}
-vardef koch(expr level, a, b) =
- if level = 0:
- a -- b
- else:
- save p, q, r; pair p, q, r;
- p = 1/3[a,b]; r = 2/3[a,b]; q = r rotatedabout(p, 60);
- koch(level-1, a, p) &
- koch(level-1, p, q) &
- koch(level-1, q, r) &
- koch(level-1, r, b)
- fi
-enddef;
-\end{code}
+four-fold and the \mpl{arclength} of the path gets $\frac43$ longer.
+\mpexternal[firstline=7,lastline=18]{rec-koch-steps.mp}
+\noindent
The five levels were drawing using this function in a loop like this:
\begin{code}
for n=0 upto 4:
@@ -7768,38 +5733,25 @@
\subsection{Sierpinski's gaskets}
\textsc{The second example} of recursive construction also dates from the early 20th
-century, but unlike von Koch's infinite curve, the area of Sierpinski's gasket tends
+century, but unlike the infinite length of von Koch's curve, the area of Sierpinski's gasket tends
to zero.\mwpic{-12pt}{rec-sierpinski-triangle} In the original specification, you
are supposed to remove the central quarter of each triangle, but this program does
it the other way round and delays drawing the triangles until they are small enough.
-\begin{code}[xleftmargin=0pt, xrightmargin=-2in]
-vardef gasket(expr t, s, limit) =
- if length (point 1 of t - point 0 of t) < limit:
- fill t;
- else:
- save little_t; path little_t; little_t = t scaled s;
- for i=1 upto length t:
- gasket(little_t shifted (point i of t - point i of little_t), s, limit);
- endfor
- fi
-enddef;
-\end{code}
+\mpexternal[firstline=6,lastline=15,xleftmargin=0pt,xrightmargin=-72pt]{rec-sierpinski-triangle.mp}
+\noindent
Note the useful idiom \mpl{shifted (point i of t - point i of little_t)} – this
neatly tucks a copy of the small triangle into the appropriate corner of the big
triangle. You can make this even simpler by coding the scaling parameter $s$ and
-\id{limit} as constants in the recursive routine, so that you do not have to pass
+\id{limit} as constants in the recursive routine, so that you do not have to pass
them down each time. The triangular gasket was generated using the macro like this:
-\begin{code}[xleftmargin=0pt, xrightmargin=-2in]
-beginfig(1);
- path T; T = for i = 1 upto 3: 220 up rotated 120i -- endfor cycle;
- gasket(T, 1/2, 20);
-endfig;
-\end{code}
-You can generalize it, for example by making
+\mpexternal[firstline=16,lastline=19,xleftmargin=0pt,xrightmargin=-72pt]{rec-sierpinski-triangle.mp}
+\noindent
+You can generalize this idea, for example by making
the path \id{T} into a pentagon with scaling factor $s=(3-\sqrt5)/2$,
or a hexagon with $s=1/3$, and so on:
-\vbox to 0pt{\vskip-2pt\hsize10in\noindent\includegraphics[width=10in]{rec-sierpinski-pentagon.pdf}\par\vss}
+\vbox to
+0pt{\vskip-2pt\hsize10in\noindent\includegraphics[width=10in]{rec-sierpinski-garlands.pdf}\par\vss}
\newpage
\subsection{The Heighway dragon}
@@ -7815,32 +5767,15 @@
Note that every other segment is flipped left and right. At each stage, the number of points
increases two-fold and the path gets $\sqrt2$ times longer. Here is a recursive
routine to generate the curve as a single path.
-\begin{smallcode}
-numeric r, theta; r = sqrt 1/2; theta = 45;
-vardef dragon(expr level, a, b) =
- if level > 0:
- save p; pair p;
- p = r[a, b] rotatedabout(a, theta);
- dragon(level - 1, a, p) & reverse dragon(level - 1, b, p)
- else:
- a .. b
- fi
-enddef;
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=15]{rec-dragon.mp}
+\noindent
The blue dragon was created with: {\small\mpl{draw dragon(15, origin, 240 right)}}\rlap{\raise1ex\hbox{\ $\smash{\nearrow}$}}
After the fourth level the corners of the curve start to touch each
other, but they never cross. You can see this if you draw the curve with rounded
corners.
-\begin{smallcode}
-vardef rounded_corners expr p =
- save r, n; numeric r, n; r = 1/3; n = length p;
- subpath (0, 1-r) of p
- for t=1 upto n-1:
- .. subpath (t+r, t+1-r) of p
- endfor .. subpath (n-r, n) of p
-enddef;
-\end{smallcode}
+\smallmpexternal[firstline=17,lastline=23]{rec-dragon.mp}
+\noindent
The red dragon was: {\small\mpl{draw rounded_corners dragon(10, origin, 240
right)}}\rlap{\hbox{\ $\smash{\longrightarrow}$}}
@@ -7852,7 +5787,7 @@
\newpage
\subsection{Iterative dragons}
-\textsc{The dragon curve} can also be created with iteration instead of recursion.
+\textsc{The dragon curve} can also be created with iteration instead of recursion.
Another way of viewing the stages of developing the curve is that at each stage the
whole curve is replaced by two copies of itself arranged as shown:
@@ -7861,16 +5796,8 @@
\smallskip\noindent
We can do this in two steps in a loop, like this:\mpic{-160pt}{ifs-heigh}
-\begin{smallcode}
-path p; p = origin -- dir 30;
-numeric n;
-for i=1 upto 12:
- n := length p;
- p := p rotated 45;
- p := p & reverse p rotatedabout(point n of p, 90);
-endfor
-draw p scaled (384 / xpart (urcorner p - llcorner p));
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=13,xleftmargin=0pt]{ifs-heigh.mp}
+\noindent
In this approach, instead of scaling down each time, the curve is just allowed to
grow $\sqrt2$-times bigger in each loop, then scaled to the desired width
(384\unit{pt}) when it is complete. The 12 stages in the loop produce the rotated blue
@@ -7878,15 +5805,8 @@
\vfill\noindent
With a small adaptation, you can also use this to explore variations.
-\begin{smallcode}
-path p; p = origin -- dir 30;
-numeric n, r; r = 3;
-for i=1 upto 12:
- n := length p;
- p := p rotated (45 - r);
- p := p & reverse p rotatedabout(point n of p, 90 + 2r);
-endfor
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=13,xleftmargin=0pt]{ifs-heigh-open.mp}
+\noindent
The extra parameter $r$ is used to open up the folds, making it more
“organic”.\mpic{-200pt}{ifs-heigh-open}
@@ -7893,33 +5813,26 @@
\newpage
\subsection{The golden dragon}
-\textsc{You can also explore variations} with the recursive approach by altering
-the scaling and rotation. Here $r\simeq 0.74274$ and
-$\theta\simeq 32.893°$ in the initial triangle.\vadjust{\moveright136pt\vbox to
-0pt{\vskip 3.16in \hsize 3.6in \noindent
+\textsc{You can explore variations} with the recursive approach by altering
+the scaling and rotation. Here $r=1/\phi^{1/\phi}\simeq 0.74274$ and
+$\theta\simeq 32.893°$ in the initial triangle.
+
+\medskip
+\vbox to 3in{\noindent\hbox to \textwidth{\includegraphics{rec-dragon-golden.pdf}\hss}\vss}
+
+\moveright136pt\vbox to 0pt{\hsize 3.6in \noindent
Because the initial triangle shape is shorter on one side, it is better to adapt
the \mpl{dragon} routine to measure the gap between points instead of using a fixed
level parameter:
-\begin{smallcode}
-vardef dragon(expr a, b) =
- if abs(a-b) > 1:
- save p; pair p;
- p = r[a, b] rotatedaround(a, theta);
- dragon(a, p) & reverse dragon(b, p)
- else:
- a .. b
- fi
-enddef;
-\end{smallcode}
-\vss}}
-$$\hbox to \textwidth{\includegraphics{rec-dragon-golden.pdf}\hss}$$
+\smallmpexternal[firstline=12,lastline=20]{rec-dragon-golden.mp}
+\vss}
\newpage
\subsection{The Peano-Gosper curve, or flow-snake}
-\textsc{The Peano-Gosper curve} is a space-filling curve. It is
-constructed in the same way as the dragons, but generating shape has seven sections
-instead of two, and they are cunningly arranged to fill the space.\mpic{-48pt}{rec-flowsnake-construction}
+\textsc{The Peano-Gosper curve} is a space-filling curve. It is
+constructed in the same way as the dragons, but the generating shape has seven sections
+instead of two, and they are cunningly arranged to fill the space.\mpic{-72pt}{rec-flowsnake-construction}
The arrows indicate the reversals so that the scaled-down copies fill the larger
part of the hexagons that contain them.\rlap{\hbox{\ $\smash{\rightarrow}$}}
$$\includegraphics[width=\textwidth]{rec-flowsnake}$$
@@ -7927,25 +5840,9 @@
\vadjust{\moveright 384pt \vbox to 0pt{\vss\hsize 4in
\noindent Given the \id{snake} path scaled to unit length as shown above in
\red{red}, the
-flow-snake path can be created with:
-\begin{smallcode}
-vardef rattle(expr level, a, b) =
- if level > 0:
- save s; path s; s = snake zscaled (b-a) shifted a;
- reverse rattle(level - 1, point 1 of s, a) &
- rattle(level - 1, point 1 of s, point 2 of s) &
- rattle(level - 1, point 2 of s, point 3 of s) &
- rattle(level - 1, point 3 of s, point 4 of s) &
- reverse rattle(level - 1, point 5 of s, point 4 of s) &
- reverse rattle(level - 1, point 6 of s, point 5 of s) &
- rattle(level - 1, point 6 of s, b)
- else:
- a -- b
- fi
-enddef;
-path S; S = rattle(4, origin, 360 right);
-\end{smallcode}
-}}
+flow-snake on the left was created with
+\smallmpexternal[firstline=18,lastline=38]{rec-flowsnake.mp}
+\vskip -48pt}}
\newpage
\subsection{Fractal trees}
@@ -7955,7 +5852,7 @@
then make the first branch by scaling the trunk by $r$, rotating it $+\theta$, and
moving it to the top of the trunk; make the second in the same way but rotate it by
$-\theta$. Then repeat using each branch as a new trunk.\mpic{-114pt}{rec-simple-tree}
-And stop after enough levels.
+And stop after enough levels.
This can be implemented easily in \MP, but requires a
slightly different technique. There is no simple way to represent the tree as a single
@@ -7962,65 +5859,24 @@
\<path> because a path cannot have branches, so
you need to draw each segment separately instead of trying to join them up. Compare
this to the \mpl{rattle} routine on the page before.
-\begin{code}
-vardef make_tree(expr level, bar) =
- draw bar;
- if level > 0:
- for t=-theta, theta:
- make_tree(level - 1, bar shifted - point 0 of bar
- scaled r rotated t shifted point 1 of bar);
- endfor
- fi
-enddef;
-\end{code}
+\mpexternal[firstline=7,lastline=16]{rec-simple-tree.mp}
+\noindent
To combine several such trees in a drawing either move the initial \id{bar} path, or
capture the tree as a \<picture> using \mpl{image(make_tree(...))}, like so:
-\begin{code}
-picture T[]; numeric r, theta;
-r = 0.58; theta = 60; T1 = image(
- make_tree(3, origin -- 100 up);
-);
-% update r and theta...
-r := 0.75; theta := 14; T2 = image(
- make_tree(10, origin -- 100 up);
-);
-draw T1 shifted 32 up;
-draw T2 shifted 128 right;
-\end{code}
+\mpexternal[firstline=18,lastline=26]{rec-simple-tree.mp}
+\noindent
Notice that $r$ and $\theta$ are treated as global constants. You could pass them
to the \mpl{make_tree} routine instead. Notice also that the smaller tree only has
-three levels, but the larger one has 10. And that the labels were omitted.
+three levels, but the larger one has 10.
\newpage
-\subsubsection{More fractal vegetation}
+\subsubsection*{More fractal vegetation}
\textsc{If you are more interested} in the visual aspect of your tree than the
mathematical, you can tweak the \mpl{make_tree} routine a
bit.\mpic{-12pt}{rec-general-tree}
-\begin{smallcode}[xleftmargin=0pt]
-vardef make_tree(expr bar) =
- save a; numeric a; a = abs(point 1 of bar - point 0 of bar);
- cutdraw bar withpen pencircle scaled 1.2(1/8 a) withcolor background;
- cutdraw bar withpen pencircle scaled (1/8 a) withcolor 1/256(57, 35, 32);
- if a > leaf:
- save s; pair s;
- s = 1/32 a * r * unitvector(direction 1 of bar) rotated 90;
- make_tree(bar shifted - point 0 of bar
- shifted s scaled r rotated theta
- shifted point 1 of bar);
- make_tree(bar shifted - point 0 of bar
- shifted -s scaled r rotated -theta
- shifted point 1 of bar);
- else:
- draw point 1 of bar withpen pencircle scaled 1 withcolor 2/3 green;
- fi
-enddef;
-beginfig(1);
- numeric leaf, r, theta;
- r = 0.75; theta = 14; leaf = 3;
- make_tree(origin -- 100 up);
-endfig;
-\end{smallcode}
+\smallmpexternal[firstline=6,lastline=31,xleftmargin=0pt]{rec-general-tree.mp}
+\noindent
\begin{itemize}
\item The recursion is controlled by measuring the length of the branches instead
of using a \id{level} parameter.
@@ -8032,7 +5888,7 @@
\end{itemize}
\newpage
-\subsubsection{Randomized recursive plants}
+\subsubsection*{Randomized recursive plants}
\vskip-\baselineskip
\noindent\hbox to \linewidth{\includegraphics{rec-general-tree-deviate}\hss}
@@ -8040,154 +5896,320 @@
\noindent
\textsc{To get plants that look more natural} you can introduce some random factors.
Strictly these are not fractal because they are not
-self-similar. The only change from the previous \mpl{make_tree} is to replace
-\mpl{scaled r rotated theta} with
-\begin{smallcode}[xleftmargin=0pt]
-scaled (r + 1/16 normaldeviate) rotated (theta + 8 normaldeviate)
-\end{smallcode}
-The bush is similar, except that it splits into four branches at each step instead of
-two and only the lengths randomized.\mwpic{-96pt}{rec-bush}
+self-similar. The only change from the previous \mpl{make_tree} was to replace
+\mpl{scaled r rotated theta} with
+\smallmpexternal[firstline=17,lastline=17,xleftmargin=0pt]{rec-general-tree-deviate.mp}
+
+\vfill\noindent
+\textsc{The bush} is similar, except that it splits into four branches at each step instead of
+two and only the lengths are randomized.\mwpic{-96pt}{rec-bush}
The colouring was a happy accident.
-\begin{smallcode}[xleftmargin=0pt, xrightmargin=-100pt]
+\mpexternal[firstline=8,lastline=17,xleftmargin=0pt,xrightmargin=-150pt]{rec-bush.mp}
+
+\newpage
+\section{Periodic tilings}
+
+\textsc{In mathematical terms}, a “tiling” is a countable set of tiles
+that cover the plane without gaps or overlaps.\footnote{Adapted from \textsl{Tilings
+and Patterns}, Branko Grünbaum \& G.\@ C.\@ Shephard, Freeman, 1987}
+A \textit{periodic} tiling is one that consists of a unit shape or pattern that is
+repeated by translation in two dimensions.\vadjust{\moveright5.5in\vbox to
+0pt{\hsize4in\vskip -60pt
+\centerline{For notes on drawing \textit{aperiodic} tilings, see below in §\ref{aperiodic}}\vss}}
+This section loosely follows that idea, and presents some ideas and general
+techniques for creating tilings and other patterns or textures. ——
+You can make an effective grid by drawing repeated lines and then clipping to the
+size you want:\mpic{-42pt}{tiling-simple}
+\mpexternal[firstline=8,lastline=12,xleftmargin=0pt,xrightmargin=-12pt]{tiling-simple.mp}
+\noindent
+but this is a bit limited. If you want to produce more interesting periodic
+tilings, you need to define a unit shape or picture, and a pair of vectors to repeat it.
+\mpexternal[firstline=16,lastline=28,xleftmargin=0pt,xrightmargin=-12pt]{tiling-simple.mp}
+\noindent
+In tilings with more complex shapes you may find that using \mpl{fill} and
+\mpl{draw} in the same loop causes uneven lines because the fill overlaps part of
+the line. In these cases it is a good idea to duplicate the loops; use the first
+set for filling, the second for drawing.
+
+\newpage
+\subsection{Tiling with regular polygons}\label{sec:regtiling}
+
+\textsc{After tiling with squares}, the next two simplest tilings use triangles and
+hexagons\mwpic{-24pt}{tiling-hex-trig}
+(made using the routines from §\ref{polygons}). The basic loop is the same as the
+previous page except
+that the vectors $u$ and $v$ are now at 60° to each other (as shown in blue and
+red in the examples to the right). All of these examples were drawn with the same
+basic loop as before:
+\mpexternal[firstline=11,lastline=15,xleftmargin=0pt]{tiling-hex-trig.mp}
+\noindent
+In the first row, $P$ was set to a simple polygon path:
+\mpexternal[firstline=28,lastline=29,xleftmargin=0pt]{tiling-hex-trig.mp}
+\noindent
+The vectors $u$ (in red) and $v$ (in blue) were defined as (for both tilings):
+\mpexternal[firstline=31,lastline=32,xleftmargin=0pt]{tiling-hex-trig.mp}
+\noindent
+To make the coloured versions, $P$ was defined as an appropriate \<picture>.
+For the triangular tiling, it looked like this: $\vcenter{
+\begin{mplibcode}
input colorbrewer-rgb
-vardef bush(expr start, aim, level, limit) =
- save s, target; numeric s; pair target; s = level / limit;
- for a = -32, -8, 8, 16:
- target = aim scaled ((32 + 16 normaldeviate) * s) rotated a shifted start;
- draw start -- target withpen pencircle scaled s withcolor BrBG[limit][limit-level];
- if level > 1: bush(target, aim rotated a, level - 1, limit); fi
- endfor
-enddef;
-beginfig(1); bush(origin, dir 80, 6, 8); endfig;
-\end{smallcode}
+path t, tt;
+t = for i=0 upto 2: (0,8) rotated 120i --endfor cycle;
+tt = t reflectedabout(point 2 of t, point 0 of t);
+fill t withcolor Reds 8 2; fill tt withcolor Blues 8 2; draw t; draw tt;
+\end{mplibcode}}$ so that the tiling actually filled the plane. In the hexagonal
+tiling there are no gaps to fill, but in order to get a non-adjacent colouring, the
+unit picture was defined as three shifted copies of the hexagon each filled with a
+different color. The unit vectors were therefore scaled by $\sqrt3$ and rotated by
+30° (as shown).
+The bottom row the unit pictures were replaced with drawings that connect the centre
+of each shape to the midpoint of each side (in red), like this:
+$$
+\begin{mplibcode}
+path p[]; input colorbrewer-rgb
+p3 = for i=0 upto 2: (0, 14) rotated 120i -- endfor cycle;
+p6 = for i=0 upto 5: (0, 14) rotated 60i -- endfor cycle;
+picture P[];
+for i=3,6:
+ P[i] = image(
+ for j=1 upto length p[i]:
+ draw origin -- point j+1/2 of p[i] withcolor Reds 7 6;
+ endfor
+ draw p[i]);
+endfor
+ draw P3; draw P3 reflectedabout(point 0 of p3, point 2 of p3);
+ draw P6 shifted (60, 3);
+\end{mplibcode}
+$$
+This has the effect of
+connecting the centres of adjacent shapes in the tiling, which reveals that each
+tiling is the dual of the other.
+
\newpage
-\subsection{Penrose tilings}
+\subsection{Separating filling and drawing}
-\textsc{Recursion is useful} for generating non-periodic tilings,%
-\vadjust{\moveright5.5in\vbox to 0pt{\kern-8pt
-\begin{smallcode}
-% golden ratio constant
-numeric psi; psi = (sqrt 5 - 1) / 2;
+\textsc{Repeating a unit image} can sometimes cause unwanted overlaps, so as noted
+above, the solution is to make a filler unit and a drawing unit and do the filling
+first and the drawing second. In this example\mwpic{-32pt}{tiling-arch-4-8-8} the drawing
+unit (the octagon) is simple so you can just draw that path instead of making another
+\<picture> for it.
+\mpexternal[firstline=5,lastline=31]{tiling-arch-4-8-8.mp}
+\noindent
+Rotating every other \mpl{filler} allows you to get the alternate colours in the squares.
+\mpic{-60pt}{tiling-arch-4-8-8-parts}%
+Using \mpl{filldraw} ensures that there are no gaps between adjacent segments.
-% inflating tall shape makes two others
-vardef inflate_tall(expr level, a, b, c) =
- if level = 0:
- draw a--b--c withpen pencircle scaled 1/8;
- else:
- save d; pair d; d = psi[b,a];
- inflate_tall(level - 1, d, c, a);
- inflate_wide(level - 1, c, d, b);
- fi
-enddef;
+\newpage
+\subsection{Tilings with more complex patterns}
-% inflating wide makes three
-vardef inflate_wide(expr level, a, b, c) =
- if level = 0:
- draw a--b--c withpen pencircle scaled 1/8;
- else:
- save d, e; pair d, e; d = psi[a,b]; e = psi[a,c];
- inflate_tall(level - 1, d, e, b);
- inflate_wide(level - 1, e, d, a);
- inflate_wide(level - 1, c, e, b);
- fi
-enddef;
+\textsc{The next example} also uses the square lattice,\mwpic{0pt}{tiling-arch-3-4-3-4}
+but the unit is more complicated, so the drawing needs two \<picture>
+variables, one for the colour fill and a second for the grid.
+\mpexternal[firstline=7,lastline=36,xleftmargin=0pt]{tiling-arch-3-4-3-4.mp}
-% start with a tall triangle with apex at origin
-pair a, b, c;
-b = origin;
-c = (sind(18), sind(72)) scaled 800;
-a = (-xpart c, ypart c);
+\newpage
+\subsection{Showing the dual tiling}
-% make an inflated "wedge"
-picture P; P = image(inflate_tall(7, a, b, c));
+\textsc{These tilings can be classified} by the configuration of the polygons that meet
+at each vertex. This one is $(3^4, 6)$ because each vertex has four triangles and one
+hexagon. It exists in two enantiomorph forms.\mpic{-80pt}{tiling-arch-snub-hexagon}
+The unit pictures look like this:
+\par\bigskip
+\vbox{\halign{#&\qquad\qquad\vbox to 48pt{\hsize=2.7in\noindent #\par\vss}\cr
+\includegraphics[scale=0.75]{tiling-arch-snub-hexagon-unit}
+&\hey\itshape To reveal the dual of the tiling, you can draw a line from
+the centroid of each polygon to the midpoint of each edge.\cr}}
-% then exploit the five-fold symmetry to make the picture
-for t = 0 upto 9:
- draw P if odd t: reflectedabout(b, c) fi rotated 72t;
-endfor;
-\end{smallcode}
+\bigskip
+\noindent They are drawn like this, where $h$ is the hexagon, $t_1 \dots\ t_6$ are the blue
+triangles surrounding it, and $t_7$ \& $t_8$ are the two “connecting” triangles,
+which swap sides to make the enantiomorphs.
+\mpexternal[firstline=23,lastline=37,xleftmargin=0pt]{tiling-arch-snub-hex-parts.mp}
+\noindent
+The $\id{centroid}()$ routine is from §\ref{polygons} and the colours are from
+§\ref{colorbrewer}. This tiling is generated using the loop-with-triangular-grid-vectors
+from §\ref{sec:regtiling}.
-\qquad\hey \textit{\small Colouring the tiling is left as an exercise for the
-reader.}\par\vss}}
-like those discovered in the 1970s by the British polymath Sir Roger Penrose.
-$$\includegraphics[width=\textwidth]{penrose-P3.pdf}$$
-By definition, there is no periodic unit to repeat; but there are well-known
-expansion rules to split each shape in the tiling into smaller congruent copies. So
-you can start with a single large shape and apply the rules recursively to make the
-tiling. The tiling above is made from two rhombus shapes, but each of these shapes can be
-split in half into two triangles, and the expansion process actually works on these:
-$$\includegraphics{penrose-stages.pdf}$$
+\newpage
+\subsection{Tiling with a dynamic unit}
+\textsc{In order to reveal} patterns in a tiling, you might want to vary the colours
+or line styles used in each repeated drawing unit. In this case, you can write a
+macro that takes a parameter and returns a picture to draw.\mwpic{-48pt}{tiling-arch-3-4-6-4}
+\smallmpexternal[firstline=6,lastline=30]{tiling-arch-3-4-6-4.mp}
+\noindent
+Instead of defining six triangles, six squares, and a hexagon, you can just define
+the dodecagon and overlap each one. Using a macro to create the unit, allows you to
+choose a different colour for each filler. Using the transparency support from
+"luamplib" automatically mixes the colours for the overlaps. But the edges don't look
+so good, so you need to clip the whole picture to a neat square.
+
+\newpage
+\subsection{Colouring with a set number of colours}
+
+\textsc{This “attractive and ingenious” pattern of squares} is given in Grünbaum \&
+Shephard, chapter 8, and is shown here coloured with three colours so that no two
+squares with the same colour touch each other.\mpic{-12pt}{tiling-pp48a}
+
+\mpexternal[firstline=7,lastline=26,xleftmargin=0pt]{tiling-pp48a.mp}
+\noindent
+The points of interest here are
+\begin{itemize}
+ \item The use of the \mpl{sind} function to position the square in the unit so
+ that it makes the six-pointed star when rotated.
+ \item The expression “\mpl{t mod 3 + 3}” which cycles through 3, 4, and 5 for
+ different values of $t$.
+\end{itemize}
+Many different colourings are possible but you might need to make a more complex
+unit drawing for some of them.
+
+
+\newpage
+\section{Aperiodic tilings}\label{aperiodic}
+
+\textsc{Mathematical research in the 1960s and 1970s} established that it is also
+possible to tile an infinite plane with polygons that do not have any periodic
+repeating pattern. There are various mathematical approaches to creating these
+tilings; this section explores substitution tilings, which lend themselves to
+recursive programming. The rules for a substitution define a dissection for each
+shape that makes up the tiling.
+
+The idea is to define a recursive macro for each shape in the tiling, with
+parameters for the recursion level and points that define the shape. If
+$\id{level}=0$, draw or decorate that particular shape, otherwise work out
+the points for the dissection and call the appropriate macros for each shape with
+$level-1$. Here is an example:\mpic{-123pt}{tiling-subs-triangle.pdf}
+
+\mpexternal[firstline=7,lastline=28]{tiling-subs-triangle.mp}
+
\vbox to 0pt{\noindent
-Each expansion of half the thick rhombus, produces two more thick halves and one
-thin half; each expansion of half the thin rhombus produces a thick half and a thin
-half. No other shapes are produced, so the recursive process can be repeated
-indefinitely. At the desired lowest level the triangles are patched back into
-rhombus shapes simply by \textit{not} drawing the edges shown with dots.\par\vss}
+These procedures are illustrated on the right. The completed
+tiling was drawn with \mpl{tall(6, 173 dir 210, 173 dir 330, 173 dir 90)}.
+\par\vss}
\newpage
\subsection{Pinwheel tiling}
-\textsc{Another non-periodic tiling} is the so-called pinwheel tiling, devised in 1994
+\textsc{The second aperiodic tiling example} is the so-called pinwheel tiling, devised in 1994
by Charles Radin, based on
-this dissection by John Conway.\mpic{-22pt}{pinwheel}
-$$\includegraphics{conway.pdf}$$
+this dissection by John Conway.\mpic{-22pt}{tiling-subs-pinwheel}
+$$\includegraphics[scale=0.8]{tiling-conway}$$
Starting with a triangle of this shape, the tiling recursively divides into
five smaller copies of itself. The colouring is passed down each level but only used
on the lowest.
-\begin{smallcode}
-input colorbrewer-rgb
-vardef pinwheel(expr level, a, b, c, s) =
- if level = 0:
- fill a--b--c--cycle withcolor s;
- draw a--b--c--cycle withpen pencircle scaled 1/8 withcolor white;
- else:
- save d, e, f, g; pair d, e, f, g;
- d = 2/5[b, c]; e = 4/5[b,c]; f = 1/2[e, a]; g = 1/2[a, b];
- pinwheel(level - 1, e, a, c, Blues 9 4);
- pinwheel(level - 1, f, g, a, Blues 9 3);
- pinwheel(level - 1, f, g, e, Blues 9 2);
- pinwheel(level - 1, d, e, g, Blues 9 5);
- pinwheel(level - 1, d, b, g, Blues 9 6);
- fi
-enddef;
-beginfig(1);
- pinwheel(5, origin, 200 right, 100 up, "");
- pinwheel(5, (200,100), 100 up, 200 right, "");
-endfig;
-\end{smallcode}
-Notice that to make the dissection work, it is important to pass the three
-\<pair> arguments in the right order.
+\smallmpexternal[firstline=1,lastline=15]{tiling-pinwheel-macro.mp}
+\vskip -\baselineskip
+\smallmpexternal[firstline=7,lastline=14]{tiling-subs-pinwheel.mp}
+
+\enlargethispage{24pt}
+
+\noindent
+\hey To make the dissection work, it is important to pass the three
+\<pair> arguments in the right order. Note also the manipulation of
+\mpl{currentpicture} at the end.
+
\newpage
-\tableofcontents
+\subsection{Ammann A5 tiling}
+\textsc{Of the various sets} of aperiodic tiles discovered by Robert Ammann in 1977,
+the best known and probably most attractive is the set known as A5. The recursive
+substitutions for the tiling are usually given as follows,
+
+\smallskip
+\centerline{\includegraphics{tiling-ammann-substitutions-overlapping.pdf}}
+\smallskip\noindent
+with the square shapes overlapping the edges of the parent shapes. This can be
+implemented with two co-operating recursive macros \rightarrowfill
+\vadjust{\moveright384pt\vbox to 0pt{\vskip -138pt
+\centerline{\small\textit{This needs the \mpl{withalpha} macro given in §\ref{sec:transparent}}.}
+\smallmpexternal[firstline=10, lastline=48, xleftmargin=0pt, xrightmargin=-30pt]{tiling-ammann-procedures.mp}
+\vss}}
+
+The overlaps mean that much of the tiling is overlaid by other expansions which
+makes the resulting PDF rather large, and that you need to clip the final picture to
+the original shape. The uneven texture is apparent if you colour the tiles with
+transparent colours (although this is not unattractive):
+
+\noindent
+\vbox to 0pt{\noindent
+\centerline{\includegraphics{tiling-ammann.pdf}}
+\vss}
+
\newpage
-\section*{To do...}
+\subsection{Ammann A5 tiling improved}
-- angle marks, including curved angle marks
+\textsc{With some extra thought}, you can devise a substitution pattern that avoids
+the overlaps and makes a smaller tiling. The idea is to split the square in half,
+and make a macro that can do the top half or the bottom half as required.
-- drawing knots, double lines, ropes
+\smallskip
+\centerline{\includegraphics{tiling-ammann-substitutions-bounded.pdf}}
+\smallskip\noindent
+This requires an extra parameter for the new "half_square" macro to tell it which
+half to do, and two triangular paths for the upper and lower halves. Note that
+the second of these paths is reversed, which simplifies the macro.
+\vadjust{\moveright384pt\vbox to 0pt{\vskip -172pt
+\smallmpexternal[firstline=10, lastline=14, xleftmargin=0pt, xrightmargin=-30pt]{tiling-ammann-procedures.mp}
+\smallmpexternal[firstline=50, lastline=81, xleftmargin=0pt, xrightmargin=-30pt]{tiling-ammann-procedures.mp}
+\vss}}
-- decorating lines
+Now there is no overlapping of any of the tiles and the tiling does not overflow outside the original
+shape, and the colouring is uniform.
+$$\includegraphics[width=\textwidth]{tiling-ammann-bounded.pdf}$$
+In general, aperiodic tilings work best if you can find a set of recursive
+substitutions that are bounded within each parent shape.
-- the eye, hand
+\noindent\hey{\small Notice also the useful idiom \mpl{zscaled (b-a) shifted a} used
+with a “unit” shape.}
-- physics diagrams, pendulum, indicating movement and vibration
+\newpage
+\subsection{Penrose P2 tiling}
-- examining a glyph
+\textsc{The same techniques are useful} for generating the well-known aperiodic
+tilings discovered in the 1970s by the British polymath Sir Roger Penrose.
+This P2 tiling is also known as the “kite and dart” tiling.
+\vadjust{\moveright384pt\vbox to 0pt{\vskip
+-36pt\smallmpexternal[firstline=7, lastline=46, xleftmargin=0pt]{tiling-penrose-tatham-p2-kite-dart.mp}\vss}}
+The expansion rules used here are those documented by Simon Tatham.
+$$\includegraphics{tiling-penrose-tatham-p2-kite-dart-construction.pdf}$$
+Each of the shapes is split into two opposite triangles and the expansion rules
+applied separately. Only part of the edge of each triangle is drawn, so that the
+proper shapes appear in the final result. The patch below was clipped to a
+rectangle.
-- all sorts of arrow, arrows between arrows, arrows next to a path (handles)
+\bigskip
+\vbox to 2.4in{\noindent
+\includegraphics[width=\textwidth]{tiling-penrose-tatham-p2-kite-dart.pdf}
+\vss}
+\newpage
+\subsection{Penrose P3 tiling}
-- faking 3d
+\textsc{The final example} is Penrose's P3 tiling, composed of thick and thin
+rhombus shapes. There is no new \MP\ technique, but it is perhaps of mathematical
+interest that the code for P3 is so similar to P2 on the previous page.
+\vadjust{\moveright384pt\vbox to 0pt{\vskip -36pt
+\smallmpexternal[firstline=7, lastline=46, xleftmargin=0pt]{tiling-penrose-tatham-p3-rhombs.mp}
+\vss}}
+$$\includegraphics[scale=0.9]{tiling-penrose-tatham-p3-rhombs-construction.pdf}$$
+Each of the shapes is again split into two opposite triangles and the expansion rules
+applied separately, and only part of the edge of each triangle is drawn, so that the
+proper shapes appear in the final result.
-- functions, def, vardef, recursion, primarydef etc, of syntax, expr suffix text
+\bigskip
+\vbox to 2.4in{\noindent
+\includegraphics[width=\textwidth]{tiling-penrose-tatham-p3-rhombs.pdf}
+\vss}
-- four box model charts - Tufte charts - Venn diagrams
-- tour of the plain format
+% \newpage{Physics and engineering}
+% - the eye, hand
+% - physics diagrams, pendulum, indicating movement and vibration
+\newpage
+\tableofcontents
+
\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/angles-lines.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/angles-lines.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/angles-lines.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,78 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- % define a unit
- numeric u;
- u = 1cm;
-
- % define the axes
- path xx, yy;
- xx = (2 left -- 10 right) scaled u;
- yy = (down -- 7 up) scaled u;
-
- % and the angles
- numeric theta, psi;
- psi = 28;
- theta = 50;
-
- % and some points
- pair P, Q, H, N, M, T, L;
- P = (4, 3) scaled 1cm;
-
- % now some lines
- path ell, tee, arc;
- ell = (left--right) scaled 10u rotated theta shifted P cutbefore xx;
- tee = (left--right) scaled 10u rotated psi shifted P cutbefore xx;
-
- % this is a bit if a fiddle, but gets us a circular arc tangent to
- % the line tee at point P, which appears to be what is wanted....
- arc = subpath (1.6, 3.2) of halfcircle rotated -180 shifted 1/2 up
- scaled 10u shifted P rotatedabout(P, psi);
-
- % the rest of the points then follow...
- Q = ell intersectionpoint subpath (1.5, 3) of arc;
- H = P + whatever * dir psi;
- xpart H = xpart Q = xpart M; ypart M = ypart N = 0;
- xpart N = xpart P;
- L = point 0 of ell;
- T = point 0 of tee;
-
- % now we can get with the drawing
- draw arc dashed withdots scaled 1/4 withcolor 1/2 red;
- draw P--N dashed withdots scaled 1/2;
- draw Q--M dashed withdots scaled 1/2;
-
- drawarrow xx; label.rt("$x$", point 1 of xx);
- drawarrow yy; label.top("$y$", point 1 of yy);
-
- drawoptions(withcolor 2/3 blue);
- draw fullcircle scaled 32 shifted T cutafter tee;
- draw fullcircle scaled 28 shifted L cutafter ell;
- label("$\psi$", 24 right rotated 1/2 psi shifted T);
- label("$\theta$", 20 right rotated 1/2 theta shifted L);
- drawoptions();
-
- path boundary;
- z1 = point .95 of xx;
- z2 = point .95 of yy;
- boundary = z1--(x1,y2)--z2;
-
- draw ell cutafter boundary;
- draw tee cutafter boundary;
-
- % and finally label the points.
- label.bot("$T$", T);
- label.bot("$L$", L);
- label.bot("$N$", N);
- label.bot("$M$", M);
- dotlabel.ulft("$P$", P);
- dotlabel.lrt("$Q$", Q);
- dotlabel.lrt("$H$", H);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/angles-lines.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/apollonius.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/apollonius.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/apollonius.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,158 +0,0 @@
-\documentclass[border=1mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef radical_axis(expr ca, cb) =
- numeric t, d, ra, rb;
- ra = abs(center ca - point 0 of ca);
- rb = abs(center cb - point 0 of cb);
- d = abs(center cb - center ca);
- 2t = 1 + (ra+rb) / d * (ra-rb) / d;
- (up -- down) scaled 89
- rotated angle (center cb - center ca)
- shifted t[center ca, center cb]
-enddef;
-
-input tangent-times
-
-vardef invert_point(expr P, o, r) =
- save p, d; pair p; numeric d;
- p = P - o; d = abs p;
- if d > 0:
- o + unitvector p scaled (r/d*r)
- else:
- errmessage("Inversion undefined at center.")
- fi
-enddef;
-
-vardef pole(expr Line, Circle) =
- save p, o, r; pair o, p; numeric r;
- o = center Circle;
- r = 1/2 abs (point 4 of Circle - point 0 of Circle);
- p = whatever [point 1 of Line, point 0 of Line];
- p - o = whatever * direction 0 of Line rotated 90;
- invert_point(p, o, r)
-enddef;
-
-vardef polex(expr a, b, o, r) =
- save p; pair p;
- p = whatever [a, b];
- p - o = whatever * (a-b) rotated 90;
- invert_point(p, o, r)
-enddef;
-
-vardef three_point_circle(expr a,b,c) =
- save m; pair m;
- m = whatever [a,b] rotatedaround(.5[a,b],90)
- = whatever [b,c] rotatedaround(.5[b,c],90);
- fullcircle scaled 2 length(m-a) shifted m
- enddef;
-
-vardef through(expr a, b, o) =
- save d; numeric d; d = abs(a-b);
- (1+o/d)[b, a] -- (1+o/d)[a, b]
-enddef;
-
-beginfig(1);
- path c[]; numeric r[];
- z1 = origin; r1 = 101;
- z2 = 233 right rotated 4; r2 = 53;
- z3 = 209 right rotated -42; r3 = 31;
-
- forsuffixes $=1, 2, 3:
- c$ = fullcircle scaled 2 r$ shifted z$;
- endfor
-
- pair ecs[], ics[];
-
- for i=1 upto 3:
- numeric j, k;
- j = i mod 3 + 1;
- k = 10i + j;
- ics[k] = (r[i]/(r[i]+r[j]))[z[i], z[j]];
- ecs[k] = (r[i]/(r[i]-r[j]))[z[i], z[j]];
- endfor
- path a[];
- a1 = radical_axis(c1, c2);
- a2 = radical_axis(c2, c3);
- a3 = radical_axis(c3, c1);
-
- z0 = whatever [point 0 of a1, point 1 of a1]
- = whatever [point 0 of a2, point 1 of a2];
-
- z11 = polex(ecs31, ecs12, z1, r1);
- z21 = polex(ecs31, ecs12, z2, r2);
- z31 = polex(ecs31, ecs12, z3, r3);
-
- z12 = c1 intersectionpoint (z0 -- z11);
- z22 = c2 intersectionpoint (z0 -- z21);
- z32 = c3 intersectionpoint (z0 -- z31);
-
- z13 = c1 intersectionpoint (z11 -- 8[z0,z11]);
- z23 = c2 intersectionpoint (z21 -- 8[z0,z21]);
- z33 = c3 intersectionpoint (z31 -- 8[z0,z31]);
-
- z14 = whatever[ecs12, ecs31] = whatever[z1, z11];
- z24 = whatever[ecs12, ecs31] = whatever[z2, z21];
- z34 = whatever[ecs12, ecs31] = whatever[z3, z31];
-
- drawoptions(withcolor 3/4[blue, white]);
- draw c1; draw c2; draw c3;
- drawoptions(withcolor 1/4[blue, white]);
- label.urt(btex $C_1$ etex, point 1 of c1);
- label.top(btex $C_2$ etex, point 2 of c2);
- label.rt (btex $C_3$ etex, point 1/2 of c3);
- draw ecs12 -- ecs31 -- ecs23;
-
- drawoptions(withpen pencircle scaled 1/4 withcolor 3/4[2/3 blue, white]);
- draw a1; draw a2; draw a3;
- draw through(z1, z14, 6);
- draw through(z2, z24, 6);
- draw through(z3, z34, 6);
-
- drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 white);
- draw through(z0, z13, 6);
- draw through(z0, z23, 6);
- draw through(z0, z33, 6);
-
- drawoptions(withcolor 1/256(203, 92, 13));
- drawdot z0 withpen pencircle scaled 3/2 dotlabeldiam;
- z99 = z0 shifted 24 dir -6;
- label.rt("\vbox{\openup-4pt\halign{\hss #\hss\cr Radical\cr centre\cr}}", z99);
- interim ahangle := 20; drawarrow z99 -- z0
- cutafter fullcircle scaled 16 shifted z0
- withpen pencircle scaled 1/3;
-
- drawoptions(withcolor 1/256(239, 114, 21));
- dotlabel.urt("\small Pole", z11);
- dotlabel.ulft("\small Pole", z21);
- dotlabel.urt("\small Pole", z31);
-
- drawoptions(withcolor 2/3 red);
- draw three_point_circle(z12, z22, z32);
- draw three_point_circle(z13, z23, z33);
- drawdot z12 withpen pencircle scaled 3/4 dotlabeldiam;
- drawdot z22 withpen pencircle scaled 3/4 dotlabeldiam;
- drawdot z32 withpen pencircle scaled 3/4 dotlabeldiam;
- drawdot z13 withpen pencircle scaled 3/4 dotlabeldiam;
- drawdot z23 withpen pencircle scaled 3/4 dotlabeldiam;
- drawdot z33 withpen pencircle scaled 3/4 dotlabeldiam;
-
- drawoptions(withcolor 1/2[blue, white]);
- drawdot z1 withpen pencircle scaled dotlabeldiam;
- drawdot z2 withpen pencircle scaled dotlabeldiam;
- drawdot z3 withpen pencircle scaled dotlabeldiam;
- drawdot z14 withpen pencircle scaled dotlabeldiam;
- drawdot z24 withpen pencircle scaled dotlabeldiam;
- drawdot z34 withpen pencircle scaled dotlabeldiam;
- draw thelabel.top(btex Axis of similitude, as polar etex, origin)
- rotated angle (ecs12 - ecs31)
- shifted 3/4[ecs31, ecs12];
-
- drawoptions();
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/apollonius.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arbelos.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arbelos.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arbelos.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,63 +0,0 @@
-\RequirePackage{luatex85}
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-% invert path or pair P in circle C
-vardef invert(expr P, C) =
- save I, r; pair I; numeric r;
- I = center C;
- r = abs(point 0 of C shifted -I);
- if pair P: if abs(P-I) > 0: unitvector(P-I) scaled (r/abs(P-I)*r) shifted fi I
- elseif path P:
- save T; numeric T;
- T = length P;
- for t=0 upto T-1: invert(point t of P, C) .. endfor if cycle P: cycle else: invert(point T of P, C) fi
- fi
-enddef;
-beginfig(1);
- pair A,B,C;
- A = origin; C = 244 right; B = 7/8[A, C];
-
- path c[];
- c1 = fullcircle scaled 2 abs(A-C); % large circle for the inversions
- c2 = fullcircle scaled abs(A-C) shifted 1/2[A,C];
- c3 = fullcircle scaled abs(A-B) shifted 1/2[A,B];
- c4 = fullcircle scaled abs(B-C) shifted 1/2[B,C];
- c5 = invert(c4,c1);
-
- numeric d; d = abs(point 0 of c5 - point 4 of c5); % diameter of c5
-
- drawoptions(withcolor 3/4 white);
- draw c4; draw c5;
- draw invert(subpath(0, 3/2) of c2, c1);
- draw invert(subpath(0, 3/2) of c3, c1);
- drawoptions();
-
- draw subpath(-1/4,1) of c1 withcolor 3/4[1/2 red,white];
- label.bot("\textit{circle of inversion}", point -1/4 of c1) withcolor 1/4[1/2 red, white];
-
- for i=1 upto 72:
- path c, c';
- c = c5 shifted (0, i*d);
- c' = invert(c, c1);
- if i<5:
- drawoptions(withcolor 3/4 white);
- draw c; draw origin -- center c;
- fill fullcircle scaled dotlabeldiam shifted center c;
- fill fullcircle scaled dotlabeldiam shifted center c';
- drawoptions();
- fi
- draw c' withpen pencircle scaled 1/4 withcolor 2/3 blue;
- endfor
-
- forsuffixes $=2,3,4: draw subpath (0,4) of c$
- withpen pencircle scaled 1/4 withcolor 2/3 blue;
- endfor
-
- draw A--C;
- dotlabel.lft("$A$", A); dotlabel.llft("$B$", B); dotlabel.rt("$C$", C);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arbelos.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-3-4.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-3-4.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-3-4.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,62 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-vardef median(expr p) = origin for i=1 upto length p: + point i of p / length p endfor enddef;
-beginfig(1);
- path s[], t[];
- s1 = unitsquare scaled 21 rotated 15;
- s2 = s1 rotated 150;
- t1 = subpath (4, 3) of s1 -- point 1 of s2 -- cycle;
- t2 = t1 reflectedabout(point 1 of t1, point 2 of t1);
- t3 = t1 rotated 150;
- t4 = t1 rotated 210;
-
- picture color_unit, grid_unit;
- color_unit = image(
- fill s1 withcolor Oranges 8 1;
- fill s2 withcolor Oranges 8 2;
- fill t1 withcolor Blues 8 1;
- fill t2 withcolor Blues 8 2;
- fill t3 withcolor Blues 8 3;
- fill t4 withcolor Blues 8 4;
- );
- grid_unit = image(
- forsuffixes $=s1, s2, t1, t2, t3, t4:
- draw $;
- % pair m; m = median($);
- % for i=1 upto length $:
- % draw m -- point i - 1/2 of $
- % withpen pencircle scaled 1/4;
- % endfor
- endfor
- );
-
- pair u, v;
- u = point 1 of s1 - point 1 of s2;
- v = u rotated 90;
-
- numeric n; n = 3;
- forsuffixes $=color_unit, grid_unit:
- for i=-n upto n:
- for j=-n upto n:
- draw $ shifted (i * u + j * v);
- endfor
- endfor
- endfor
- label.bot("The arrangement of polygons in the units was carefully", point 1/2 of bbox currentpicture
- shifted 21 down);
- label.bot("chosen to give the tiling neat edges." , point 1/2 of bbox currentpicture);
-
- path b; b = bbox currentpicture shifted 34 down;
- draw color_unit shifted point 1/4 of b;
- draw grid_unit shifted point 3/4 of b;
- path b; b = bbox currentpicture shifted 13 down;
- label("\texttt{color\_unit}", point 1/4 of b);
- label("\texttt{grid\_unit}", point 3/4 of b);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-3-4.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-6-4.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-6-4.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-6-4.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,54 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\mplibsetformat{metafun}
-\begin{mplibcode}
-input colorbrewer-rgb
-beginfig(1);
- numeric r; r = 5;
- path d; d = for i=1 upto 12:
- up scaled r
- shifted (r * (sqrt(3)+2), 0)
- rotated 30i --
- endfor cycle;
-
- color shade[];
- shade0 = Oranges 8 3;
- shade1 = Blues 8 3;
- shade2 = Greens 8 3;
- shade3 = Reds 8 3;
-
- vardef unit(expr n) = image(
- fill d withcolor transparent (2, .9, shade[n mod 4]);
- draw d;
- ) enddef;
- pair u, v;
- u = point 0 of d - point 3 of d;
- v = u rotated 60;
- numeric n; n = 6;
- for i=-n upto n:
- for j=-n upto n:
- draw unit(i*j) shifted ((i - floor(j / 2)) * u + j * v);
- endfor
- endfor
- clip currentpicture to unitsquare shifted -(1/2, 1/2) scaled (n * 9 r);
- picture p; p = image(
- draw d; draw point 0 of d withpen pencircle scaled 2;
- drawoptions(withcolor 3/4[red, white]);
- draw d shifted u; draw point 0 of d shifted u withpen pencircle scaled 2;
- drawoptions(withcolor 3/4[blue, white]);
- draw d shifted v; draw point 0 of d shifted v withpen pencircle scaled 2;
- drawoptions();
- drawarrow origin -- u withcolor red;
- drawarrow origin -- v withcolor blue;
- );
- label.bot(p, point 1/2 of bbox currentpicture shifted 13 down);
- label.bot(btex \vbox{\hsize 3.4in\noindent
- The vectors are chosen so that the dodecagons overlap to make
- the required triangles, squares, and hexagons.} etex,
- point 1/2 of bbox currentpicture shifted 13 down);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-3-4-6-4.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-6-12.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-6-12.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-6-12.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,65 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input archimedean-tools
-input colorbrewer-rgb
-beginfig(1);
- path dodo, h[], s[];
- dodo = poly 12 of (origin -- 21 up);
- for i=1 upto 3:
- s[i] = poly 4 of subpath(2i, 2i-1) of dodo;
- endfor
- h1 = poly 6 of subpath (4, 3) of s1;
- h2 = poly 6 of subpath (2, 1) of s3;
-
- picture cols, lines;
- cols = image(
- fill dodo withcolor Greens 9 2;
- for i=1 upto 2:
- fill h[i] withcolor Greens 9 3;
- endfor
- for i=1 upto 3:
- fill s[i] withcolor Greens 9 4;
- endfor
- );
- lines = image(
- forsuffixes $=dodo, s1, s2, s3, h1, h2:
- if known $:
- draw $ withpen pencircle scaled 1/4;
- pair m; m = median($);
- for i=1 upto length $:
- cutdraw m -- point i - 1/2 of $
- if odd i: cutbefore fullcircle scaled (length $ / 4) shifted m fi
- withpen pencircle scaled 1/4
- withcolor Reds 4 3;
- ;
- endfor
- fi
- endfor
- );
-
- pair u, v;
- u = point 2 of s1 - point 8 of dodo;
- v = u rotated 60;
-
- numeric n;
- n = 2;
-
- forsuffixes @ = cols, lines:
- for i=-n upto n+1:
- for j=-n upto n:
- draw @ shifted (i*u + j*v - floor(i/2) * v);
- endfor
- endfor
- endfor
-
- clip currentpicture to unitsquare xscaled ((2n+1) * xpart u) yscaled (2n * ypart v)
- shifted median(s2 shifted (-n*u - n*v + floor(n/2) * v));
-
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-6-12.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8-parts.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8-parts.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8-parts.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,34 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-input colorbrewer-rgb
-path o, r[];
-o = (for i=0 upto 7: 21 dir 45i -- endfor cycle) rotated -90/4;
-pair t; t = whatever[point 0 of o, point 1 of o]
- = whatever[point 2 of o, point 3 of o];
-r1 = subpath (1,2) of o -- t -- cycle;
-r2 = r1 rotated 90;
-r3 = r2 rotated 90;
-r4 = r3 rotated 90;
-
-picture filler;
-filler = image(
- filldraw r1 withcolor Reds 8 3;
- filldraw r2 withcolor Blues 8 3;
- filldraw r3 withcolor Reds 8 3;
- filldraw r4 withcolor Blues 8 3;
- filldraw o withcolor Purples 8 2;
-);
-beginfig(1);
- draw filler;
- label.bot("\begin{tabular}{c}The \texttt{filler} picture\\(unrotated)\end{tabular}", point 1/2 of bbox filler);
-
- draw o shifted 120 right;
- label.bot("The octagon path \texttt{o}", point 1/2 of bbox o shifted 120 right);
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8-parts.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,40 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-input colorbrewer-rgb
-path o, r[];
-o = (for i=0 upto 7: 21 dir 45i -- endfor cycle) rotated -90/4;
-pair t; t = whatever[point 0 of o, point 1 of o]
- = whatever[point 2 of o, point 3 of o];
-r1 = subpath (1,2) of o -- t -- cycle;
-r2 = r1 rotated 90;
-r3 = r2 rotated 90;
-r4 = r3 rotated 90;
-
-picture filler;
-filler = image(
- filldraw r1 withcolor Reds 8 3;
- filldraw r2 withcolor Blues 8 3;
- filldraw r3 withcolor Reds 8 3;
- filldraw r4 withcolor Blues 8 3;
- filldraw o withcolor Purples 8 2;
-);
-pair u, v;
-u = point 0 of o - point 5 of o; v = u rotated 90;
-beginfig(1);
-numeric n; n = 5;
-for i=-n upto n:
- for j=-n upto n:
- draw filler rotated ((i+j) mod 2 * 90) shifted (i*u + j * v);
- endfor
-endfor
-for i=-n upto n:
- for j=-n upto n:
- draw o shifted (i*u + j * v);
- endfor
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-4-8-8.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hexagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hexagon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hexagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,59 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-input archimedean-tools
-beginfig(1);
-
- path h[];
- % 42/sqrt(3) \simeq 24.2487;
- for i=0 upto 2:
- h[i] = poly 6 of (origin -- 42 / sqrt(3) * dir (30 + 120i));
- endfor
-
- picture unit;
- unit = image(
- % fill h0 withcolor Purples 8 3;
- % fill h1 withcolor Oranges 8 3;
- % fill h2 withcolor Blues 8 2;
- numeric i; i = -1;
- forsuffixes $ = Purples, Oranges, Blues:
- pair m; m = median(h[incr i]);
- for j=1 upto 3:
- fill subpath (-2i+2j, 2-2i+2j) of h[i] -- m -- cycle withcolor $[8][1+j];
- endfor
- for j=1 upto 3:
- draw m -- point 2j of h[i] withcolor $[8][1];
- endfor
- endfor
-
- % for i=0 upto 2:
- % pair m; m = median(h[i]);
- % for j=0 upto 2:
- % draw point 2j+1/2 of h[i] -- m -- point 2j+3/2 of h[i];
- % endfor
- % endfor
- );
-
- pair u, v;
- u = point 3 of h1 - point 1 of h0;
- v = u rotated 60;
-
- numeric n;
- n = 4;
-
- for i=-n upto n:
- for j=-n upto n:
- draw unit shifted (i*u + j*v);
- endfor
- endfor
-
- clip currentpicture to superellipse(168 right, 168 up, 168 left, 168 down, 0.78);
-
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hst.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hst.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hst.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,62 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-input archimedean-tools
-beginfig(1);
- path t[], s[], h;
- h = poly 6 of (origin -- 42 dir 30);
- for i=1 upto 3:
- s[i] = poly 4 of subpath (2i, 2i-1) of h;
- endfor
- t1 = poly 3 of subpath (4, 3) of s1;
- t2 = poly 3 of subpath (2, 1) of s2;
-
- picture unit;
- unit = image(
- for i=1 upto 2:
- fill t[i] withcolor Blues 8 4;
- endfor
- for i=1 upto 3:
- fill s[i] withcolor Greens 8 1;
- endfor
- fill h withcolor Oranges 9 4;
- forsuffixes $=t1, t2:
- pair m; m = median($);
- for i=1 upto length $:
- draw m -- point i - 1/2 of $ withcolor Blues 8 8;
- endfor
- endfor
- forsuffixes $=s1, s2, s3:
- draw point 1/2 of $ -- point 5/2 of $ withcolor Oranges 8 8;
- draw point 3/2 of $ -- point 7/2 of $ withcolor Blues 8 8;
- endfor
- for i=1 upto 3:
- draw point i-1/2 of h -- point i+5/2 of h withcolor Oranges 8 8;
- endfor
- );
-
- pair u, v;
- u = point 2 of s1 - point -1 of h;
- v = u rotated 60;
-
- numeric n; n=4;
- for i=-n upto n:
- for j=-n upto n:
- draw unit rotated 0 shifted (i*u + j*v - floor (j/2) * u);
- endfor
- endfor
- %draw bbox unit withcolor red;
-
- clip currentpicture to fullcircle scaled (3/2n * abs(v));
-
- % picture p; p = currentpicture;
- % (wd, ht) = (urcorner p - llcorner p);
- % currentpicture := nullpicture;
- % p := p scaled (148.5mm / wd);
- % draw p;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-hst.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hex-parts.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hex-parts.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hex-parts.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,49 +0,0 @@
-input colorbrewer-rgb
-input archimedean-tools
-path t[], h;
-h = poly 6 of (origin -- 21 dir 30);
-for i=1 upto 6:
- t[i] = poly 3 of subpath (i, i-1) of h;
-endfor
-picture P[], unit[];
-for k=1 upto 2:
- pair u, v;
- if k=1:
- u = point 2 of h - point 2 of t6;
- t7 := poly3 of subpath (0, -1) of t6;
- t8 := poly3 of subpath (0, -1) of t3;
- else:
- u = point 3 of h - point 2 of t6;
- t7 := poly3 of subpath (2, 1) of t6;
- t8 := poly3 of subpath (2, 1) of t3;
- fi
-
- v = u rotated -60;
-
- unit[k] = image(
- for i=1 upto 6:
- fill t[i] withcolor Blues 8 if odd i: 2 else: 3 fi;
- endfor
- for i=7 upto 8:
- fill t[i] withcolor Oranges 8 if odd i: 3 else: 2 fi;
- endfor
- fill h withcolor Oranges 8 2;
- forsuffixes $=h, t1, t2, t3, t4, t5, t6, t7, t8:
- draw $ withpen pencircle scaled 1/4 withcolor 3/4;
- pair m; m = median($);
- for i=1 upto length $:
- draw m -- point i - 1/2 of $ withcolor 3/4;
- endfor
- endfor
- );
-
- numeric n; n=4;
- P[k] = image(
- for i=-n upto n:
- for j=-n upto n:
- draw unit[k] shifted (i*u + j*v - floor (j/2) * u);
- endfor
- endfor
- clip currentpicture to superellipse(168 right, 168 up, 168 left, 168 down, 0.78);
- );
-endfor
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon-unit.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon-unit.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon-unit.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,12 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input arch-snub-hex-parts
-beginfig(1);
- draw unit1 rotated 210;
- draw unit2 rotated 210 shifted 100 left;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon-unit.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,13 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input arch-snub-hex-parts
-beginfig(1);
-draw P1 shifted 180 left;
-draw P2 shifted 180 right;
-currentpicture := currentpicture rotated 90;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-hexagon.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-square.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-square.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-square.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,72 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-cmyk
-% a polygon of n sides on a given path
-vardef poly expr n of p =
- save x, y;
- z0 = point 0 of p;
- z1 = point 1 of p;
- for i=2 upto n-1:
- z[i] = z[i-2] rotatedabout(z[i-1], 180(2/n-1));
- endfor
- for i=0 upto n-1: z[i] -- endfor cycle
-enddef;
-vardef median(expr P) =
- (origin for i=1 upto length P: + point i of P endfor) / length P
-enddef;
-beginfig(1);
- path t[], s[];
- s1 = poly 4 of (origin -- 42 dir 15);
- t1 = poly 3 of subpath (2, 1) of s1;
- t2 = poly 3 of subpath (3, 2) of s1;
- t3 = poly 3 of subpath (2, 1) of t1;
- t4 = poly 3 of subpath (2, 1) of t2;
- s2 = poly 4 of subpath (2, 1) of t4;
-
- picture unit;
- unit = image(
- fill s1 withcolor Oranges 8 5;
- fill t1 withcolor Blues 8 4;
- fill t4 withcolor Blues 8 3;
- fill t3 withcolor Greens 8 4;
- fill t2 withcolor Greens 8 3;
- fill s2 withcolor Reds 8 5;
- forsuffixes $=s1, t1, s2, t2, t3, t4:
- pair m; m = median($);
- for i=1 upto length $:
- draw point i - 1/2 of $ -- m
- withpen pencircle scaled 3/2 withcolor Spectral 3 2;
- endfor
- endfor
- );
-
- pair u, v;
- u = point 2 of t2 - point 0 of s1;
- v = point 2 of t3 - point 0 of s1;
-
- for i=0 upto 6:
- for j=0 upto 9:
- draw unit shifted (i*u + j*v);
- endfor
- endfor
-
- % picture p; p = currentpicture;
- % (wd, ht) = (urcorner p - llcorner p);
- % currentpicture := nullpicture;
- % p := p scaled (145mm / wd);
- % undraw unitsquare xscaled 148mm yscaled 210mm shifted llcorner p shifted -(1.5mm, 1.5mm)
- % withpen pencircle scaled 1/8;
- % z0 = 1/2[llcorner currentpicture, ulcorner currentpicture];
- % draw z0 -- z0 shifted 3 right withpen pencircle scaled 1/8;
- % z1 = 1/2[lrcorner currentpicture, urcorner currentpicture];
- % draw z1 -- z1 shifted 3 left withpen pencircle scaled 1/8;
- % draw p;
- % picture r; r = currentpicture rotated 90;
- % currentpicture := nullpicture;
- % draw r;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-snub-square.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-square.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-square.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-square.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,39 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-input archimedean-tools
-beginfig(1);
-
- path s;
- s = poly 4 of (origin -- 42 right);
- pair m;
- m = median(s);
-
- picture unit[];
- unit0 = image(
- fill s withcolor Oranges 8 5;
- for i=1 upto length s:
- draw m -- point i-1/2 of s;
- endfor<D-`>
-
- );
- unit1 = image(fill s withcolor Blues 8 4);
-
-
- pair u, v;
- u = point 1 of s - point 0 of s;
- v = point 3 of s - point 0 of s;
-
-
- numeric n;
- n = 4
-
-
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-triangle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-triangle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/arch-triangle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,45 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-input archimedean-tools
-beginfig(1);
-
- path s, t;
- s = poly 3 of (origin -- 42 right);
- t = poly 3 of subpath(2,1) of s;
- pair ms, mt;
- ms = median(s);
- mt = median(t);
-
- picture unit;
- unit = image(
- fill s withcolor Oranges 8 3;
- fill t withcolor Blues 8 2;
- draw point 5/2 of s -- ms;
- draw point 3/2 of t -- mt;
- draw point 1/2 of s -- ms -- mt -- point 5/2 of t;
- );
-
- pair u, v;
- u = point 1 of s - point 0 of s;
- v = point 2 of s - point 0 of s;
-
- numeric n;
- n = 0;
-
- for i=-n upto n:
- for j=-n upto n:
- draw unit shifted (i*u + j*v);
- endfor
- endfor
-
- clip currentpicture to superellipse(168 right, 168 up, 168 left, 168 down, 0.78);
-
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedean-tools.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedean-tools.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedean-tools.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,33 +0,0 @@
-% a polygon of n sides on a given path
-vardef poly expr n of p =
- save x, y;
- z0 = point 0 of p;
- z1 = point 1 of p;
- for i=2 upto n-1:
- z[i] = z[i-2] rotatedabout(z[i-1], 180(2/n-1));
- endfor
- for i=0 upto n-1: z[i] -- endfor cycle
-enddef;
-vardef polyc expr n of p =
- save x, y;
- z0 = point 0 of p;
- z1 = point 1 of p;
- for i=2 upto n-1:
- z[i] = z[i-2] rotatedabout(z[i-1], 180(2/n-1));
- endfor
- for i=0 upto n-1: z[i] ... endfor cycle
-enddef;
-
-% a polygon of n sides of a given length
-vardef polya(expr n, s) =
- save r, x, y; numeric r, x, y;
- (x, y) = dir (180/n);
- 2r = s * x / y;
- for i=0 upto n-1:
- (left * s/2) shifted (r * down) rotated (360 / n * i) --
- endfor cycle
-enddef;
-vardef median(expr P) =
- (origin for i=1 upto length P: + point i of P endfor) / length P
-enddef;
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,189 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-numeric u; u = 10;
-path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-picture P[];
-% (4,6,12)
-numeric dx; dx = u*(1+ cosd(15)/sind(15));
-picture unit; unit = image(
- path s; s = unitsquare shifted -(1/2,1/2) scaled u shifted (dx/2,0);
- for t=0 upto 2:
- draw s rotated 120t;
- for tt=1 upto 3:
- draw subpath(3,4) of s rotated (120t+30tt);
- endfor
- endfor
-);
-P1 = image(
- draw unit withpen pencircle scaled 4 withcolor .8[red,white];
- for x=-5dx step dx until 5dx:
- for y=-5dx step dx until 5dx:
- draw unit shifted (x,0) shifted ((y,0) rotated 60);
- endfor
- endfor
- clip currentpicture to box; draw box dashed withdots scaled 1/4;
- label.bot("$(4, 6, 12)$", point 1/2 of bbox currentpicture);
-);
-numeric dx; dx = u*(cosd(180/8)/sind(180/8));
-path octagon; octagon = for t = 0 upto 7: 1/2(dx,u) rotated 45t -- endfor cycle;
-P2 = image(
- draw octagon withpen pencircle scaled 4 withcolor .8[red,white];
- for x=-5dx step dx until 5dx:
- for y=-5dx step dx until 5dx:
- draw octagon shifted (x,y);
- endfor
- endfor
- clip currentpicture to box; draw box dashed withdots scaled 1/4;
- label.bot("$(4, 8^2)$", point 1/2 of bbox currentpicture);
-);
-
-numeric dx; dx = u*(cosd(180/12)/sind(180/12));
-path unit; unit = for t=0 upto 11: 1/2(dx,u) rotated 30t -- endfor cycle;
-P3 = image(
- draw unit withpen pencircle scaled 4 withcolor .8[red,white];
- for x=-5dx step dx until 5dx:
- for y=-5dx step dx until 5dx:
- draw unit shifted (x,0) shifted ((y,0) rotated 60);
- endfor
- endfor
- clip currentpicture to box; draw box dashed withdots scaled 1/4;
- label.bot("$(3, 12^2)$", point 1/2 of bbox currentpicture);
-);
-
-% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-% clip currentpicture to box; draw box dashed evenly;
-
-% endfig;
-
-% beginfig(4);
-% % (6^3)
-% save dx; dx = 3u;
-% picture unit; unit = image(
-% for t=0 upto 2:
-% draw origin -- (u,0) rotated 120t;
-% endfor
-% );
-
-% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
-
-% for x=-5dx step dx until 5dx:
-% for y=-5dx step dx/3 until 5dx:
-% draw unit shifted (x,0) shifted (y,0) shifted ((y,0) rotated 60);
-% endfor
-% endfor
-
-% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-% clip currentpicture to box; draw box dashed evenly;
-
-% endfig;
-
-% (3,4,6,4)
-numeric dx; dx = u*(1+cosd(30)/sind(30));
-picture unit; unit = image(
- path s; s = unitsquare shifted -(1/2,1/2) scaled u shifted (dx/2,0);
- for t=0 upto 2:
- draw s rotated 120t;
- endfor
-);
-P4 = image(
- draw unit withpen pencircle scaled 4 withcolor .8[red,white];
- for x=-5dx step dx until 5dx:
- for y=-5dx step dx until 5dx:
- draw unit shifted (x,0) shifted ((y,0) rotated 60);
- endfor
- endfor
- clip currentpicture to box; draw box dashed withdots scaled 1/4;
- label.bot("$(3, 4, 6, 4)$", point 1/2 of bbox currentpicture);
-);
-
-% beginfig(6);
-% % (3,6,3,6)
-% save dx; dx = 2u;
-% path unit; unit = for t=0 upto 5: (u,0) rotated 60t -- endfor cycle;
-
-% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
-
-% for x=-5dx step dx until 5dx:
-% for y=-5dx step dx until 5dx:
-% draw unit shifted (x,0) shifted ((y,0) rotated 60);
-% endfor
-% endfor
-
-% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-% clip currentpicture to box; draw box dashed evenly;
-
-% endfig;
-
-% beginfig(7);
-% % (4^4)
-% save dx; dx = 4u;
-% path unit; unit = unitsquare shifted -(1/2,1/2) scaled 2u;
-
-% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
-
-% for x=-5dx step dx until 5dx:
-% for y=-5dx step dx until 5dx:
-% draw unit shifted (x,0) shifted (y/2,y/2);
-% endfor
-% endfor
-
-% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-% clip currentpicture to box; draw box dashed evenly;
-
-% endfig;
-
-% beginfig(8);
-% % (3^4,6)
-% save dx; dx = 2u;
-% picture unit; unit = image(
-% for t=0 upto 5: draw ((2u,0) -- (u,0)
-% -- (u,0) rotated 60
-% -- (u,0) rotated 60 shifted (u,0)
-% ) rotated 60t; endfor
-% );
-
-% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
-
-% for x=-5dx step dx until 5dx:
-% for y=-5dx step dx until 5dx:
-% draw unit shifted (x,0) shifted ((x/2,0) rotated -60)
-% shifted ((y,0) rotated 60) shifted (y/2,0);
-% endfor
-% endfor
-
-% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-% clip currentpicture to box; draw box dashed evenly;
-
-% endfig;
-% beginfig(9);
-% % (3^2,4,3,4)
-% save dx; dx = u;
-% picture unit; unit = image(
-% for t=0 upto 3: draw ( (u/2,-u/2) -- (u/2+u*sqrt(3)/2,0) -- (u/2,u/2) -- cycle) rotated 90t; endfor
-% );
-
-% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
-
-% for x=-5dx step dx until 5dx:
-% for y=-5dx step dx until 5dx:
-% draw unit shifted (x,0) shifted ((x,0) rotated 30)
-% shifted (0,y) shifted ((0,y) rotated 30);
-% endfor
-% endfor
-
-% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
-% clip currentpicture to box; draw box dashed evenly;
-
-% endfig;
-beginfig(1);
-draw P1;
-draw P2 shifted (12.5u, 0);
-draw P3 shifted (0, -14.4u);
-draw P4 shifted (12.5u, -14.4u);
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/archimedes.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/area-under-graph.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/area-under-graph.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/area-under-graph.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,37 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-ahangle := 30;
-beginfig(1);
- numeric u;
- u = 1cm;
- path xx, yy, f;
- xx = (1/4 left -- 17/4 right) scaled u;
- yy = (1/4 down -- 9/4 up) scaled u;
-
- f = ((15/32,32/15) for x = 1/2 step 1/8 until 33/8: .. (x,1/x) endfor) scaled u;
-
- path A;
- A = buildcycle(yy shifted (u,0), f, yy shifted (2.71828u,0), xx);
- fill A withcolor Blues 8 2;
-
- drawoptions(withcolor 3/4);
- for x=1 upto 4:
- draw yy shifted (x*u,0) cutafter (xx shifted (0, ypart point 0 of f));
- endfor
- for y=1 upto 2:
- draw xx shifted (0,y*u) cutafter (yy shifted (xpart point infinity of f,0));
- endfor
-
- drawoptions();
- draw f withcolor Reds 8 7;
- drawarrow xx;
- drawarrow yy;
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/area-under-graph.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/automatic-grid.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/automatic-grid.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/automatic-grid.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,16 @@
+vardef grid(expr p, grid_unit) =
+ save llx, lly, urx, ury;
+ (llx, lly) = llcorner p - (bboxmargin, bboxmargin);
+ (urx, ury) = urcorner p + (bboxmargin, bboxmargin);
+ image(
+ for x = 1 + floor(llx / grid_unit) upto floor(urx / grid_unit):
+ draw (x * grid_unit, lly) -- (x * grid_unit, ury);
+ endfor
+ for y = 1 + floor(lly / grid_unit) upto floor(ury / grid_unit):
+ draw (llx, y * grid_unit) -- (urx, y * grid_unit);
+ endfor
+ if (llx < 0) and (lly < 0) and (urx > 0) and (ury > 0):
+ draw fullcircle scaled 3; % show origin if in range
+ fi
+ )
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/automatic-grid.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/axis-of-similitude.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/axis-of-similitude.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/axis-of-similitude.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,113 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef straight_through(expr Prefix, Path, Suffix) =
- reverse (left scaled Prefix rotated angle direction 0 of Path shifted point 0 of Path)
- .. Path .. (right scaled Suffix rotated angle direction infinity of Path shifted point infinity of Path)
-enddef;
-
-vardef tangent_times(expr C, p) =
- save m, a, b, G, H;
- pair m; numeric a, b; path G, H;
- m = 1/2[p, center C];
- H = halfcircle scaled abs (p - center C)
- rotated angle (p - center C) shifted m;
- G = H rotatedabout(m, 180);
- (a, whatever) = C intersectiontimes H;
- (b, whatever) = C intersectiontimes G;
- (a, b if b < a: + 8 fi)
-enddef;
-vardef arc_of_tangents(expr C, p) =
- subpath tangent_times(C, p) of C
-enddef;
-
-beginfig(1);
-
- path c[]; numeric r[];
- z1 = origin; r1 = 101;
- z2 = 233 right rotated 4; r2 = 53;
- z3 = 209 right rotated -42; r3 = 31;
-
- forsuffixes $=1, 2, 3:
- c$ = fullcircle scaled 2 r$ shifted z$;
- endfor
-
- pair ecs[], ics[];
-
- for i=1 upto 3:
- numeric j, k;
- j = i mod 3 + 1;
- k = 10i + j;
- ics[k] = (r[i]/(r[i]+r[j]))[z[i], z[j]];
- ecs[k] = (r[i]/(r[i]-r[j]))[z[i], z[j]];
- endfor
-
- show unitvector(ecs31 - ics12) dotprod unitvector(ecs12 - ics31);
-
- fill ecs12 -- arc_of_tangents(c1, ecs12) -- cycle withcolor 15/16[blue, white];
- fill ics12 -- arc_of_tangents(c1, ics12) -- cycle withcolor 7/8 [blue, white];
- fill ics12 -- arc_of_tangents(c2, ics12) -- cycle withcolor 7/8 [blue, white];
-
- unfill c1; unfill c2; unfill c3;
-
- drawoptions(withcolor 3/4[blue, white]);
- draw c1 withpen pencircle scaled 1;
- draw c2 withpen pencircle scaled 1;
- draw c3 withpen pencircle scaled 1;
-
- numeric t, u, v;
- (t, whatever) = tangent_times(c1, ecs12);
- (u, whatever) = tangent_times(c1, ics12);
- (whatever, v) = tangent_times(c2, ics12);
- draw point t of c1 -- z1 -- point u of c1 dashed evenly;
- draw point t of c2 -- z2 -- point v of c2 dashed evenly;
-
- drawoptions(withcolor 1/4[blue, white]);
- drawdot z1 withpen pencircle scaled dotlabeldiam;
- drawdot z2 withpen pencircle scaled dotlabeldiam;
- drawdot z3 withpen pencircle scaled dotlabeldiam;
- label(btex $C_1$ etex, z1 shifted 10 dir 254);
- label(btex $C_2$ etex, z2 shifted 10 dir 299);
- label(btex $C_3$ etex, z3 shifted 10 dir 6);
- label.lft(btex $r_1$ etex, 1/2[z1, point t of c1]);
- label.lft(btex $r_2$ etex, 1/2[z2, point t of c2]);
-
- drawoptions();
- draw ecs31 -- ics12 -- ecs23 -- ecs12 -- ics31 dashed withdots scaled 1/2;
-
- drawoptions(withcolor 1/2 white);
- draw straight_through(r1+24, z1 -- ecs12, 24);
- draw straight_through(r1+24, z1 -- ecs31, 24);
- draw straight_through(r2+24, z2 -- ecs23, 24);
-
- drawoptions(withcolor 2/3 red);
- drawdot ics12 withpen pencircle scaled dotlabeldiam;
- drawdot ics23 withpen pencircle scaled dotlabeldiam;
- drawdot ics31 withpen pencircle scaled dotlabeldiam;
- label(btex $I_{12}$ etex, ics12 shifted 12 dir 100);
- label(btex $I_{23}$ etex, ics23 shifted 12 dir 340);
- label(btex $I_{31}$ etex, ics31 shifted 10 dir 200);
-
- drawoptions(withcolor 5/8 blue);
- drawdot ecs12 withpen pencircle scaled dotlabeldiam;
- drawdot ecs23 withpen pencircle scaled dotlabeldiam;
- drawdot ecs31 withpen pencircle scaled dotlabeldiam;
- label(btex $E_{12}$ etex, ecs12 shifted 8 dir 100);
- label(btex $E_{23}$ etex, ecs23 shifted 11 dir 345);
- label(btex $E_{31}$ etex, ecs31 shifted 10 dir 277);
-
- draw thelabel.top(btex Axis of Similitude etex, origin)
- rotated angle (ecs12 - ecs31)
- shifted 1/4[ecs31, ecs12];
-
- label(btex $\displaystyle {C_1E_{12} \over C_2E_{12}} = {r_1 \over r_2}
- = {C_1I_{12} \over C_2I_{12}}$ etex, (x1, y3));
-
- label(btex \it \& cetera \dots etex, (x1, y3-28));
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/axis-of-similitude.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/basedate.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/basedate.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/basedate.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,11 +1,7 @@
vardef base(expr Y, M, d) =
- save m, y; numeric m, y;
- if M < 3:
- m = M + 9;
- y = Y - 1;
- else:
- m = M - 3;
- y = Y;
- fi
- 365/1024 y + (floor(y/4) - floor(y/100) + floor(y/400) + floor((2+3m)/5) + 30m + d - 307) / 1024
+ save m, y;
+ if M < 3: m = M + 9; y = Y - 1;
+ else: m = M - 3; y = Y; fi
+ 365/1024 y + (floor(y/4) - floor(y/100) + floor(y/400)
+ + floor((2+3m)/5) + 30m + d - 307) / 1024
enddef;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-euclidean.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-euclidean.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-euclidean.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,33 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\mplibtextextlabel{enable}
-\begin{document}
-\vbox{\openup 1pt \halign to 4in{#\cr
-\begin{code}
-vardef euclidean_bisector(expr a,b,c,r) =
- save arc,p,q,e;
- path arc; pair p,q,e;
- arc = fullcircle scaled r shifted b;
- p = (a--b) intersectionpoint arc;
- q = (b--c) intersectionpoint arc ;
- e = equilateral_triangle_point(p,q);
- e
-enddef;
-\end{code}
-\cr\kern 64pt
-\begin{mplibcode}
-input bisection
-beginfig(1);
-z0 = euclidean_bisector(A,B,C,100);
-draw B -- 1.2[B,z0] withcolor .67 red;
-draw A--B--C;
-dotlabel.top(btex $A$ etex, A);
-dotlabel.lft(btex $B$ etex, B);
-dotlabel.lrt(btex $C$ etex, C);
-dotlabel.lrt(btex $E$ etex, z0);
-undraw bbox currentpicture;
-endfig;
-\end{mplibcode}
-\cr}}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-euclidean.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-interior.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-interior.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-interior.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,28 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\mplibtextextlabel{enable}
-\begin{document}
-\vbox{\openup 1pt \halign to 4in{#\cr
-\begin{code}
-vardef interior_bisector(expr a,b,c) =
- (1/(1+abs(c-b)/abs(a-b)))[a,c]
-enddef;
-\end{code}
-\cr\kern 64pt
-\begin{mplibcode}
-input bisection
-beginfig(1);
-z0 = interior_bisector(A,B,C);
-draw A--B--C--cycle;
-draw B -- 1.2[B,z0] withcolor .67 red;
-dotlabel.top(btex $A$ etex, A);
-dotlabel.lft(btex $B$ etex, B);
-dotlabel.lrt(btex $C$ etex, C);
-draw z0 withpen pencircle scaled dotlabeldiam;
-label(btex $E$ etex, z0 + (3,9));
-undraw bbox currentpicture;
-endfig;
-\end{mplibcode}
-\cr}}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-interior.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-vector.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-vector.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-vector.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,30 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\mplibtextextlabel{enable}
-\begin{document}
-\vbox{\openup 1pt \halign to 4in{#\cr
-\begin{code}
-vardef vector_bisector(expr a,b,c,r) =
- b + unitvector (a-b) scaled r
- + unitvector (c-b) scaled r
-enddef;
-\end{code}
-\cr\kern 64pt
-\begin{mplibcode}
-input bisection
-beginfig(1);
-z0 = vector_bisector(A,B,C,50);
-drawarrow B--A cutafter fullcircle scaled 5 shifted A;
-drawarrow B--C cutafter fullcircle scaled 5 shifted C;
-drawarrow B--z0 cutafter fullcircle scaled 5 shifted z0
-withcolor .67 red;
-dotlabel.top(btex $A$ etex, A);
-dotlabel.lft(btex $B$ etex, B);
-dotlabel.lrt(btex $C$ etex, C);
-dotlabel.lrt(btex $E$ etex, z0);
-undraw bbox currentpicture;
-endfig;
-\end{mplibcode}
-\cr}}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection-vector.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/bisection.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,33 +0,0 @@
-vardef equilateral_triangle_point(expr a, b) =
- b shifted -a rotated 60 shifted a
-enddef;
-
-vardef euclidean_bisector(expr a,b,c,r) =
- save arc,p,q,e;
- path arc; numeric p,q; pair e;
- arc = fullcircle scaled r shifted b;
- p = ypart ( (a--b) intersectiontimes arc );
- q = ypart ( (b--c) intersectiontimes arc );
- e = equilateral_triangle_point(point p of arc, point q of arc);
- hide(
- draw subpath(p-1/4,p+1/4) of arc withcolor .7[red,white];
- draw subpath(q-1/4,q+1/4) of arc withcolor .7[red,white];
- draw point p of arc -- point q of arc -- e -- cycle
- withcolor .7[blue,white];
- )
- e
-enddef;
-
-vardef vector_bisector(expr a,b,c,r) =
- b + unitvector (a-b) scaled r
- + unitvector (c-b) scaled r
-enddef;
-
-vardef interior_bisector(expr a,b,c) =
- (1/(1+abs(c-b)/abs(a-b)))[a,c]
-enddef;
-
-pair A,B,C;
-A = 120 right rotated 52;
-B = origin;
-C = 144 right rotated -4;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/blended-color-circles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/blended-color-circles.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/blended-color-circles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,44 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\usepackage{fontspec}
-\setmainfont{Helvetica}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-
-path C[], B[];
-
-% arrange each circle so that point 0 is outside the others
-C1 = fullcircle scaled 120 rotated 90 shifted 40 up;
-C2 = C1 rotated 120;
-C3 = C2 rotated 120;
-
-B0 = buildcycle(C1, C2, C3);
-B1 = buildcycle(C1, C2);
-B2 = buildcycle(C2, C3);
-B3 = buildcycle(C3, C1);
-
-picture P;
-for x=0 upto 1:
- for y=0 upto 1:
- P := image(
- s := 1/4 + x/2;
- k := 0 + y/4;
- fill C1 withcolor s*(1,0,0,k);
- fill C2 withcolor s*(0,1,0,k);
- fill C3 withcolor s*(0,0,1,k);
- fill B3 withcolor s*(1,0,1,k);
- fill B2 withcolor s*(0,1,1,k);
- fill B1 withcolor s*(1,1,0,k);
- fill B0 withcolor s*(1,1,1,k);
- undraw C1; undraw C2; undraw C3;
- ) shifted -(200x, 200y);
- draw P;
- label.bot(("shade: " & decimal s & ", k: " & decimal k)
- infont "phvr8r", point 1/2 of bbox P);
- endfor
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/blended-color-circles.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border-dashed.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border-shadow.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,50 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-input rope
-beginfig(1);
-
- interim ahangle := 30;
-
- z0 = 42 left rotated normaldeviate;
- z1 = 30 up rotated normaldeviate;
- z2 = 31 right rotated normaldeviate;
- z3 = 34 down rotated normaldeviate;
-
- path s[];
- for i=0 upto 3:
- s[i] = unitsquare zscaled (z[(i+1) mod 4] - z[i]) shifted z[i];
- fill s[i] withcolor if odd i: Blues else: Oranges fi 8 1;
- draw point 3 of s[i] -- subpath (1,4) of s[i] -- point 2 of s[i] withcolor 3/4;
- drawarrow subpath (0, 1) of s[i];
- z[i+4] = 1/2[point 0 of s[i], point 2 of s[i]];
- endfor
-
- z8 = whatever[z4, z6] = whatever[z5, z7];
-
- draw unitsquare scaled 5 rotated angle (z4-z6) shifted z8 withcolor 3/4;
-
- drawarrow z4--z6;
- drawarrow z5--z7;
-
- vardef with_rounded_corners expr p =
- for i=1 upto length p:
- subpath (i-15/16, i-1/16) of p ..
- endfor cycle
- enddef;
-
- interim bboxmargin := 16;
- draw rope with_rounded_corners bbox currentpicture;
- % dashed evenly scaled 3/4;
- %picture P; P = currentpicture;
- %fill bbox P shifted (3,-3) withcolor 3/4;
- %unfill bbox P; draw bbox P;
- %draw P;
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/border.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/braces.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/braces.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/braces.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,44 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef do_brace(expr a,b,m,r) =
- save d, e, n, bb;
- numeric d, n; pair e; path bb;
- d = angle (b-a);
- e = up scaled m rotated d shifted r[a,b];
- n = 1/2 m;
- bb = (
- (origin {0,n} .. {right} (abs n,n))
- rotated d shifted a
- --
- ((-abs n,-n) {right} .. {0,n} origin {0,-n} .. {right}(abs n,-n))
- rotated d shifted e
- --
- ((-abs n,n){right}..{0,-n}origin)
- rotated d shifted b
- ) shifted (up scaled n rotated d);
- draw bb withpen pencircle yscaled .6 xscaled .1666 rotated d;
- point 3 of bb
-enddef;
-beginfig(1);
-
-z1 = origin;
-z2 = 180 right rotated 13;
-draw z1--z2 withcolor .7 white;
-dotlabel.llft("$z_1$",z1);
-dotlabel.urt("$z_2$",z2);
-
-begingroup; interim ahangle := 180; interim ahlength := 3;
-drawdblarrow (z1--z2) shifted (12 up rotated angle (z2-z1)) withcolor 2/3 blue;
-endgroup;
-
-drawoptions(withcolor 2/3 red);
-label.lrt("Here",do_brace(z1,z2,-12,3/4));
-drawoptions();
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/braces.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brachisto.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brachisto.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brachisto.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,56 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-
- path Y, L, C, P, S;
-
- % cycloid
- numeric r, s; r = 160;
- def sin(expr x) = sind( 57.29577951308232 x) enddef;
- def cos(expr x) = cosd( 57.29577951308232 x) enddef;
- vardef u(expr x) = x - sin(x) enddef;
- vardef v(expr x) = 1 - cos(x) enddef;
- vardef f(expr t) = u(t) < v(t) enddef;
- tolerance := epsilon;
- numeric a; a = solve f(2,3);
-
- Y = (origin for t = 1 upto 128: -- (u(t / 128 * a), -v(t / 128 * a)) endfor) scaled r;
-
- % Y = origin for t=5 step 5 until 140:
- % -- (0, r) rotated t shifted (t / 57.29577951308232 * r, -r)
- % endfor cutafter (origin -- 4r * dir -45);
-
- z0 = point 0 of Y;
- z1 = point infinity of Y;
-
- % line
- L = z0 -- z1;
-
- % circle
- C = quartercircle rotated 180 scaled 2x1 shifted (x1, y0);
-
- % parabola f = x^2, f' = 2x
- P = z0{1,-2} ... (xpart 1/2[z1, z0], ypart 1/4[z1, z0]){1,-1} ... z1 {1, 0};
-
- % sixth degree f = x^6, f' = 6x^5
- S = z0{1,-6} ... (xpart 1/2[z1, z0], ypart 1/64[z1, z0]){1, -6/32} ... z1 {1, 0};
-
- % axes
- draw z0 -- (x0,y1) -- z1 withcolor 3/4;
-
- drawoptions(withcolor 2/3 red); draw L; dotlabel.urt("Line", point 1/4 of L);
- drawoptions(withcolor 1/2 green); draw C; dotlabel.urt("Circle", point 1 of C);
- drawoptions(withcolor 1/4[red, green]); draw P; dotlabel.urt("Parabola", point 1/2 of P);
- drawoptions(withcolor 3/4[red, green]); draw S; dotlabel.llft("Sixth degree", point 3/4 of S);
- drawoptions(withcolor 1/2 blue); draw Y; dotlabel.urt("Cycloid", point 100 of Y);
- drawoptions();
-
- dotlabel.ulft("$A$", z0);
- dotlabel.urt("$B$", z1);
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brachisto.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brexit-map.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brexit-map.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brexit-map.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,99 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\mplibtextextlabel{enable}
-\begin{document}
-\begin{mplibcode}
-input london-boroughs
-input colorbrewer-rgb
-vardef median(expr p) =
- save n; numeric n; n = length p;
- 1/n * point 0 of p for i=1 upto n: + 1/n * point i of p endfor
-enddef;
-
-beginfig(1);
-
-fill Barking_and_Dagenham withcolor 0.638 [white, RdYlBu 9 3]; draw Barking_and_Dagenham;
-fill Barnet withcolor 0.721 [white, RdYlBu 9 6]; draw Barnet;
-fill Bexley withcolor 0.752 [white, RdYlBu 9 3]; draw Bexley;
-fill Brent withcolor 0.650 [white, RdYlBu 9 5]; draw Brent;
-fill Bromley withcolor 0.788 [white, RdYlBu 9 5]; draw Bromley;
-fill Camden withcolor 0.654 [white, RdYlBu 9 7]; draw Camden;
-fill City_of_London withcolor 0.735 [white, RdYlBu 9 7]; draw City_of_London;
-fill Croydon withcolor 0.698 [white, RdYlBu 9 5]; draw Croydon;
-fill Ealing withcolor 0.700 [white, RdYlBu 9 5]; draw Ealing;
-fill Enfield withcolor 0.690 [white, RdYlBu 9 5]; draw Enfield;
-fill Greenwich withcolor 0.695 [white, RdYlBu 9 5]; draw Greenwich;
-fill Hackney withcolor 0.651 [white, RdYlBu 9 7]; draw Hackney;
-fill Hammersmith_and_Fulham withcolor 0.699 [white, RdYlBu 9 6]; draw Hammersmith_and_Fulham;
-fill Haringey withcolor 0.705 [white, RdYlBu 9 7]; draw Haringey;
-fill Harrow withcolor 0.722 [white, RdYlBu 9 5]; draw Harrow;
-fill Havering withcolor 0.760 [white, RdYlBu 9 3]; draw Havering;
-fill Hillingdon withcolor 0.689 [white, RdYlBu 9 4]; draw Hillingdon;
-fill Hounslow withcolor 0.697 [white, RdYlBu 9 5]; draw Hounslow;
-fill Islington withcolor 0.703 [white, RdYlBu 9 7]; draw Islington;
-fill Kensington_and_Chelsea withcolor 0.659 [white, RdYlBu 9 6]; draw Kensington_and_Chelsea;
-fill Kingston_upon_Thames withcolor 0.783 [white, RdYlBu 9 6]; draw Kingston_upon_Thames;
-fill Lambeth withcolor 0.673 [white, RdYlBu 9 7]; draw Lambeth;
-fill Lewisham withcolor 0.630 [white, RdYlBu 9 6]; draw Lewisham;
-fill Merton withcolor 0.734 [white, RdYlBu 9 6]; draw Merton;
-fill Newham withcolor 0.592 [white, RdYlBu 9 5]; draw Newham;
-fill Redbridge withcolor 0.675 [white, RdYlBu 9 5]; draw Redbridge;
-fill Richmond_upon_Thames withcolor 0.820 [white, RdYlBu 9 6]; draw Richmond_upon_Thames;
-fill Southwark withcolor 0.661 [white, RdYlBu 9 7]; draw Southwark;
-fill Sutton withcolor 0.760 [white, RdYlBu 9 4]; draw Sutton;
-fill Tower_Hamlets withcolor 0.645 [white, RdYlBu 9 6]; draw Tower_Hamlets;
-fill Waltham_Forest withcolor 0.666 [white, RdYlBu 9 5]; draw Waltham_Forest;
-fill Wandsworth withcolor 0.719 [white, RdYlBu 9 7]; draw Wandsworth;
-fill Westminster withcolor 0.649 [white, RdYlBu 9 6]; draw Westminster;
-
-label("\tiny Barking \& Dagenham", median(Barking_and_Dagenham));
-label("\tiny Barnet", median(Barnet));
-label("\tiny Bexley", median(Bexley));
-label("\tiny Brent", median(Brent));
-label("\tiny Bromley", median(Bromley));
-label("\tiny Camden", median(Camden));
-label("\tiny City of London", median(City_of_London));
-label("\tiny Croydon", median(Croydon));
-label("\tiny Ealing", median(Ealing));
-label("\tiny Enfield", median(Enfield));
-label("\tiny Greenwich", median(Greenwich));
-label("\tiny Hackney", median(Hackney));
-label(TEX("\tiny Hammersmith \& Fulham") rotated -62, median(Hammersmith_and_Fulham));
-label("\tiny Haringey", median(Haringey));
-label("\tiny Harrow", median(Harrow));
-label("\tiny Havering", median(Havering));
-label("\tiny Hillingdon", median(Hillingdon));
-label("\tiny Hounslow", median(Hounslow) shifted 12 left);
-label("\tiny Islington", median(Islington));
-label(TEX("\tiny Kensington \& Chelsea") rotated -54, median(Kensington_and_Chelsea));
-label(TEX("\tiny Kingston upon Thames") rotated 66, median(Kingston_upon_Thames));
-label("\tiny Lambeth", median(Lambeth));
-label("\tiny Lewisham", median(Lewisham));
-label("\tiny Merton", median(Merton));
-label("\tiny Newham", median(Newham));
-label("\tiny Redbridge", median(Redbridge));
-label("\tiny Richmond upon Thames", median(Richmond_upon_Thames));
-label("\tiny Southwark", median(Southwark));
-label("\tiny Sutton", median(Sutton));
-label("\tiny Tower Hamlets", median(Tower_Hamlets));
-label("\tiny Waltham Forest", median(Waltham_Forest));
-label("\tiny Wandsworth", median(Wandsworth));
-label("\tiny Westminster", median(Westminster));
-
-label("\tiny Barking \& Dagenham", median(Barking_and_Dagenham));
-picture legend; legend = image(
-numeric s; s = 10;
-for i = 1 upto 9:
- fill unitsquare scaled s shifted (i*s, 0) withcolor RdYlBu [9][i];
- if i > 1: draw (i*s, 0) -- (i*s, s); fi
-endfor
-draw unitsquare xscaled 9s yscaled s shifted (s,0);
-label.top("Remain" infont "phvr8r", (10s, s));
-label.top("Leave" infont "phvr8r", (s, s)););
-label.ulft(legend, point 1 of bbox currentpicture);
-label.lrt("Brexit vote in London 2016" infont "phvr8r", point 3 of bbox currentpicture);
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brexit-map.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/brown3a.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/callout.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/callout.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/callout.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,19 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path a; a = (left .. right) scaled 42;
-pair P; P = origin; r = 31;
-draw a rotated r withcolor 2/3 red; draw a rotated (90+r) withcolor 2/3 red;
-drawdot P withpen pencircle scaled dotlabeldiam;
-label("$P$", P shifted 10 dir 68);
- z0 = P + 20 dir -20;
- draw z0 -- P
- cutafter fullcircle scaled 8 shifted P
- withpen pencircle scaled 1/4;
- label.rt("\textit{pole}", z0);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/callout.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,49 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+r = 0.9;
+z0 = (0, 0);
+z1 = r*(89, -55);
+z2 = r*(42, 30);
+z3 = z1 + z2;
+
+picture FE, FEV, E, EV, M, N, U, V;
+FE = thelabel("$f^*E$", (x0, y0));
+M = thelabel("$M$", (x0, y1));
+E = thelabel("$E$", (x1, y0));
+N = thelabel("$N$", (x1, y1));
+FEV = thelabel("$f^*E_V$", (x2, y2));
+U = thelabel("$U$", (x2, y3));
+EV = thelabel("$E_V$", (x3, y2));
+V = thelabel("$V$", (x3, y3));
+
+forsuffixes @=E, M, N, U, V, EV, FE, FEV: draw @; endfor
+
+ahangle := 20;
+vardef connect(expr a, b) =
+ save line; path line; interim bboxmargin := 3;
+ line = center a .. center b cutbefore bbox a cutafter bbox b;
+ cutdraw line withpen pencircle scaled 4 withcolor background;
+ drawarrow line
+enddef;
+
+connect(FEV, EV);
+connect(FEV, U);
+connect(EV, V);
+connect(U, V);
+
+connect(FEV, FE);
+connect(EV, E);
+connect(U, M);
+connect(V, N);
+
+connect(FE, E);
+connect(FE, M);
+connect(E, N);
+connect(M, N);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-tikzcd-example.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,44 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ picture U, XY, X, Y, Z;
+ z1 = -z2 = (-61, 42);
+ U = thelabel("$U$", z1);
+ XY = thelabel("$X\times_ZY$", origin);
+ X = thelabel("$X$", (x2, 0));
+ Y = thelabel("$Y$", (0, y2));
+ Z = thelabel("$Z$", z2);
+
+ forsuffixes @=U, XY, X, Y, Z: draw @; endfor
+
+ ahangle := 20;
+ vardef connect@#(expr s, a, b) =
+ curved_connect@#(s, a, b, center b - center a)
+ enddef;
+ vardef curved_connect@#(expr s, a, b, d) =
+ save line, mark; path line; picture mark;
+ line = center a {d} .. center b;
+ interim bboxmargin := 4;
+ drawarrow line cutbefore bbox a cutafter bbox b;
+ mark = thelabel@#("$\scriptstyle " & s & "$",
+ point 1/2 of line);
+ interim bboxmargin := 1;
+ unfill bbox mark; draw mark;
+ enddef;
+
+ connect.bot("p", XY, X);
+ connect.rt ("q", XY, Y);
+ connect.top("g", Y, Z);
+ connect.lft("f", X, Z);
+ curved_connect.urt("x", U, X, right);
+ curved_connect.llft("y", U, Y, dir -80);
+
+ drawoptions(dashed withdots scaled 1/2);
+ connect("(x,y)", U, XY);
+ drawoptions();
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cd-xypic-example.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/circumcircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/circumcircle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/circumcircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,49 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef through(expr a, b, o) =
- save t; numeric t; t = 1+o/abs(a-b);
- t[b,a] -- t[a,b]
-enddef;
-
-beginfig(1);
- path T; T = origin -- 377 dir 10 -- 233 dir 70 -- cycle;
- pair m;
- m = whatever * (point 0 of T - point 1 of T) rotated 90 shifted point 1/2 of T
- = whatever * (point 1 of T - point 2 of T) rotated 90 shifted point 3/2 of T
- = whatever * (point 2 of T - point 3 of T) rotated 90 shifted point 5/2 of T;
-
- drawoptions(withcolor 3/4);
- draw unitsquare scaled 5 rotated angle (point 1 of T-point 0 of T) shifted point 1/2 of T;
- draw unitsquare scaled 5 rotated angle (point 2 of T-point 1 of T) shifted point 3/2 of T;
- draw unitsquare scaled 5 rotated angle (point 0 of T-point 2 of T) shifted point 5/2 of T;
- drawoptions(dashed evenly scaled 1/4 withcolor 1/2);
- draw through(point 1/2 of T, m, 10);
- draw through(point 3/2 of T, m, 10);
- draw through(point 5/2 of T, m, 10);
- drawoptions();
- draw fullcircle scaled 2 abs (point 0 of T - m) shifted m withcolor 2/3 red;
- draw T;
-
- draw m withpen pencircle scaled dotlabeldiam; label("$m$", m + 10 dir 12);
-
-vardef mark_equal(expr a, b, n) =
- save m, s; picture m; m = image(
- numeric s; 2s = n - 1; for t=-s upto s:
- draw (down--up) scaled 2 rotated -13 shifted (t,0) withpen pencircle scaled 1/4;
- endfor
- );
- draw m rotated angle (b-a) shifted 1/4[a,b];
- draw m rotated angle (b-a) shifted 3/4[a,b];
-enddef;
-
- mark_equal(point 0 of T, point 1 of T, 1);
- mark_equal(point 1 of T, point 2 of T, 2);
- mark_equal(point 2 of T, point 0 of T, 3);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/circumcircle.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/clocks.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/clocks.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/clocks.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -7,11 +7,14 @@
enddef;
path hand[];
-hand1 = origin .. (.257,1/50) .. (.377,1/60) & (.377,1/60) {up} .. (.40,3/50) .. (.60, 1/40) .. {right} (.75,0);
-hand1 := (hand1 .. reverse hand1 reflectedabout(left,right) .. cycle) scaled 50;
-
+hand1 = origin .. (.257,1/50) .. (.377,1/60)
+ & (.377,1/60) {up} .. (.40,3/50)
+ .. (.60, 1/40) .. {right} (.75,0);
+hand1 := (hand1 .. reverse hand1 reflectedabout(left,right)
+ .. cycle) scaled 50;
hand2 = origin .. (.60, 1/64) .. {right} (.925,0);
-hand2 := (hand2 .. reverse hand2 reflectedabout(left,right) .. cycle) scaled 50;
+hand2 := (hand2 .. reverse hand2 reflectedabout(left,right)
+ .. cycle) scaled 50;
% hour of the day to degrees
vardef htod(expr hours) = 30*((15-hours) mod 12) enddef;
@@ -31,17 +34,13 @@
endfor
% numerals
for h=1 upto 12:
- label(
- if known roman_numerals_please:
- clock_roman h infont "bchr8r" rotated ((12-h)*30)
- else:
- decimal h infont "bchr8r"
- fi, (40,0) rotated htod(h));
+ label(decimal h infont "bchr8r", (40,0) rotated htod(h));
endfor
% hands rotated to the given time
- filldraw hand1 rotated htod(hours+minutes/60) withpen pencircle scaled 7/8;
- filldraw hand2 rotated mtod(minutes) withpen pencircle scaled 7/8;
+ pickup pencircle scaled 7/8;
+ filldraw hand1 rotated htod(hours+minutes/60);
+ filldraw hand2 rotated mtod(minutes);
% draw the center on top
- fill fullcircle scaled 5;
- fill fullcircle scaled 3 withcolor .4 white;
+ draw origin withpen pencircle scaled 5;
+ undraw origin withpen pencircle scaled 3;
) enddef;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-antireuleaux-set.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-antireuleaux-set.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-antireuleaux-set.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,27 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-\mplibtextextlabel{enable}
-vardef reuleaux(expr n, r) =
- save a; numeric a; a = 90/n;
- for t = 0 step 4a until 359:
- (0, r) rotated t {left rotated (3a + t)} .. {left rotated (a + t)}
- endfor cycle
-enddef;
-vardef median(expr p) = origin for i=1 upto length p: + point i of p / length p endfor enddef;
-input colorbrewer-rgb
-beginfig(1);
- for n = 3 upto 7:
- path p; p = reuleaux(n, 42) shifted (90n, 0);
- pair m; m = point (n+1)/2 of p;
- fill p withcolor if odd n: Oranges else: Blues fi 8 2;
- % draw tensepath(p) withcolor Blues 8 6;
- %draw p rotatedabout(median(p), 180/n) withcolor Blues 8 6;
- draw p;
- endfor
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-antireuleaux-set.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-fixed-polygon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-fixed-polygon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-fixed-polygon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,19 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-vardef polygon_with_side(expr n, s) =
- save a, b, r; numeric a, b, r;
- a * n = 360; a + 2b = 180; r = s * sind(b) / sind(a);
- for i = 0 upto n-1: (0, r) rotated (a * i) -- endfor cycle
-enddef;
-for n = 11 downto 3:
- path p; p = polygon_with_side(n, 72);
- fill p withcolor (n/32)[white, 3/4 if odd n: red else: blue fi];
- draw p;
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-fixed-polygon.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-points.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-points.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-points.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,66 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef median primary P =
- (origin for i=1 upto length P: + point i of P endfor) / length P
-enddef;
-
-primarydef p enlarged s = p shifted -median p scaled s shifted median p enddef;
-
-path u, c, s;
-u = unitsquare shifted -(1/2, 1/2) scaled 72;
-c = fullcircle scaled 72 shifted 108 right;
-s = (superellipse(right, up, left, down, 0.8)) scaled 36 shifted 216 right;
-
-picture p[];
-p1 = image(
-draw origin--left scaled 50 withcolor background;
-ahangle := 30; numeric r, x; r = 9/16; x = -1;
-forsuffixes $=u, c, s:
- drawarrow subpath(r, r + length $) of $;
- draw fullcircle scaled 2 shifted median $ withcolor .67 red;
- for i=0 upto length $-1:
- fill fullcircle scaled 2 shifted point i of $ withcolor .67 red;
- label(decimal i, point i of ($ enlarged 1.15));
- endfor
-endfor);
-
-p2 = image(
-draw origin--left scaled 50 withcolor background;
-forsuffixes $=u,c,s:
- fill median $ -- subpath (1,2) of $ -- cycle withcolor .8[blue,white];
- draw median $ -- point 1 of $;
- draw median $ -- point 2 of $;
- draw $;
-endfor
-);
-
-p3 = image(
-draw origin--left scaled 50 withcolor background;
-forsuffixes $=u,c,s:
- r := 1/5 length $;
- fill median $ -- subpath (0,r) of $ -- cycle withcolor .8[red,white];
- draw median $ -- point 0 of $;
- draw median $ -- point r of $;
- draw $;
- endfor
-);
-
-p4 = image(
-draw origin--left scaled 50 withcolor background;
-forsuffixes $=u,c,s:
- fill median $ -- subpath (-1,1) of $ -- cycle withcolor .8[black,white];
- draw median $ -- point -1 of $;
- draw median $ -- point 1 of $;
- draw $;
- endfor
-);
-
-beginfig(1);
-for i=1 upto 4: draw p[i] shifted (0,-108i); endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-points.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-chain.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-chain.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-chain.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,18 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input archimedean-tools
-beginfig(1);
- path P[]; P3 = for i=0 upto 2: 6 up rotated 120i -- endfor cycle;
- fill P3 withcolor 3/4 red; draw P3;
- for n = 4 upto 23:
- numeric m; m = floor(n / 2);
- P[n] = poly n of subpath (m, m-1) of P[n-1];
- fill P[n] withcolor (n/32)[3/4 if odd n: red else: blue fi, white];
- draw P[n]; label(decimal n, median(P[n]));
- endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-chain.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-tops.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-tops.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-tops.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,35 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef median primary P =
- (origin for i=1 upto length P: + point i of P endfor) / length P
-enddef;
-
-primarydef p enlarged s = p shifted -median p scaled s shifted median p enddef;
-
-vardef polygon(expr n, r) =
- for i = 0 upto n - 1: (0, r) rotated (360 / n * i) -- endfor cycle
-enddef;
-
-path u, c, s;
-u = polygon(5, 36);
-c = polygon(6, 36) shifted 108 right;
-s = polygon(7, 36) shifted 216 right;
-
-beginfig(1);
-draw origin--left scaled 50 withcolor background;
-ahangle := 30; numeric r, x; r = 9/16; x = -1;
-forsuffixes $=u, c, s:
- drawarrow subpath(r, r + length $) of $;
- draw fullcircle scaled 2 shifted median $ withcolor .67 red;
- for i=0 upto length $-1:
- fill fullcircle scaled 2 shifted point i of $ withcolor .67 red;
- label(decimal i, point i of ($ enlarged 1.15));
- endfor
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygon-tops.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygons.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygons.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygons.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,70 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef median primary P =
- (origin for i=1 upto length P: + point i of P endfor) / length P
-enddef;
-
-primarydef p enlarged s = p shifted -median p scaled s shifted median p enddef;
-
-vardef polygon(expr n, r) =
- for i = 0 upto n - 1: (r, 0) rotated (360 / n * i) -- endfor cycle
-enddef;
-
-path u, c, s;
-u = polygon(5, 36);
-c = polygon(6, 36) shifted 108 right;
-s = polygon(7, 36) shifted 216 right;
-
-picture p[];
-p1 = image(
-draw origin--left scaled 50 withcolor background;
-ahangle := 30; numeric r, x; r = 9/16; x = -1;
-forsuffixes $=u, c, s:
- drawarrow subpath(r, r + length $) of $;
- draw fullcircle scaled 2 shifted median $ withcolor .67 red;
- for i=0 upto length $-1:
- fill fullcircle scaled 2 shifted point i of $ withcolor .67 red;
- label(decimal i, point i of ($ enlarged 1.15));
- endfor
-endfor);
-
-p2 = image(
-draw origin--left scaled 50 withcolor background;
-forsuffixes $=u,c,s:
- fill median $ -- subpath (1,2) of $ -- cycle withcolor .8[blue,white];
- draw median $ -- point 1 of $;
- draw median $ -- point 2 of $;
- draw $;
-endfor
-);
-
-p3 = image(
-draw origin--left scaled 50 withcolor background;
-forsuffixes $=u,c,s:
- r := 1/5 length $;
- fill median $ -- subpath (0,r) of $ -- cycle withcolor .8[red,white];
- draw median $ -- point 0 of $;
- draw median $ -- point r of $;
- draw $;
- endfor
-);
-
-p4 = image(
-draw origin--left scaled 50 withcolor background;
-forsuffixes $=u,c,s:
- fill median $ -- subpath (-1,1) of $ -- cycle withcolor .8[black,white];
- draw median $ -- point -1 of $;
- draw median $ -- point 1 of $;
- draw $;
- endfor
-);
-
-beginfig(1);
-for i=1 upto 4: draw p[i] shifted (0,-108i); endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-polygons.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-geometry.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-geometry.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-geometry.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,66 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef urp(expr n) =
- save a; numeric a; a = 90/n;
- for i=0 upto n-1:
- 1/2 up rotated (a * 4i) {left rotated (a + a * 4i)} .. {left rotated (3a + a * 4i)}
- endfor cycle
-enddef;
-vardef through@#(expr a, b) = save d; numeric d; d = abs(a-b);
- (1+@#/d)[b, a] -- (1+@#/d)[a, b] enddef;
-input colorbrewer-rgb
-beginfig(1);
- path p, c; p = urp(5) scaled 320; c = fullcircle scaled 320;
-
- pair A, B, C;
- A = point 0 of p;
- B = point 1 of p;
- C = point 3 of p;
-
- drawoptions(withcolor 7/8);
- draw c;
- draw through 42(origin, A);
- draw through 42(origin, B);
- draw through 42(C, A);
- draw through 42(C, B);
- draw through 42(B, B shifted 64 up);
-
- forsuffixes $=origin, B:
- draw (left--right) scaled 2 rotated 13 shifted $ shifted 42 up;
- draw (left--right) scaled 2 rotated 13 shifted $ shifted 41 up;
- endfor
- ahangle := 30;
- forsuffixes $=A, B:
- drawarrow (reverse unitsquare scaled 5 -- 48 up) rotated angle ($ - C) shifted $;
- endfor
-
- drawoptions();
- draw p withcolor Reds 8 7;
- numeric a; a = 18;
- label("$\alpha$", 32 dir 11/2 a shifted A);
- label("$\alpha$", 32 dir 31/2 a shifted A);
- label("$\alpha$", 32 dir 17/2 a shifted B);
- label("$\alpha$", 32 dir 37/2 a shifted B);
- label("$2\alpha$", 28 dir 14/2 a shifted C);
- label("$3\alpha$", 24 dir 13/2 a shifted B);
- label("$4\alpha$", 20 dir 7a);
-
- dotlabel.urt("$A$", A);
- dotlabel.lrt("$B$", B);
- dotlabel.lrt("$C$", C);
- dotlabel.urt("$O$", origin);
-
- label.lft("$r$", 1/2 A);
-
-label.bot(btex \vbox{\hsize 4in \small\noindent
-This proof only works for Reuleaux polygons with an odd number of sides,
-because otherwise the point $C$ does not (quite) lie on the circle.\strut} etex,
-point 1/2 of bbox currentpicture shifted 21 down);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-geometry.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-set.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-set.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-set.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,31 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-\mplibtextextlabel{enable}
-vardef reuleaux(expr n, r) =
- save a; numeric a; a = 90/n;
- for t = 0 step 4a until 359:
- (0, r) rotated t {left rotated (a + t)} .. {left rotated (3a + t)}
- endfor cycle
-enddef;
-vardef median(expr p) = origin for i=1 upto length p: + point i of p / length p endfor enddef;
-input colorbrewer-rgb
-beginfig(1);
- for n = 3 upto 7:
- path p; p = reuleaux(n, 42) shifted (90n, 0);
- pair m; m = point (n+1)/2 of p;
- fill p withcolor if odd n: Oranges else: Blues fi 8 2;
- fill subpath (0, 1) of p -- m -- cycle
- withcolor if odd n: Oranges else: Blues fi 8 3;
- %draw fullcircle scaled 2 abs(point 0 of p - m) shifted m
- % withpen pencircle scaled 2 withcolor 3/4;
- %draw tensepath(p) withcolor Blues 8 6;
- %draw p rotatedabout(median(p), 180/n) withcolor Blues 8 6;
- draw p;
- endfor
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-reuleaux-set.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-standards.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-standards.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-standards.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,28 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\def \id#1{\mathord{\hbox{\it #1\/}}}
-\def \kw#1{{\hbox{\bf #1\thinspace}}}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-path unitse; unitse = superellipse(1/2 right, 1/2 up, 1/2 left, 1/2 down,.8);
-path xx, yy; xx = (left -- right) scaled 144; yy = (down -- up) scaled 89;
-path u, c, s;
-u = unitsquare scaled 72;
-c = fullcircle scaled 72;
-s = unitse scaled 72;
-
-beginfig(1);
-drawarrow xx withcolor .67 white;
-drawarrow yy withcolor .67 white;
-draw u; label.top("$\id{unitsquare}$", point 5/2 of u);
-drawoptions(withcolor .67 red);
-draw c; label("$\id{fullcircle}$", 3/4[point 2 of c, point 6 of c]);
-drawoptions(withcolor .67 blue);
-draw s; label.lrt("$\id{superellipse}()$", point 7 of s);
-drawoptions();
-dotlabel.bot("$\scriptstyle (1,0)$", point 1 of u);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-standards.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-triangles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-triangles.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-triangles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,29 +0,0 @@
-\documentclass{standalone}
-\usepackage{dwmpcode}
-\usepackage{luamplib}
-\mplibtextextlabel{enable}
-\def \kw#1{\mathop{\hbox{\bf #1\thinspace}}}
-\def \id#1{\mathord{\hbox{\it #1\/}}}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-path xx, yy; xx = left scaled 8 -- right scaled 89; yy = down scaled 8 -- up scaled 55;
-path t; t = origin -- (55,0) -- (55,34) -- cycle;
-picture p[];
-p1 = image(
-ahangle := 30;
-drawarrow xx withcolor .67 white;
-drawarrow yy withcolor .67 white;
-fill t withcolor .8[blue,white]);
-
-p2 = image(
-draw p1;
-draw t;
-dotlabel.rt(btex $(55,34)$ etex scaled 0.8, point 2 of t);
-) shifted 144 right;
-draw p1; draw p2;
-label.bot(btex \mpl{fill t withcolor 0.8[blue,white];} etex scaled 0.8, point 1/2 of bbox p1);
-label.bot(btex \mpl{draw t;} etex scaled 0.8, point 1/2 of bbox p2);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/closed-triangles.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blend-toy.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blend-toy.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blend-toy.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,19 +3,19 @@
\begin{document}
\begin{mplibcode}
beginfig(1);
- color brg, pbr;
- brg = 1/256 (1, 66, 37);
- pbr = 1/256 (223, 52, 57);
- N = 5; n = 0;
- for y=1 upto N:
- for x=1 upto N:
- fill fullcircle scaled 16 shifted 20(x,y)
- withpen pencircle scaled 2
- withcolor (n/N/N)[pbr, brg];
- label(decimal incr n infont "phvr8r", 20(x,y))
- withcolor white;
- endfor
+color brg, pbr;
+brg = 1/256 (1, 66, 37); % British Racing Green
+pbr = 1/256 (223, 52, 57); % Pillar Box Red
+N = 5; n = 0;
+for y=1 upto N:
+ for x=1 upto N:
+ fill fullcircle scaled 16 shifted 20(x,y)
+ withpen pencircle scaled 2
+ withcolor (n/N/N)[pbr, brg];
+ label(decimal incr n infont "phvr8r", 20(x,y))
+ withcolor white;
endfor
+endfor
endfig;
\end{mplibcode}
\end{document}
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,44 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\usepackage{fontspec}
+\setmainfont{Helvetica}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path C[], B[];
+
+% arrange each circle so that point 0 is outside the others
+C1 = fullcircle scaled 100 rotated 90 shifted 40 up;
+C2 = C1 rotated 120;
+C3 = C2 rotated 120;
+
+% the illusion of blended colours is helped by buildcycle
+B0 = buildcycle(C1, C2, C3);
+B1 = buildcycle(C1, C2);
+B2 = buildcycle(C2, C3);
+B3 = buildcycle(C3, C1);
+
+picture P;
+for x=0 upto 1:
+ for y=0 upto 1:
+ P := image(
+ s := 1/2 + x/4;
+ k := 0 + y/4;
+ fill C1 withcolor s*(1,0,0,k);
+ fill C2 withcolor s*(0,1,0,k);
+ fill C3 withcolor s*(0,0,1,k);
+ fill B3 withcolor s*(1,0,1,k);
+ fill B2 withcolor s*(0,1,1,k);
+ fill B1 withcolor s*(1,1,0,k);
+ fill B0 withcolor s*(1,1,1,k);
+ undraw C1; undraw C2; undraw C3;
+ ) shifted (200x, 180y);
+ draw P;
+ label.bot(("shade: " & decimal s & ", k: " & decimal k)
+ infont "phvr8r", point 1/2 of bbox P);
+ endfor
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-blended-circles.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,104 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\mplibtextextlabel{enable}
+\usepackage{fontspec}
+\setmainfont{TeX Gyre Heros}
+\begin{document}
+\begin{mplibcode}
+input london-boroughs
+input colorbrewer-rgb
+picture legend; legend = image(
+for i = 1 upto 9:
+ path s; s = unitsquare scaled 12 shifted (12i, 0);
+ fill s withcolor RdYlBu[9][i]; draw s;
+ if i = 1:
+ label.top("Leave", point 5/2 of s);
+ elseif i = 9:
+ label.top("Remain", point 5/2 of s);
+ fi
+endfor
+);
+vardef median(expr p) =
+ save n; numeric n; n = length p;
+ 1/n * point 0 of p for i=1 upto n: + 1/n * point i of p endfor
+enddef;
+
+beginfig(1);
+
+fill Barking_and_Dagenham withcolor 0.756 [RdYlBu 9 3, RdYlBu 9 4]; draw Barking_and_Dagenham;
+fill Barnet withcolor 0.223 [RdYlBu 9 6, RdYlBu 9 7]; draw Barnet;
+fill Bexley withcolor 0.705 [RdYlBu 9 3, RdYlBu 9 4]; draw Bexley;
+fill Brent withcolor 0.974 [RdYlBu 9 5, RdYlBu 9 6]; draw Brent;
+fill Bromley withcolor 0.065 [RdYlBu 9 5, RdYlBu 9 6]; draw Bromley;
+fill Camden withcolor 0.494 [RdYlBu 9 7, RdYlBu 9 8]; draw Camden;
+fill City_of_London withcolor 0.529 [RdYlBu 9 7, RdYlBu 9 8]; draw City_of_London;
+fill Croydon withcolor 0.429 [RdYlBu 9 5, RdYlBu 9 6]; draw Croydon;
+fill Ealing withcolor 0.040 [RdYlBu 9 6, RdYlBu 9 7]; draw Ealing;
+fill Enfield withcolor 0.582 [RdYlBu 9 5, RdYlBu 9 6]; draw Enfield;
+fill Greenwich withcolor 0.559 [RdYlBu 9 5, RdYlBu 9 6]; draw Greenwich;
+fill Hackney withcolor 0.848 [RdYlBu 9 7, RdYlBu 9 8]; draw Hackney;
+fill Hammersmith_and_Fulham withcolor 0.002 [RdYlBu 9 7, RdYlBu 9 8]; draw Hammersmith_and_Fulham;
+fill Haringey withcolor 0.557 [RdYlBu 9 7, RdYlBu 9 8]; draw Haringey;
+fill Harrow withcolor 0.463 [RdYlBu 9 5, RdYlBu 9 6]; draw Harrow;
+fill Havering withcolor 0.034 [RdYlBu 9 3, RdYlBu 9 4]; draw Havering;
+fill Hillingdon withcolor 0.363 [RdYlBu 9 4, RdYlBu 9 5]; draw Hillingdon;
+fill Hounslow withcolor 0.106 [RdYlBu 9 5, RdYlBu 9 6]; draw Hounslow;
+fill Islington withcolor 0.522 [RdYlBu 9 7, RdYlBu 9 8]; draw Islington;
+fill Kensington_and_Chelsea withcolor 0.869 [RdYlBu 9 6, RdYlBu 9 7]; draw Kensington_and_Chelsea;
+fill Kingston_upon_Thames withcolor 0.161 [RdYlBu 9 6, RdYlBu 9 7]; draw Kingston_upon_Thames;
+fill Lambeth withcolor 0.862 [RdYlBu 9 7, RdYlBu 9 8]; draw Lambeth;
+fill Lewisham withcolor 0.986 [RdYlBu 9 6, RdYlBu 9 7]; draw Lewisham;
+fill Merton withcolor 0.294 [RdYlBu 9 6, RdYlBu 9 7]; draw Merton;
+fill Newham withcolor 0.284 [RdYlBu 9 5, RdYlBu 9 6]; draw Newham;
+fill Redbridge withcolor 0.397 [RdYlBu 9 5, RdYlBu 9 6]; draw Redbridge;
+fill Richmond_upon_Thames withcolor 0.929 [RdYlBu 9 6, RdYlBu 9 7]; draw Richmond_upon_Thames;
+fill Southwark withcolor 0.281 [RdYlBu 9 7, RdYlBu 9 8]; draw Southwark;
+fill Sutton withcolor 0.628 [RdYlBu 9 4, RdYlBu 9 5]; draw Sutton;
+fill Tower_Hamlets withcolor 0.746 [RdYlBu 9 6, RdYlBu 9 7]; draw Tower_Hamlets;
+fill Waltham_Forest withcolor 0.910 [RdYlBu 9 5, RdYlBu 9 6]; draw Waltham_Forest;
+fill Wandsworth withcolor 0.503 [RdYlBu 9 7, RdYlBu 9 8]; draw Wandsworth;
+fill Westminster withcolor 0.897 [RdYlBu 9 6, RdYlBu 9 7]; draw Westminster;
+
+% scaling represents turnout
+label(TEX("Barking \& Dagenham") scaled 0.637 rotated 15, median(Barking_and_Dagenham));
+label(TEX("Barnet") scaled 0.720, median(Barnet) shifted 12 up);
+label(TEX("Bexley") scaled 0.752, median(Bexley) shifted 12 left);
+label(TEX("Brent") scaled 0.649, median(Brent) shifted 12 left);
+label(TEX("Bromley") scaled 0.788, median(Bromley));
+label(TEX("Camden") scaled 0.654, median(Camden) shifted 6 left);
+label(TEX("City") scaled 0.734, median(City_of_London));
+label(TEX("Croydon") scaled 0.697, median(Croydon));
+label(TEX("Ealing") scaled 0.699, median(Ealing));
+label(TEX("Enfield") scaled 0.690, median(Enfield));
+label(TEX("Greenwich") scaled 0.694, median(Greenwich) shifted 6 right);
+label(TEX("Hackney") scaled 0.650, median(Hackney) shifted 8 right);
+label(TEX("Hammersmith \& Fulham") scaled 0.698 rotated -62, median(Hammersmith_and_Fulham));
+label(TEX("Haringey") scaled 0.705, median(Haringey));
+label(TEX("Harrow") scaled 0.721, median(Harrow));
+label(TEX("Havering") scaled 0.759, median(Havering));
+label(TEX("Hillingdon") scaled 0.689, median(Hillingdon) shifted 6 right);
+label(TEX("Hounslow") scaled 0.697, median(Hounslow) shifted 12 left);
+label(TEX("Islington") scaled 0.703, median(Islington) shifted 4 right);
+label(TEX("Kensington \& Chelsea") scaled 0.659 rotated -54, median(Kensington_and_Chelsea));
+label(TEX("Kingston upon Thames") scaled 0.783 rotated 66, median(Kingston_upon_Thames));
+label(TEX("Lambeth") scaled 0.673, median(Lambeth) shifted 4 left);
+label(TEX("Lewisham") scaled 0.630, median(Lewisham) shifted 8 right);
+label(TEX("Merton") scaled 0.734, median(Merton));
+label(TEX("Newham") scaled 0.591, median(Newham));
+label(TEX("Redbridge") scaled 0.675, median(Redbridge));
+label.lft(TEX("Richmond") scaled 0.820, median(Richmond_upon_Thames) shifted (-1,4));
+label.rt(TEX("upon Thames") scaled 0.820, median(Richmond_upon_Thames) shifted (-9,-6));
+label(TEX("Southwark") scaled 0.661, median(Southwark) shifted 4 left);
+label(TEX("Sutton") scaled 0.759, median(Sutton));
+label(TEX("Tower Hamlets") scaled 0.644, median(Tower_Hamlets) shifted 8 left);
+label(TEX("Waltham Forest") scaled 0.666 rotated 50, median(Waltham_Forest));
+label(TEX("Wandsworth") scaled 0.719, median(Wandsworth) shifted 8 left);
+label(TEX("Westminster") scaled 0.648, median(Westminster));
+
+label.ulft(legend, point 1 of bbox currentpicture);
+label.lrt("\large Brexit vote in London 2016", point 3 of bbox currentpicture shifted (4,-4));
+
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-brexit-map.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,38 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ numeric s; s = 8;
+ path atom;
+ atom = origin
+ -- (2s,0) rotated -30 -- (2s,0) rotated -30 + (0,s)
+ -- ( s,0) rotated 30 -- ( s,0) rotated 30 + (0,s)
+ -- (0,2s) -- cycle;
+
+ picture p[];
+ for i=0 upto 2:
+ p[i] = image(
+ fill atom rotated -120i withcolor (7/8 - 1/8i) ;
+ draw atom rotated -120i;
+ );
+ endfor
+
+ pair u, v;
+ u = point 3 of atom - point 1 of atom rotated -120;
+ v = u rotated 60;
+
+ n = 13;
+ for i=-n upto n:
+ for j=-n upto n:
+ forsuffixes $=0,1,2:
+ draw p$ shifted (i*u + j*v);
+ endfor
+ endfor
+ endfor
+
+ clip currentpicture to
+ unitsquare shifted -(1/2,1/2) scaled 5in yscaled 0.618;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-escher.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,34 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+path b, w;
+b = ((-3,-4)--(3,-2)--(3,+2)--(-3,4)--cycle) scaled 5;
+w = b reflectedabout(up, down);
+
+picture B, W;
+B = image(
+ for i=0 step 1/64 until 1:
+ draw point 4-i of b -- point 1+i**2 of b withcolor 1-i**8;
+ endfor
+);
+
+W = image(
+ for i=0 step 1/64 until 1:
+ draw point 4-i of w -- point 1+i**2 of w withcolor 3/4-i**8;
+ endfor
+);
+
+for i=-7 upto 7:
+ for j=-4 upto 4:
+ draw if odd (i+j): W else: B fi shifted ((i,j) scaled 30);
+ endfor
+endfor
+
+clip currentpicture to
+ unitsquare shifted -(.5,.5) scaled 5in yscaled 0.618;
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-grey-shadows.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-bathymetric.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-bathymetric.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-bathymetric.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,40 +3,40 @@
\begin{document}
\begin{mplibcode}
input color-hsv-macro
-beginfig(2);
- defaultfont := "phvr8r";
- defaultscale := 3/4;
- path h,d,b; numeric n;
- h = ((-2,0)--(0,0)--(-1,3)--(-2,3)--cycle) scaled 60;
- d = h rotated 180;
- n = 10;
- b = subpath (0,1) of h -- point 1+1/n of d -- (xpart point 0 of h, ypart point 1+1/n of d) -- cycle;
- fill b withcolor hsv_color(123, 1/8, 7/8);
- draw subpath (2.13,4) of b;
-
- for i=1 upto n:
- fill point 4-(i-1)/n of h -- point 1+(i-1)/n of h
- -- point 1+i/n of h -- point 4-i/n of h -- cycle
- withcolor hsv_color(42, 1/4 + 3/4 * i/n, 1 - i/3n);
- fill point 4-(i-1)/n of d -- point 1+(i-1)/n of d
- -- point 1+i/n of d -- point 4-i/n of d -- cycle
- withcolor hsv_color(200, i/n - 1/n, 1 - i/3n);
- endfor
- string s;
- for i=1 upto n-1:
- draw point 4-i/n of h -- point 1+i/n of h;
- draw point 4-i/n of d -- point 1+i/n of d;
- s := decimal if i < 4: (i**2+1) else: (10 + (i-3)*10) fi & "00";
- label.rt(s, point 1+i/n of h);
- label.lft(s, point 1+i/n of d);
- endfor
- label.rt("Metres", point 2 of h);
- label.lft("Metres", point 2 of d);
- label.lft("Hypsometric tints" infont defaultfont scaled defaultscale rotated 90, point 7/2 of h);
- label.rt("Bathymetric tints" infont defaultfont scaled defaultscale rotated -90, point 7/2 of d);
- label.lft("sea level", point 0 of h);
- label("areas below sea level", center b);
- draw h; draw d;
+beginfig(1);
+defaultfont := "phvr8r"; defaultscale := 3/4;
+path h,d,b; numeric n; n = 10;
+h = ((-2,0)--(0,0)--(-1,3)--(-2,3)--cycle) scaled 64;
+d = h rotated 180;
+b = subpath (0,1) of h -- point 1+1/n of d --
+ (xpart point 0 of h, ypart point 1+1/n of d) -- cycle;
+fill b withcolor hsv_color(123, 1/8, 7/8);
+draw subpath (2.13,4) of b;
+for i=1 upto n:
+ fill point 4-(i-1)/n of h -- point 1+(i-1)/n of h --
+ point 1+i/n of h -- point 4-i/n of h -- cycle
+ withcolor hsv_color(42, 1/4 + 3/4 * i/n, 1 - i/3n);
+ fill point 4-(i-1)/n of d -- point 1+(i-1)/n of d --
+ point 1+i/n of d -- point 4-i/n of d -- cycle
+ withcolor hsv_color(200, i/n - 1/n, 1 - i/3n);
+endfor
+string s;
+for i=1 upto n-1:
+ draw point 4-i/n of h -- point 1+i/n of h;
+ draw point 4-i/n of d -- point 1+i/n of d;
+ s := decimal if i < 4: (i**2+1) else: (10 + (i-3)*10) fi & "00";
+ label.rt(s, point 1+i/n of h);
+ label.lft(s, point 1+i/n of d);
+endfor
+label.rt("Metres", point 2 of h);
+label.lft("Metres", point 2 of d);
+label.lft("Hypsometric tints" infont defaultfont
+ scaled defaultscale rotated 90, point 7/2 of h);
+label.rt("Bathymetric tints" infont defaultfont
+ scaled defaultscale rotated -90, point 7/2 of d);
+label.lft("sea level", point 0 of h);
+label("areas below sea level", center b);
+draw h; draw d;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-bathymetric.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-gamut.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-gamut.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-gamut.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,24 +4,30 @@
\begin{mplibcode}
input color-hsv-macro
beginfig(1);
- defaultfont := "phvr8r";
- numeric s[], v[];
- s0 = 1/2; v0 = 7/8;
- s1 = 7/8; v1 = 7/8;
- s2 = 7/8; v2 = 1/2;
- for y=0 upto 2:
- for h=0 step 15 until 360:
- fill fullcircle scaled 24 shifted (h, -32y) withcolor hsv_color(h, s[y], v[y]);
- draw fullcircle scaled 24 shifted (h, -32y) withcolor white;
- if y=1: label(decimal h infont defaultfont scaled 1/2, (h,-16)); fi
- endfor
+ defaultfont := "phvr8r";
+
+ numeric s[], v[];
+ s0 = 1/2; v0 = 7/8;
+ s1 = 7/8; v1 = 7/8;
+ s2 = 7/8; v2 = 1/2;
+
+ path r;
+ for y=0, 1, 2:
+ for h=0 step 15 until 360:
+ r := fullcircle scaled 24 shifted (h, -36y if y=2: +8 fi);
+ fill r withcolor hsv_color(h, s[y], v[y]);
+ draw r withcolor white;
+ if y=1:
+ label(decimal h infont defaultfont scaled 0.7, (h,-18));
+ fi
endfor
+ endfor
- label.urt("Less saturation", (-20,12));
- label.lrt("Lower value", (-20,-76));
+ label.urt("Less saturation", (-20,14));
+ label.lrt("Lower value", (-20,-78));
- drawarrow (-15, -12) -- (-15,12);
- drawarrow (-15, -52) -- (-15,-76);
+ drawarrow (-15, -21) -- (-15,12);
+ drawarrow (-15, -43) -- (-15,-76);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-gamut.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-macro.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-macro.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/color-hsv-macro.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,15 +1,14 @@
-vardef hsv_color(expr h,s,v) =
- % following wikipedia article on "HSL and HSV"
- 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)
- elseif hh < 3: (0,chroma,x)+(m,m,m)
- elseif hh < 4: (0,x,chroma)+(m,m,m)
- elseif hh < 5: (x,0,chroma)+(m,m,m)
- else: (chroma,0,x)+(m,m,m)
- fi
+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)
+ elseif hh < 3: (0,chroma,x)+(m,m,m)
+ elseif hh < 4: (0,x,chroma)+(m,m,m)
+ elseif hh < 5: (x,0,chroma)+(m,m,m)
+ else: (chroma,0,x)+(m,m,m)
+ fi
enddef;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/compass-rose.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/compass-rose.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/compass-rose.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,35 +0,0 @@
-vardef compass_rose(expr shade, highlight) =
- save currentpicture, s;
- picture currentpicture; currentpicture := nullpicture;
- drawoptions(withcolor shade);
- draw fullcircle scaled 144 withpen pencircle scaled 2;
- draw fullcircle scaled 138;
- draw thelabel("NW" infont defaultfont scaled 3/4, 64 up) rotated +45;
- draw thelabel("NE" infont defaultfont scaled 3/4, 64 up) rotated -45;
- draw thelabel("SE" infont defaultfont scaled 3/4, 64 down) rotated +45;
- draw thelabel("SW" infont defaultfont scaled 3/4, 64 down) rotated -45;
- draw fullcircle scaled 120;
- draw fullcircle scaled 118;
- draw fullcircle scaled 108;
- draw fullcircle scaled 106;
- for t=0 step 15 until 350: draw ((53,0) -- (60,0)) rotated t; endfor
- for t=0 step 45 until 350: draw ((69,0) -- (80,0)) rotated t; endfor
- path s; s = 8 right -- 60 up -- 8 left -- cycle;
- for t=0 upto 3: filldraw s rotated (45 + 90t); endfor
- s := s scaled 1.414;
- for t=0 upto 3:
- s := s rotated 90t;
- fill s withcolor background;
- fill subpath (-1/2, 1) of s -- cycle if t=0: withcolor highlight fi;
- draw s;
- endfor
- fill fullcircle scaled 28 withcolor background;
- draw fullcircle scaled 28;
- fill fullcircle scaled dotlabeldiam;
- label.top("N" infont "cmbx12", 84 up);
- label.bot("S" infont "cmbx12", 84 down);
- label.rt("E" infont "cmbx12", 84 right);
- label.lft("W" infont "cmbx12", 84 left);
- drawoptions();
- currentpicture
-enddef;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-inverse-and-sqrt.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-inverse-and-sqrt.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-inverse-and-sqrt.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,48 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-picture axes, dot, opendot, P[];
-numeric u; u = 42;
-interim ahangle := 30;
-axes = image(
- path xx, yy; xx = (left--right) scaled 1.2 u; yy = xx rotated 90;
- draw fullcircle scaled 2u;
- drawarrow xx; label.rt("$\Re$", point 1 of xx);
- drawarrow yy; label.top("$\Im$", point 1 of yy);
-);
-dot = image(fill fullcircle scaled dotlabeldiam);
-opendot = image(draw dot; unfill fullcircle scaled 3/4 dotlabeldiam);
-z1 = 0.7 dir 76;
-z2 = 1.5 dir 60;
-z3 = 1 dir 42;
-
-vardef connect(expr a, b, shade) =
- path c; c = (a -- origin -- b) scaled u;
- drawarrow c cutafter fullcircle scaled 5 shifted point 2 of c withcolor shade;
- draw dot shifted point 0 of c; draw opendot shifted point 2 of c;
-enddef;
-
-vardef zinverse(expr z) = 1/abs z * dir - angle z enddef;
-vardef zsqrt(expr z) = if abs z > 0: sqrt(abs z) * dir 1/2 angle fi z enddef;
-
-input colorbrewer-rgb
-P1 = image(
-draw axes withcolor 3/4;
-label.lrt("\small\texttt{zinverse()}", ulcorner axes shifted 10 left);
-for i=1 upto 3: connect(z[i], zinverse(z[i]), SetTwo[7][2+i]); endfor
-);
-P2 = image(
-draw axes withcolor 3/4;
-label.lrt("\small\texttt{zsqrt()}", ulcorner axes);
-for i=1 upto 3: connect(z[i], zsqrt(z[i]), SetTwo[7][2+i]); endfor
-);
-beginfig(1);
- interim labeloffset := 12;
- label.lft(P1, origin);
- label.rt(P2, origin);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-inverse-and-sqrt.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-operators.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-operators.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-operators.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,32 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- numeric u; u = 1cm;
- z1 = 2 dir 15; z2 = 1.2 dir 60;
- z3 = z1+z2; z4 = z1 zscaled z2; z5 = (x1,-y1);
- drawoptions(withcolor 2/3 white);
- draw (1/2 left -- 3 right) scaled u ;
- draw (1/2 down -- 3 up ) scaled u ;
- draw subpath (0,3) of fullcircle scaled 2u rotated -22.5;
- drawoptions();
- dotlabel.lrt (btex $\scriptstyle 1$ etex, (u,0));
- dotlabel.ulft(btex $\scriptstyle i$ etex, (0,u));
- interim ahangle := 30;
- forsuffixes @=1,2,3,4,5:
- x@ := x@ * u; y@ := y@ * u;
- drawarrow origin -- z@
- cutafter fullcircle scaled 5 shifted z@
- withcolor 2/3 if @ < 3: blue else: red fi;
- endfor
- fill fullcircle scaled dotlabeldiam;
- dotlabel.rt (btex $A$ etex, z1);
- dotlabel.urt(btex $B$ etex, z2);
- dotlabel.top(btex $A+B$ etex, z3);
- dotlabel.top(btex $A \times B$ etex, z4);
- dotlabel.rt (btex $\bar{A}$ etex, z5);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/complex-operators.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/conway.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/conway.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/conway.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,22 +0,0 @@
-\documentclass[margin=1mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-pair a, b, c, d, e, f, g;
-a = origin; b = 180 right; c = 90 up;
-d = 2/5[b, c]; e = 4/5[b,c]; f = 1/2[e, a]; g = 1/2[a, b];
-
-fill a--b--c--cycle withcolor 15/16[blue, white];
-draw a--b--c--a--e--g--f; draw g--d;
-dotlabel.llft("$a$", a);
-dotlabel.lrt ("$b$", b);
-dotlabel.ulft("$c$", c);
-dotlabel.urt ("$d$", d);
-dotlabel.urt ("$e$", e);
-dotlabel.ulft("$f$", f);
-dotlabel.bot ("$g$", g);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/conway.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/corners.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/corners.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/corners.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,36 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\usepackage{fontspec}
-\setmainfont{TeX Gyre Pagella}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- picture p, q;
- p = thelabel.rt("\fontsize{48}{48}\selectfont plain", origin);
- q = thelabel.rt("\fontsize{48}{48}\selectfont rotated", origin) rotated 30;
-
- picture P[];
- numeric i; i = 0;
- forsuffixes @=p,q:
- P[incr i] = image(
- fill bbox @ withcolor 15/16[red, white];
- draw llcorner @ -- lrcorner @ -- urcorner @ -- ulcorner @ -- cycle
- withcolor 7/8[red, white];
- draw llcorner @ -- urcorner @ withcolor 7/8[red, white];
- draw ulcorner @ -- lrcorner @ withcolor 7/8[red, white];
- draw @ withcolor 3/4;
- dotlabel.lft("\texttt{llcorner}", llcorner @);
- dotlabel.rt ("\texttt{lrcorner}", lrcorner @);
- dotlabel.rt ("\texttt{urcorner}", urcorner @);
- dotlabel.lft("\texttt{ulcorner}", ulcorner @);
- draw fullcircle scaled 3 shifted center @;
- );
- endfor
- labeloffset := 20;
- label.top(P1, origin);
- label.bot(P2, origin);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/corners.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid-family.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid-family.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid-family.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,17 +3,15 @@
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
+beginfig(1);
input colorbrewer-rgb
-beginfig(1);
- numeric a; a = 144;
- for n=1 upto 7:
- path p; p = a * right for t=6 step 6 until 90:
- .. a * (cosd(t) ** n, sind(t) ** n)
- endfor;
- p := for i=0 upto 3: p rotated 90i & endfor cycle;
- fill p withcolor Oranges[9][n]; draw p;
- endfor
+for n=1 upto 7:
+ path p; p = (right for t=6 step 6 until 90:
+ .. (cosd(t) ** n, sind(t) ** n)
+ endfor) scaled 144;
+ p := for i=0 upto 3: p rotated 90i & endfor cycle;
+ fill p withcolor Blues[9][n]; draw p;
+endfor
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid-family.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,17 +4,16 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- path base; base = fullcircle scaled 300;
- path astroid; astroid =
- for t=0 step 1/16 until 8:
- hide(pair a, b, p;
- a = (xpart point t of base, 0);
- b = (0, ypart point t of base);
- draw a -- b withpen pencircle scaled 1/4 withcolor 3/4;
- p = whatever[a, b]; p - point t of base = whatever * (a - b) rotated 90;
- ) p --
- endfor cycle;
- draw astroid withcolor 2/3 red;
+ path base; base = fullcircle scaled 300;
+ path astroid; astroid = for t=0 step 1/16 until 8:
+ hide(pair a, b, p;
+ a = (xpart point t of base, 0); b = (0, ypart point t of base);
+ p = whatever[a,b]; p - point t of base = whatever * (a-b) rotated 90;
+ ) p -- endfor cycle;
+ for t=0 step 1/16 until 8:
+ draw (xpart point t of base, 0) -- (0, ypart point t of base) withcolor 7/8;
+ endfor
+ draw astroid withcolor 2/3 red;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-astroid.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,44 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ path Y, L, C, P, S;
+
+ % solve parameters for cycloid
+ vardef u(expr x) = x - sind(57.295779513 x) enddef;
+ vardef v(expr x) = 1 - cosd(57.295779513 x) enddef;
+ vardef f(expr t) = u(t) < v(t) enddef;
+ tolerance := epsilon; a = solve f(2,3);
+ s = 1/64 a;
+ Y = (origin for t = s step s until a+eps:
+ -- (u(t), -v(t)) % negative v(t) so curve is inverted
+ endfor) scaled 160;
+ z0 = point 0 of Y;
+ z1 = point infinity of Y;
+
+ % define the four other paths
+ L = z0 -- z1;
+ C = quartercircle rotated 180 scaled 2x1 shifted (x1, y0);
+ P = z0{1,-2} ... (1/2[x1, x0], 1/4[y1, y0]){1,-1} ... z1 {1, 0};
+ S = z0{1,-6} ... (1/2[x1, x0], 1/64[y1, y0]){1, -6/32} ... z1 {1, 0};
+
+ draw z0 -- (x0,y1) -- z1 withcolor 3/4;
+ drawoptions(withcolor 2/3 red);
+ draw L; dotlabel.urt("Line", point 1/4 of L);
+ drawoptions(withcolor 1/2 green);
+ draw C; dotlabel.urt("Circle", point 1 of C);
+ drawoptions(withcolor 1/4[red, green]);
+ draw P; dotlabel.urt("Parabola", point 1/2 of P);
+ drawoptions(withcolor 3/4[red, green]);
+ draw S; dotlabel.llft("Sixth degree", point 3/4 of S);
+ drawoptions(withcolor 1/2 blue);
+ draw Y; dotlabel.urt("Cycloid", point 50 of Y);
+ drawoptions();
+
+ dotlabel.urt("$A$", z0);
+ dotlabel.urt("$B$", z1);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-brachisto.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cardioid-construction.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cardioid-construction.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cardioid-construction.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,48 +5,49 @@
\begin{mplibcode}
beginfig(1);
- numeric u; u = 144;
+numeric u; u = 144;
- path base; base = fullcircle rotated 180 scaled u;
+path base; base = fullcircle rotated 180 scaled u;
+numeric s; s = 1/8;
- path cardioid;
- cardioid = for t = 0 step 1/4 until length base:
- point 0 of base reflectedabout(precontrol t of base, postcontrol t of base) ..
- endfor cycle;
+pair A; A = point 0 of base;
+path cardioid; cardioid = for t = 0 step s until length base:
+ A reflectedabout(precontrol t of base, postcontrol t of base) ..
+endfor cycle;
- numeric t; t = 5.4;
- pair A, M, P, P', Q, Q', R;
- A = point 0 of base;
- Q = point t of base;
- Q' = point t-4 of base;
- P = A reflectedabout(precontrol t of base, postcontrol t of base);
- P' = A reflectedabout(precontrol t-4 of base, postcontrol t-4 of base);
- M = 1/2[P, P'];
- R = whatever[P, Q] = whatever[P', Q'];
+numeric t; t = 5.4;
+pair A, M, P, P', Q, Q', R;
+A = point 0 of base;
+Q = point t of base;
+Q' = point t-4 of base;
+P = A reflectedabout(precontrol t of base, postcontrol t of base);
+P' = A reflectedabout(precontrol t-4 of base, postcontrol t-4 of base);
+M = 1/2[P, P'];
+R = whatever[P, Q] = whatever[P', Q'];
- %draw Q' -- R -- Q withcolor 3/4;
- draw 3[postcontrol t of base, precontrol t of base]
- -- 5[precontrol t of base, postcontrol t of base] withcolor 3/4;
- %draw 5[postcontrol t-4 of base, precontrol t-4 of base]
- % -- 3[precontrol t-4 of base, postcontrol t-4 of base] withcolor 3/4;
+%draw Q' -- R -- Q withcolor 3/4;
+draw 3[postcontrol t of base, precontrol t of base]
+ -- 5[precontrol t of base, postcontrol t of base] withcolor 3/4;
+%draw 5[postcontrol t-4 of base, precontrol t-4 of base]
+% -- 3[precontrol t-4 of base, postcontrol t-4 of base] withcolor 3/4;
- draw fullcircle scaled 2 abs (Q-A) shifted Q withcolor 7/8;
+draw fullcircle scaled 2 abs (Q-A) shifted Q withcolor 7/8;
- %
- %draw P' -- Q' -- Q -- P -- cycle;
- draw A -- Q -- P -- cycle;
+%
+%draw P' -- Q' -- Q -- P -- cycle;
+draw A -- Q -- P -- cycle;
- draw base withcolor 2/3 blue;
- draw origin withpen pencircle scaled dotlabeldiam withcolor 2/3 blue;
- draw cardioid withcolor 1/4[white, 1/2 red];
+draw base withcolor 2/3 blue;
+draw origin withpen pencircle scaled dotlabeldiam withcolor 2/3 blue;
+draw cardioid withcolor 1/4[white, 1/2 red];
- dotlabel.ulft("$A$", A);
- %dotlabel.ulft("$M$", M);
- dotlabel.top ("$P$", P);
- %dotlabel.llft("$P'$", P');
- dotlabel.urt ("$Q$", Q);
- %dotlabel.bot ("$Q'$", Q');
- %dotlabel.lrt ("$R$", R);
+dotlabel.ulft("$A$", A);
+%dotlabel.ulft("$M$", M);
+dotlabel.top ("$P$", P);
+%dotlabel.llft("$P'$", P');
+dotlabel.urt ("$Q$", Q);
+%dotlabel.bot ("$Q'$", Q');
+%dotlabel.lrt ("$R$", R);
endfig;
\end{mplibcode}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cardioid-construction.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,70 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+numeric R, r, pi;
+R = 1.8cm; % radius of the outer part
+r = 1.3cm; % radius of the inner part
+pi = 3.14159265; % constant
+% define the cycloid
+path c;
+c = (0,-R) rotated 100 shifted (r*-100/180*pi,r)
+ for t=-99 upto 460:
+ -- (0,-R) rotated -t shifted (r*t/180*pi,r)
+ endfor;
+% axes
+drawoptions(withcolor .5 white);
+path xx, yy;
+yy = (down -- 5 up) scaled 1/2 r;
+xx = (xpart point 0 of c, 0) -- (xpart point infinity of c,0);
+draw fullcircle scaled 1/4r; drawarrow xx; drawarrow yy;
+drawoptions();
+label.rt (btex $x$ etex, point 1 of xx);
+label.top(btex $y$ etex, point 1 of yy);
+
+% draw the cycloid on top of the axes
+draw c withcolor .67 red;
+
+% define a couple of related points:
+% z1 center of the blue wheel
+% z2 intersection of rim and cycloid
+t = 124; % if you change t then the wheel will "roll" along...
+z1 = (r*t/180*pi,r);
+z2 = (0,-R) rotated -t shifted z1;
+
+% draw the auxiliary lines
+draw (0,y2) -- z2 -- (x2,0) dashed withdots scaled .6;
+draw z2 -- z1 -- (x1,0);
+% draw the rolling circle and mark centre and intersection
+draw fullcircle scaled 2r shifted z1 withcolor 2/3 blue;
+draw fullcircle scaled 2R shifted z1 withcolor 1/2[2/3 blue, white];
+fill fullcircle scaled dotlabeldiam shifted z1;
+fill fullcircle scaled dotlabeldiam shifted z2;
+% some arc arrows and labels
+path a[];
+z3 = (x1,5/12y1);
+a1 = z3 {left} .. {left rotatedabout(z1,-t)} z3 rotatedabout(z1,-t);
+drawarrow subpath (.05,.95) of a1;
+label.llft(btex $\theta$ etex, point .5 of a1);
+a2 = subpath (0,1) of reverse quartercircle scaled 2.2r shifted z1;
+drawarrow a2 rotatedabout(z1,-100);
+% finally all the other labels
+label.rt (btex $r$ etex, (x1,.5y1));
+label.urt(btex $R$ etex, .6[z1,z2]);
+label.lft(btex $y$ etex, (0,y2));
+% give all the x-axis labels a common baseline with mathstrut
+label.bot(btex $\mathstrut x$ etex, (x2,0));
+label.bot(btex $\mathstrut r\theta$ etex, (x1,0));
+label.bot(btex $\mathstrut 2\pi r$ etex, (r*2pi,0));
+draw (down--up) scaled 2 shifted (r*2pi,0) withcolor .5 white;
+% notice how nicely the coordinates work...
+dotlabel.top(btex $(\pi r,R+r)$ etex, (pi*r,R+r));
+% and a little alignment to finish
+label(btex $\vcenter{\halign{&$#$\hfil\cr
+x=r\theta-R\sin\theta\cr
+y=r-R\cos\theta\cr}}$ etex,(4.75r,r));
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids-extra.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,48 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ numeric pi, r, theta; pi = 3.141592653589793; r = 42; theta = 81;
+ path cycloid;
+ for t=-80 step 5 until 440:
+ cycloid := if known cycloid: cycloid -- fi
+ (0, -r) rotated -t shifted (t/180*pi*r, r);
+ endfor;
+ path wheel;
+ z1 = (theta/180*pi*r, r);
+ wheel = reverse fullcircle scaled 2r rotated -(90 + theta) shifted z1;
+ z2 = point 0 of wheel;
+ path a[]; u = 1/16; % u = a little shortening
+ a1 = subpath -(theta/45-u,u) of wheel shifted -z1 scaled 5/8 shifted z1;
+ a2 = subpath (.3, 1.4) of wheel shifted -z1 scaled 1.08 shifted z1;
+ a3 = a2 rotatedabout(z1, 170);
+ path xx, yy;
+ xx = (xpart point 0 of cycloid, 0) -- (xpart point infinity of cycloid,0);
+ yy = (down -- 5 up) scaled 1/2 r;
+
+ ahangle := 30;
+ drawarrow xx withcolor 1/2; label.rt (btex $x$ etex, point 1 of xx);
+ drawarrow yy withcolor 1/2; label.top(btex $y$ etex, point 1 of yy);
+
+ draw cycloid withcolor .67 red;
+ draw wheel withcolor .67 blue;
+ drawarrow a1; drawarrow a2; drawarrow a3;
+ draw (0,y2) -- z2 -- (x2,0) dashed withdots scaled 1/4;
+ draw z2 -- z1 -- (x1,0);
+ draw z1 withpen pencircle scaled dotlabeldiam;
+ draw z2 withpen pencircle scaled dotlabeldiam;
+
+ label(btex $\theta$ etex, z1 + 3/4r * dir (270 - 1/2 theta));
+ label.bot(btex $\mathstrut 2\pi r$ etex, (2pi*r,0));
+ label.bot(btex $\mathstrut r\theta$ etex, (x1,0));
+ label.bot(btex $\mathstrut x$ etex, (x2,0));
+ label.lft(btex $y$ etex, (0,y2));
+ label.top(btex $r$ etex, 1/2[z1, z2]);
+ dotlabel.top(btex $(\pi r,2r)$ etex, (pi*r,2r));
+ label.rt(btex $\vcenter{\halign{&$#$\hfil\cr
+ x=r(\theta-\sin\theta)\cr
+ y=r(1-\cos\theta)\cr}}$ etex, (pi*r,r));
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-cycloids.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,34 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef dp(expr x) = substring(0, 5) of decimal x enddef;
+beginfig(1);
+
+ pair F[], o;
+
+ -F1 = F2 = 55 dir 34;
+
+ o = 1/2[F1, F2];
+
+ dotlabel.lrt("$F_1$", F1);
+ dotlabel.lrt("$F_2$", F2);
+
+ 2d = abs(F1 - F2);
+ r = angle(F1 - F2);
+
+ for i = 0 upto 8:
+ a := d * (1 + 1/4 i);
+ b := a +-+ d;
+ e := 1 +-+ b/a;
+ path ee; ee = fullcircle xscaled 2a yscaled 2b rotated r shifted o;
+ draw ee;
+ picture tl; tl = thelabel.top(TEX("$e=" & dp(e) & "$"), origin);
+ draw tl rotated angle direction 2 of ee shifted point 2 of ee;
+ endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-family.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-tangents.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-tangents.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-tangents.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,53 +3,47 @@
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
-secondarydef a through b =
- begingroup; save d; numeric d; d = abs(a-b); (1+12/d)[b,a]--(1+12/d)[a,b] endgroup
-enddef;
beginfig(1);
-path ellipse; ellipse = fullcircle scaled 300 yscaled 5/8 rotated 13;
-z0 = 1/2[point 4 of ellipse, point 0 of ellipse];
-numeric a, b, e;
-2a = abs (point 4 of ellipse - point 0 of ellipse);
-2b = abs (point 6 of ellipse - point 2 of ellipse);
+path ellipse; ellipse = fullcircle scaled 300 yscaled 5/8 rotated 8;
+2a = abs (point 0 of ellipse - point 4 of ellipse);
+2b = abs (point 2 of ellipse - point 6 of ellipse);
e = 1 +-+ b/a;
-z1 = e[z0, point 0 of ellipse];
-z2 = e[z0, point 4 of ellipse];
-z3 = 240 dir 25;
-path pp, qq;
-pp = fullcircle scaled 2 abs (z1 - z3) shifted z3;
-qq = fullcircle scaled 4a shifted z2;
-z4 = pp intersectionpoint qq;
-z5 = reverse pp intersectionpoint qq;
-numeric t, u;
-(t, whatever) = ellipse intersectiontimes (z2 -- z4);
-(u, whatever) = ellipse intersectiontimes (z2 -- z5);
+pair F[], A;
+F1 = (1/2-e/2)[point 0 of ellipse, point 4 of ellipse];
+F2 = (1/2+e/2)[point 0 of ellipse, point 4 of ellipse];
+A = 240 dir 25;
+
+path pp; pp = fullcircle scaled 2 abs (F1-A) shifted A;
+path qq; qq = fullcircle scaled 4a shifted F2;
+pair P, Q, T, T';
+z1 = pp intersectiontimes qq; P = point x1 of pp;
+z2 = reverse pp intersectiontimes qq; Q = point -x2 of pp;
+z3 = ellipse intersectiontimes (F2 -- P); T = point x3 of ellipse;
+z4 = ellipse intersectiontimes (F2 -- Q); T' = point x4 of ellipse;
+
vardef f(expr x) =
- angle (z3 - point x of ellipse) + 90 > angle direction x of ellipse
+ angle (A-point x of ellipse) + 90 > angle direction x of ellipse
enddef;
-drawarrow z3 -- point solve f(0, t) of ellipse withcolor 2/3 blue;
+drawarrow A -- point solve f(0, x3) of ellipse withcolor 2/3 blue;
-drawoptions(dashed evenly withcolor 7/8);
-draw point 0 of ellipse through point 4 of ellipse;
-draw point 2 of ellipse through point 6 of ellipse;
-drawoptions(withcolor 3/4);
-draw z4 -- z1 -- z5;
-draw z2 -- z4 -- z3 -- z5 -- cycle;
-draw point t of ellipse -- z1 -- point u of ellipse;
-drawoptions();
-draw point t of ellipse -- z3 -- point u of ellipse withcolor 2/3 red;
-dotlabel.llft("$F_1$", z1); dotlabel.llft("$F_2$", z2);
-dotlabel.urt("$A$", z3);
-dotlabel.ulft("$P$", z4); dotlabel.lrt ("$Q$", z5);
-dotlabel.ulft("$T$", point t of ellipse);
-dotlabel.lrt("$T'$", point u of ellipse);
+draw subpath (x1 - 1/2, 17/2 - x2) of pp dashed withdots scaled 1/2;
+draw subpath (y2 - 33/4, y1 + 1/4) of qq dashed withdots scaled 1/2;
+draw T -- F1 -- P -- F2 -- Q -- F1 -- T' withcolor 1/2;
+draw P -- A -- Q withcolor 1/2;
+draw T -- A -- T' withcolor 2/3 red;
draw ellipse;
-picture P; P = currentpicture; currentpicture := nullpicture;
-draw pp dashed withdots scaled 1/2;
-draw qq dashed withdots scaled 1/2;
-bboxmargin := 24; clip currentpicture to bbox P;
-draw P;
+
+def dotlabelx(expr t, z, o) =
+ draw z withpen pencircle scaled dotlabeldiam; label(t, z + o);
+enddef;
+dotlabelx("$F_1$", F1, 10 dir 241);
+dotlabelx("$F_2$", F2, 8 dir 260);
+dotlabelx("$A$", A, 8 dir 30);
+dotlabelx("$P$", P, 10 dir 94); dotlabelx("$Q$", Q, 10 dir 300);
+dotlabelx("$T$", T, 10 dir 120); dotlabelx("$T'$", T', 10 dir -45);
+
+input show_name
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse-tangents.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,45 +4,57 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
secondarydef a through b =
- begingroup; save d; numeric d; d = abs(a-b); (1+12/d)[b,a] -- (1+12/d)[a,b] endgroup
+ begingroup; save d; d = abs(a-b); (1+12/d)[b,a] -- (1+12/d)[a,b] endgroup
enddef;
beginfig(1);
- path ellipse; ellipse = fullcircle scaled 300 yscaled 5/8 rotated 13;
- numeric a, b, e;
- 2a = abs (point 4 of ellipse - point 0 of ellipse);
- 2b = abs (point 6 of ellipse - point 2 of ellipse);
- e = 1 +-+ b/a;
+ path ellipse;
+ ellipse = fullcircle scaled 300 yscaled 5/8 rotated 13;
- z0 = 1/2[point 0 of ellipse, point 4 of ellipse];
- z1 = e[z0, point 0 of ellipse];
- z2 = e[z0, point 4 of ellipse];
+ numeric a, b;
+ 2a = abs (point 4 of ellipse - point 0 of ellipse);
+ 2b = abs (point 6 of ellipse - point 2 of ellipse);
- drawoptions(withcolor 3/4);
- draw point 0 of ellipse through point 4 of ellipse;
- draw point 2 of ellipse through point 6 of ellipse;
- drawoptions(withcolor 1/2);
- label.top("$a$", 1/2[z0, point 0 of ellipse]);
- label.bot("$ae$", 1/2[z0, z1]);
- label.rt("$b$", 1/2[z0, point 2 of ellipse]);
- drawoptions();
+ numeric e; e = 1 +-+ b/a; % Pythagorean difference
- numeric t; t = 1.732;
- draw z1 -- point t of ellipse -- z2;
- drawoptions(withcolor 1/2);
- draw (left--right) scaled 21
- rotated angle direction t of ellipse
- shifted point t of ellipse;
- draw (1/2 down--up) scaled 21
- rotated angle direction t of ellipse
- shifted point t of ellipse;
- drawoptions();
+ z0 = 1/2[point 0 of ellipse, point 4 of ellipse];
+ z1 = e[z0, point 0 of ellipse];
+ z2 = e[z0, point 4 of ellipse];
- draw ellipse withcolor 3/4 red;
+ drawoptions(withcolor 3/4[blue, white]);
+ draw point 0 of ellipse through point 4 of ellipse;
+ draw point 2 of ellipse through point 6 of ellipse;
- dotlabel.urt("$T$", point t of ellipse);
- dotlabel.lrt("$F_1$", z1);
- dotlabel.lrt("$F_2$", z2);
+ vardef arrowlabel(expr s, a, b, offset) =
+ save p, t; interim ahangle := 28;
+ path p; p = (a--b) shifted (offset * unitvector(b-a) rotated 90);
+ picture t; t = thelabel(s, point 1/2 of p);
+ drawdblarrow p; unfill bbox t; draw t;
+ enddef;
+ label.lrt("$a$", 1/2[z0, point 4 of ellipse]);
+ label.rt("$b$", 1/2[z0, point 6 of ellipse]);
+ arrowlabel("$ae$", z0, z1, -6);
+ drawoptions();
+
+ numeric t; t = 1.732;
+ drawoptions(withcolor 1/2);
+ draw (left--right) scaled 34
+ rotated angle direction t of ellipse
+ shifted point t of ellipse;
+ draw (1/2 down--up) scaled 34
+ rotated angle direction t of ellipse
+ shifted point t of ellipse;
+ drawoptions();
+
+ draw z1 -- point t of ellipse -- z2;
+ draw ellipse withcolor 3/4 red;
+
+ labeloffset := 6;
+ dotlabel.urt("$T$", point t of ellipse);
+ dotlabel.top("$F_1$", z1);
+ dotlabel.ulft("$F_2$", z2);
+
+ input show_name
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-ellipse.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-limacon-simple.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-limacon-simple.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-limacon-simple.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,34 +5,28 @@
\begin{mplibcode}
beginfig(1);
- numeric a; 2a = 144;
+ numeric a; 2a = 144;
- path base; base = fullcircle rotated 180 scaled 2a shifted (2a, 0);
- path c[]; numeric n; n = -1;
- numeric s; s = 1/4;
- pair A; A = 2[center base, point 0 of base];
- for t = 0 step s until length base:
- c[incr n] = fullcircle
- scaled 2 abs (point t of base - A)
- shifted point t of base;
- draw c[n] withpen pencircle scaled 1/4 withcolor 3/4;
- endfor
+ path base; base = fullcircle rotated 180 scaled 2a shifted (2a, 0);
+ numeric s; s = 1/4;
+ pair A; A = 2[center base, point 0 of base];
+ path limacon; limacon = for t = 0 step s until length base:
+ A reflectedabout(precontrol t of base, postcontrol t of base) ..
+ endfor cycle;
- path limacon;
- limacon = for t = 0 step s until length base:
- A reflectedabout(precontrol t of base, postcontrol t of base) ..
- endfor cycle;
+ path c[]; numeric n; n = -1;
+ for t = 0 step s until length base:
+ c[incr n] = fullcircle scaled 2 abs (point t of base - A) shifted point t of base;
+ draw c[n] withpen pencircle scaled 1/4 withcolor 3/4;
+ endfor
- % path polar;
- % polar = for t=0 upto 359: 2a * (1 + 2 cosd(t)) * dir t .. endfor cycle;
- % draw polar withpen pencircle scaled 5/4 withcolor 3/4[green, white];
+ draw base withcolor 2/3 blue;
+ draw center base withpen pencircle scaled 2 withcolor 2/3 blue;
+ draw limacon withcolor 2/3 red;
- draw base withcolor 2/3 blue; draw center base withpen pencircle scaled 2 withcolor 2/3 blue;
- draw limacon withcolor 2/3 red;
-
- dotlabel.lft("$A$", A);
- dotlabel.urt("$Q$", point 5.4 of base);
- dotlabel.ulft("$P$", A reflectedabout(precontrol 5.4 of base, postcontrol 5.4 of base));
+ dotlabel.lft("$A$", A);
+ dotlabel.urt("$Q$", point 5.4 of base);
+ dotlabel.ulft("$P$", A reflectedabout(precontrol 5.4 of base, postcontrol 5.4 of base));
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-limacon-simple.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola-directrix.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola-directrix.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola-directrix.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -12,65 +12,64 @@
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
-
+
% A--B = directrix, S = focus
vardef parabola(expr A, B, S) =
- save m, q, n, parabola;
- pair n;
- n = whatever[A, B];
- n - S = whatever * (A-B) rotated 90;
- path parabola;
- for t=0 step 1/64 until 1:
- pair m, q;
- m = 1/2[S, t[A, B]];
- q = whatever[S, n]; q - m = whatever * (S - m) rotated 90;
- parabola := if known parabola: parabola -- fi q reflectedabout(S, m);
- endfor
- parabola
+ save m, q, n, parabola;
+ pair n; % the point on A--B nearest to S
+ n = whatever[A, B];
+ n - S = whatever * (A-B) rotated 90;
+ path parabola;
+ for t=0 step 1/64 until 1:
+ pair m, q;
+ m = 1/2[S, t[A, B]];
+ q = whatever[S, n]; q - m = whatever * (S - m) rotated 90;
+ parabola := if known parabola: parabola -- fi
+ q reflectedabout(S, m);
+ endfor
+ parabola
enddef;
input colorbrewer-rgb
beginfig(1);
- numeric i; i = 16;
- pair a, b, s; a = 160 up rotated 5; b = 160 down rotated 5; s = 60 * right;
- draw a--b;
+ numeric i; i = 16;
+ pair a, b, s; a = 160 up rotated 5; b = 160 down rotated 5; s = 60 * right;
+ draw a--b;
- path ff; ff = (-1, 1){1, -2} .. (-1/2, 1/4){1, -1} .. (0, 0){right} .. (1/2, 1/4){1, 1} .. (1, 1){1, 2};
+ path ff; ff = (-1, 1){1, -2} .. (-1/2, 1/4){1, -1} ..
+ (0, 0){right} .. (1/2, 1/4){1, 1} .. (1, 1){1, 2};
- path p; p = parabola(a, b, s);
- pair tab; tab = whatever[a, b]; point i of p - tab = whatever * (a-b) rotated 90;
- pair q; q = point i of p reflectedabout(s, tab);
- pair n; n = whatever[a,b] = whatever[q, s];
- pair o; o = 1/2[n, s];
+ path p; p = parabola(a, b, s);
+ pair tab; tab = whatever[a, b]; point i of p - tab = whatever * (a-b) rotated 90;
+ pair q; q = point i of p reflectedabout(s, tab);
+ pair n; n = whatever[a,b] = whatever[q, s];
+ pair o; o = 1/2[n, s];
- % draw ff scaled 4 abs(s-o)
- % rotated angle (b-a)
- % shifted o
- % withpen pencircle scaled 2 withcolor 7/8[red, white];
-
- interim ahangle := 24;
- drawarrow (b--a) shifted (o-n) withcolor 3/4;
- drawarrow (1/2[a, n] --b) rotatedabout(n, 90) withcolor 3/4;
+ % draw ff scaled 4 abs(s-o) rotated angle (b-a) shifted o;
- draw tab -- point i of p -- q -- tab -- s withcolor 3/4;
-
- drawarrow s -- point i of p
- -- s reflectedabout(precontrol i of p rotatedabout(point i of p, 90),
- postcontrol i of p rotatedabout(point i of p, 90))
- withcolor Blues 8 4;
+ interim ahangle := 24;
+ drawarrow (b--a) shifted (o-n) withcolor 3/4;
+ drawarrow (1/2[a, n] --b) rotatedabout(n, 90) withcolor 3/4;
- draw p withcolor Blues 8 6;
- dotlabel.lrt("$S$", s);
- dotlabel.urt("$A$", a);
- dotlabel.lrt("$B$", b);
- dotlabel.ulft("\kw{point} $i$ \kw{of} $p$", point i of p);
- interim dotlabeldiam := 2;
- dotlabel.bot("$\scriptstyle q$", q);
- dotlabel.llft("$\scriptstyle n$", n);
- dotlabel.llft("$\scriptstyle o$", o);
- dotlabel.lft("$\scriptstyle m\:$", 1/2[tab, s]);
- dotlabel.lft("$\scriptstyle t[A, B]$", tab);
+ draw tab -- point i of p -- q -- tab -- s withcolor 3/4;
+ drawarrow s -- point i of p
+ -- s reflectedabout(precontrol i of p rotatedabout(point i of p, 90),
+ postcontrol i of p rotatedabout(point i of p, 90))
+ withcolor Blues 8 4;
+
+ draw p withcolor Blues 8 6;
+ dotlabel.lrt("$S$", s);
+ dotlabel.urt("$A$", a);
+ dotlabel.lrt("$B$", b);
+ dotlabel.ulft("\kw{point} $i$ \kw{of} $p$", point i of p);
+ interim dotlabeldiam := 2;
+ dotlabel.bot("$\scriptstyle q$", q);
+ dotlabel.llft("$\scriptstyle n$", n);
+ dotlabel.llft("$\scriptstyle o$", o);
+ dotlabel.lft("$\scriptstyle m\:$", 1/2[tab, s]);
+ dotlabel.lft("$\scriptstyle t[A, B]$", tab);
+
endfig;
\end{mplibcode}\llap{\tiny\texttt{\jobname}}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola-directrix.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,38 +4,25 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- pair O, S; O = origin; S = 66 right;
- path parabola, last;
- for q = -144 step 8 until 144:
- pair Q; Q = (0, q);
- path ray;
- ray = (origin -- unitvector(S - Q)) scaled 300
- rotated if q < 0: - fi 90 shifted Q;
- draw S -- ray withcolor 7/8;
- if known last:
- pair t;
- t = whatever[point 0 of ray, point 1 of ray]
- = whatever[point 0 of last, point 1 of last];
- parabola := if known parabola: parabola .. fi t;
- fi
- last := ray;
- endfor
-
- draw parabola withcolor 3/4[red, white];
- for t=0 upto length parabola:
- draw point t of parabola withpen pencircle scaled 3/2 withcolor red;
- endfor
- draw (up--down) scaled 300;
-
- dotlabel.lft("$A$", O);
- dotlabel.rt("$S$", S);
-
- % vardef signum(expr x) = if x=0: 1 else: abs(x) / x fi enddef;
- % path cart;
- % cart = subpath (1, infinity) of (origin for x=-304 step 8 until 304:
- % .. (x, 16 sqrt abs(x)) scaled signum(x) endfor);
-
- % drawarrow cart withcolor 1/3 green;
+ pair A, S; A = origin; S = 66 right;
+ path parabola, last;
+ for q = -144 step 8 until 144:
+ pair Q; Q = q * up; path ray;
+ ray = Q -- Q + 300 unitvector(S - Q) rotated if q < 0: - fi 90;
+ draw S -- ray withcolor 7/8;
+ if known last:
+ pair t; t = whatever[point 0 of ray, point 1 of ray]
+ = whatever[point 0 of last, point 1 of last];
+ parabola := if known parabola: parabola .. fi t;
+ fi
+ last := ray;
+ endfor
+ draw parabola withcolor 3/4[red, white];
+ for t=0 upto length parabola:
+ draw point t of parabola withpen pencircle scaled 3/2 withcolor red;
+ endfor
+ draw (up--down) scaled 300;
+ dotlabel.lft("$A$", A); dotlabel.rt("$S$", S);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-parabola.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-archimedes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-archimedes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-archimedes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,12 +5,12 @@
\mplibnumbersystem{decimal}
\begin{mplibcode}
beginfig(1);
- path S; S = origin for t=1 upto 360: .. 1/12 t * dir 8t endfor;
- drawarrow S;
- input rope
- draw rope S shifted 64 right;
- z0 = urcorner currentpicture - llcorner currentpicture;
- currentpicture := currentpicture scaled (300 / x0);
+ path S; S = origin for t=1 upto 360: .. 1/12 t * dir 8t endfor;
+ drawarrow S;
+ input rope
+ draw rope S shifted 64 right;
+ z0 = urcorner currentpicture - llcorner currentpicture;
+ currentpicture := currentpicture scaled (300 / x0);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-archimedes.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-equiangular.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-equiangular.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-equiangular.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,10 +4,10 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- numeric a; a = 2.6; path S;
- S = right for t=1 upto 360: .. a ** (t/64) * dir 4t endfor;
- drawarrow S;
-% input ruler-cm
+ numeric a; a = 2.6; path S;
+ S = right for t=1 upto 360: .. a ** (t/64) * dir 4t endfor;
+ drawarrow S;
+ % input ruler-cm
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-sq.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-sq.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-sq.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,28 +4,32 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- drawoptions(withpen pencircle scaled 1/4 withcolor 1/4);
+ drawoptions(withpen pencircle scaled 1/4 withcolor 1/4);
path s[]; s0 = unitsquare;
fill s0 withcolor 1/2[2/3 blue, white]; draw s0;
numeric a, b, t, n; a = 1; b = 1; n = 11;
for i = 1 upto n:
- t := b; b := b + a; a := t;
- s[i] = unitsquare scaled a;
- s[i] := s[i] shifted (point i of s[i-1] - point i-1 of s[i]);
- fill s[i] withcolor (1/2 + i/32)[2/3 blue, white];
- draw s[i];
+ t := b; b := b + a; a := t; % Fibonacci sequence
+ s[i] = unitsquare scaled a;
+ s[i] := s[i] shifted (point i of s[i-1] - point i-1 of s[i]);
+ fill s[i] withcolor (1/2 + i/32)[2/3 blue, white];
+ draw s[i];
endfor
+ % cross hairs
for i = n-1 upto n:
- draw point i-2 of s[i-2] -- point i of s[i];
+ draw point i-2 of s[i-2] -- point i of s[i];
endfor
- drawoptions();
- drawarrow origin for i=0 upto n: .. point i of s[i] endfor withcolor 2/3 red;
- for i = 5 upto n:
- label(TEX(decimal arclength subpath (0, 1) of s[i])
- scaled 0.8 rotated angle point n of s[n], center s[i]);
- endfor
- currentpicture := currentpicture rotated - angle point n of s[n];
-
+ drawoptions();
+ % Draw the spiral as a red arrow
+ drawarrow origin for i=0 upto n: .. point i of s[i] endfor
+ withcolor 2/3 red;
+ % show the Fibonacci sizes for the larger boxes
+ for i = 5 upto n:
+ label(TEX(decimal arclength subpath (0, 1) of s[i])
+ scaled 0.8 rotated angle point n of s[n], center s[i]);
+ endfor
+ % Rotate the whole picture to show off the spiral
+ currentpicture := currentpicture rotated - angle point n of s[n];
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-sq.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-trig.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-trig.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-trig.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,36 +4,35 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- path t[], base; pair apex;
- base = (left--right) scaled 100;
- apex = whatever * dir +72 shifted point 0 of base
- = whatever * dir -72 shifted point 1 of base;
- t0 = (base -- apex -- cycle);
- transform S;
- r = arclength subpath (0, 1) of t0 / arclength subpath (2, 3) of t0;
- point 0 of t0 transformed S = (r*r)[point 0 of t0, point 2 of t0];
- point 1 of t0 transformed S = point 0 of t0;
- point 2 of t0 transformed S = point 1 of t0;
-
- n = 16;
- for i=1 upto n:
- t[i] = t[i-1] transformed S;
- draw subpath (2,3) of t[i] withpen pencircle scaled 1/4;
- endfor
- draw point 0 of t0 -- point 3/2 of t0 withpen pencircle scaled 1/8 withcolor blue;
- draw point 0 of t1 -- point 3/2 of t1 withpen pencircle scaled 1/8 withcolor blue;
- draw t0;
- drawarrow point 2 of t[n] for i=n-1 downto 0: .. point 2 of t[i] endfor withcolor 2/3 red;
-
- z0 = whatever[point 0 of t0, point 3/2 of t0]
- = whatever[point 0 of t1, point 3/2 of t1];
- numeric a; a = angle (point 2 of t0 - z0);
- drawoptions(withcolor 1/2 green);
- label.lft(TEX("$a$") rotated a, point 5/2 of t0);
- label.bot(TEX("$b$") rotated a, point 1/2 of t0);
- label.rt(TEX("$x$") rotated a, point 1/2 of t1);
- drawoptions();
- currentpicture := currentpicture rotated -a;
+ path t[], base; pair apex;
+ base = (left--right) scaled 100;
+ apex = whatever * dir +72 shifted point 0 of base
+ = whatever * dir -72 shifted point 1 of base;
+ t0 = (base -- apex -- cycle);
+ transform S;
+ r = arclength subpath (0, 1) of t0 / arclength subpath (2, 3) of t0;
+ point 0 of t0 transformed S = (r*r)[point 0 of t0, point 2 of t0];
+ point 1 of t0 transformed S = point 0 of t0;
+ point 2 of t0 transformed S = point 1 of t0;
+ n = 16;
+ for i=1 upto n:
+ t[i] = t[i-1] transformed S;
+ draw subpath (2,3) of t[i] withpen pencircle scaled 1/4;
+ endfor
+ drawoptions(withpen pencircle scaled 1/8 withcolor blue);
+ draw point 0 of t0 -- point 3/2 of t0;
+ draw point 0 of t1 -- point 3/2 of t1;
+ drawoptions();
+ draw t0;
+ drawarrow point 2 of t[n] for i=n-1 downto 0:
+ .. point 2 of t[i] endfor withcolor 2/3 red;
+ z0 = whatever[point 0 of t0, point 3/2 of t0]
+ = whatever[point 0 of t1, point 3/2 of t1];
+ numeric a; a = angle (point 2 of t0 - z0);
+ label.lft(TEX("$a$") rotated a, point 5/2 of t0);
+ label.bot(TEX("$b$") rotated a, point 1/2 of t0);
+ label.rt(TEX("$x$") rotated a, point 1/2 of t1);
+ currentpicture := currentpicture rotated -a;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/curves-spiral-gnomon-trig.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-code.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-code.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-code.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,63 +0,0 @@
-numeric r, pi;
-r = 1.25cm; % radius of the wheel
-pi = 3.14159265; % constant
-%
-% define the cycloid
-path c;
-c = (0,-r) rotated 100 shifted (r*-100/180*pi,r)
- for t=-99 upto 460:
- -- (0,-r) rotated -t shifted (r*t/180*pi,r)
- endfor;
-% and the axes
-drawoptions(withcolor .5 white);
-path xx, yy;
-yy = (down -- 5 up) scaled 1/2 r;
-xx = (xpart point 0 of c, 0) -- (xpart point infinity of c,0);
-draw fullcircle scaled 1/4r; drawarrow xx; drawarrow yy;
-drawoptions();
-label.rt (btex $x$ etex, point 1 of xx);
-label.top(btex $y$ etex, point 1 of yy);
-% draw the cycloid on top of the axes
-draw c withcolor .67 red;
-
-% define a couple of related points:
-% z1 center of the blue wheel
-% z2 intersection of rim and cycloid
-t = 84; % if you change t then the wheel will "roll" along...
-z1 = (r*t/180*pi,r);
-z2 = (0,-r) rotated -t shifted z1;
-
-% draw the auxiliary lines
-draw (0,y2) -- z2 -- (x2,0) dashed withdots scaled .6;
-draw z2 -- z1 -- (x1,0);
-
-% draw the rolling circle
-draw fullcircle scaled 2r shifted z1 withcolor .67 blue;
-% mark the centre and intersection with cycloid
-fill fullcircle scaled dotlabeldiam shifted z1;
-fill fullcircle scaled dotlabeldiam shifted z2;
-
-% some arc arrows and labels
-path a[];
-z3 = (x1,5/12y1);
-a1 = z3 {left} .. {left rotatedabout(z1,-t)} z3 rotatedabout(z1,-t);
-drawarrow subpath (.05,.95) of a1;
-label.llft(btex $\theta$ etex, point .5 of a1);
-
-a2 = subpath (0,1) of reverse quartercircle scaled 2.2r shifted z1;
-drawarrow a2 rotatedabout(z1,-100);
-drawarrow a2 rotatedabout(z1,80);
-
-% finally all the other labels
-label.top(btex $r$ etex, .5[z1,z2]);
-label.lft(btex $y$ etex, (0,y2));
-% give all the x-axis labels a common baseline with mathstrut
-label.bot(btex $\mathstrut x$ etex, (x2,0));
-label.bot(btex $\mathstrut r\theta$ etex, (x1,0));
-label.bot(btex $\mathstrut 2\pi r$ etex, (r*2pi,0));
-% notice how nicely the coordinates work...
-dotlabel.top(btex $(\pi r,2r)$ etex, (pi*r,2r));
-% and a little alignment to finish
-label(btex $\vcenter{\halign{&$#$\hfil\cr
-x=r(\theta-\sin\theta)\cr
-y=r(1-\cos\theta)\cr}}$ etex,(4.2r,r));
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra-code.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra-code.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra-code.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,61 +0,0 @@
-numeric R, r, pi;
-R = 1.8cm; % radius of the outer part
-r = 1.3cm; % radius of the inner part
-pi = 3.14159265; % constant
-% define the cycloid
-path c;
-c = (0,-R) rotated 100 shifted (r*-100/180*pi,r)
- for t=-99 upto 460:
- -- (0,-R) rotated -t shifted (r*t/180*pi,r)
- endfor;
-% axes
-drawoptions(withcolor .5 white);
-path xx, yy;
-yy = (down -- 5 up) scaled 1/2 r;
-xx = (xpart point 0 of c, 0) -- (xpart point infinity of c,0);
-draw fullcircle scaled 1/4r; drawarrow xx; drawarrow yy;
-drawoptions();
-label.rt (btex $x$ etex, point 1 of xx);
-label.top(btex $y$ etex, point 1 of yy);
-
-% draw the cycloid on top of the axes
-draw c withcolor .67 red;
-
-% define a couple of related points:
-% z1 center of the blue wheel
-% z2 intersection of rim and cycloid
-t = 124; % if you change t then the wheel will "roll" along...
-z1 = (r*t/180*pi,r);
-z2 = (0,-R) rotated -t shifted z1;
-
-% draw the auxiliary lines
-draw (0,y2) -- z2 -- (x2,0) dashed withdots scaled .6;
-draw z2 -- z1 -- (x1,0);
-% draw the rolling circle and mark centre and intersection
-draw fullcircle scaled 2r shifted z1 withcolor 2/3 blue;
-draw fullcircle scaled 2R shifted z1 withcolor 1/2[2/3 blue, white];
-fill fullcircle scaled dotlabeldiam shifted z1;
-fill fullcircle scaled dotlabeldiam shifted z2;
-% some arc arrows and labels
-path a[];
-z3 = (x1,5/12y1);
-a1 = z3 {left} .. {left rotatedabout(z1,-t)} z3 rotatedabout(z1,-t);
-drawarrow subpath (.05,.95) of a1;
-label.llft(btex $\theta$ etex, point .5 of a1);
-a2 = subpath (0,1) of reverse quartercircle scaled 2.2r shifted z1;
-drawarrow a2 rotatedabout(z1,-100);
-% finally all the other labels
-label.rt (btex $r$ etex, (x1,.5y1));
-label.urt(btex $R$ etex, .6[z1,z2]);
-label.lft(btex $y$ etex, (0,y2));
-% give all the x-axis labels a common baseline with mathstrut
-label.bot(btex $\mathstrut x$ etex, (x2,0));
-label.bot(btex $\mathstrut r\theta$ etex, (x1,0));
-label.bot(btex $\mathstrut 2\pi r$ etex, (r*2pi,0));
-draw (down--up) scaled 2 shifted (r*2pi,0) withcolor .5 white;
-% notice how nicely the coordinates work...
-dotlabel.top(btex $(\pi r,R+r)$ etex, (pi*r,R+r));
-% and a little alignment to finish
-label(btex $\vcenter{\halign{&$#$\hfil\cr
-x=r\theta-R\sin\theta\cr
-y=r-R\cos\theta\cr}}$ etex,(4.75r,r));
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,10 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-input cycloids-extra-code
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids-extra.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,10 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- input cycloids-code
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/cycloids.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,58 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef plain_dots(expr boxpath, gap, radius, shade) =
+ save wd, ht, u, v; numeric wd, ht, u, v;
+ wd = arclength subpath (0,1) of boxpath;
+ ht = arclength subpath (1,2) of boxpath;
+ u = wd / round(wd/gap);
+ v = ht / round(ht/gap);
+ save B, R; picture B, R;
+ B = image(
+ draw (down -- right) xscaled 1/2u yscaled 1/2v
+ withpen pencircle scaled 1/4 radius
+ withcolor blue;
+ for x=1 upto round(wd/u):
+ pair p; p = point arctime x * u of boxpath of boxpath;
+ draw p
+ withpen pencircle scaled radius
+ withcolor shade;
+ draw p shifted -1/2(u, v)
+ withpen pencircle scaled radius
+ withcolor shade;
+ draw (left--down--right) xscaled 1/2u yscaled 1/2v shifted p
+ withpen pencircle scaled 1/4 radius
+ withcolor blue;
+ endfor);
+ R = image(for y=0 upto round(ht/v) - 1:
+ pair p; p = point arctime y * v of reverse boxpath of reverse boxpath;
+ draw p
+ withpen pencircle scaled radius
+ withcolor shade;
+ draw p
+ shifted 1/2(-u, v)
+ withpen pencircle scaled radius
+ withcolor shade;
+ draw (up -- left -- down) xscaled 1/2u yscaled 1/2v shifted p
+ withpen pencircle scaled 1/4 radius
+ withcolor blue;
+ endfor
+ draw p shifted 1/2(0, v) -- p shifted (-1/2u, v)
+ withpen pencircle scaled 1/4 radius
+ withcolor blue;
+ );
+ image(
+ draw B; draw B rotatedabout(center boxpath, 180);
+ draw R; draw R rotatedabout(center boxpath, 180);
+ )
+enddef;
+
+beginfig(1);
+ path bb; bb = unitsquare xscaled 233 yscaled 144;
+ draw plain_dots(bb, 8, 3, red);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/deco-borders.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/desargues.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/desargues.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/desargues.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,56 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-beginfig(1);
- z.P = 200 up rotated 21; z.A = 100 left rotated -21;
- z.B = origin; z.C = 90 right rotated 42;
-
- z.A' = 3/8[z.P, z.A];
- z.B' = 1/2[z.P, z.B];
- z.C' = 5/8[z.P, z.C];
-
- z.R = whatever [z.A, z.B] = whatever [z.A', z.B'];
- z.S = whatever [z.B, z.C] = whatever [z.B', z.C'];
- z.T = whatever [z.C, z.A] = whatever [z.C', z.A'];
-
- path t[];
- t1 = z.A--z.B--z.C--cycle;
- t2 = z.A'--z.B'--z.C'--cycle;
-
- fill t1 withcolor 7/8[red, white];
- fill t2 withcolor 7/8[blue, white];
- draw t1 withcolor 1/2 white;
- draw t2 withcolor 1/2 white;
-
- drawoptions(dashed withdots scaled 1/2);
- draw z.P--z.A;
- draw z.P--z.B;
- draw z.P--z.C;
-
- drawoptions(dashed evenly scaled 1/2);
- draw z.B--z.R--z.B';
- draw z.C--z.S--z.C';
- undraw subpath (1/4, 3/4) of (z.C'--z.T) withpen
- pencircle scaled 5;
- draw z.C--z.T--z.C';
- drawoptions(withcolor 2/3 red);
- draw 9/8[z.S,z.R] -- 9/8[z.R,z.S];
- picture pp; pp = thelabel("perspectrix", origin);
- draw pp shifted 7 down rotated angle (z.S-z.R)
- shifted 1/2[z.R, z.T];
- dotlabel.urt("perspector", z.P);
-
- drawoptions();
- dotlabel.lft (btex $A$ etex, z.A);
- dotlabel.llft(btex $B$ etex, z.B);
- dotlabel.lrt (btex $C$ etex, z.C);
- dotlabel.lft (btex $A'$ etex, z.A');
- dotlabel.llft(btex $B'$ etex, z.B');
- dotlabel.bot (btex $C'$ etex, z.C');
- label.rt(btex Desargues' Theorem etex, (x.C', 1/2(y.P+y.C')));
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/desargues.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dice.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dice.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dice.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,41 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-vardef dice(expr pip_count, pip_color) =
- save d,r,p, ul, ur, lr, ll;
- r=1/8; path d; picture p;
- %d = (for i=0 upto 3: subpath (r+i,1+i-r) of unitsquare .. endfor cycle) scaled 30;
- d = for i=0 upto 3: quartercircle scaled 3 shifted (15,15) rotated 90i -- endfor cycle;
- p = image(draw fullcircle scaled 6; fill fullcircle scaled 6 withcolor pip_color);
- pair ul, ur, ll, lr;
- ul = 1/5[ulcorner d, lrcorner d];
- lr = 4/5[ulcorner d, lrcorner d];
- ur = 1/5[urcorner d, llcorner d];
- ll = 4/5[urcorner d, llcorner d];
- image(fill d withcolor background; draw d;
- if odd(pip_count):
- draw p shifted center d;
- fi;
- if pip_count > 1:
- draw p shifted ul;
- draw p shifted lr;
- fi;
- if pip_count > 3:
- draw p shifted ur;
- draw p shifted ll;
- fi;
- if pip_count = 6:
- draw p shifted 1/2[ul,ur];
- draw p shifted 1/2[ll,lr];
- fi)
-enddef;
-
-beginfig(1);
-for i=0 upto 4:
- draw dice(1+floor uniformdeviate 6, red) rotated (2 normaldeviate) shifted (36i,0);
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dice.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-angle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-angle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-angle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,69 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-ahangle := 30;
-beginfig(1);
-
-path h; pair A, B, C, D, O; numeric theta;
-
-h = halfcircle scaled 320;
-
-O = origin;
-A = point 4 of h;
-B = point 0 of h;
-C = point 5/4 of h;
-D = (xpart C, ypart A);
-
-2theta = angle C;
-
-draw unitsquare scaled 8 rotated angle (C-D) shifted D withcolor 3/4;
-draw unitsquare scaled 8 rotated angle (A-C) shifted C withcolor 3/4;
-
-draw A--C--B withcolor Reds 7 7;
-draw O--C--D withcolor Reds 7 7;
-
-drawoptions(withcolor Blues 7 6);
-draw h;
-label.ulft("$x^2 + y^2 = 1$", point 3 of h);
-drawoptions();
-
-primarydef o through p = (1+o/arclength(p))[point 1 of p, point 0 of p] -- (1+o/arclength(p))[point 0 of p, point 1 of p] enddef;
-drawarrow 16 through (A--B);
-drawarrow 16 through (O--point 2 of h);
-
-dotlabel.bot("$A$", A);
-dotlabel.bot("$B$", B);
-dotlabel.urt("$C \smash{\;\bigl(\cos2\theta, \sin2\theta\bigr)}$", C);
-dotlabel.bot("$D$", D);
-dotlabel.llft("$O$", O);
-
-label("$\theta$", 28 dir 1/2 theta shifted A);
-label("$2\theta$", 20 dir theta);
-
-label("$x$", B shifted 24 right);
-label("$y$", point 2 of h shifted 24 up);
-
-draw thelabel.top("$2\cos\theta$", origin) rotated theta shifted 1/2[A, C];
-draw thelabel.top("$2\sin\theta$", origin) rotated (theta-90) shifted 1/2[B, C];
-
-label.bot("$\triangle ACD \sim \triangle ABC$", point 1/2 of bbox currentpicture shifted 24 down);
-
-path bb; bb = bbox currentpicture shifted 12 down;
-
-label.bot(btex \vbox{\openup 4pt\halign{\hfil $#$\hfil\cr
-CD \Big/ AC = BC \Big/ AB\cr
-\sin 2\theta \big/ 2 \cos\theta = 2 \sin\theta \big/ 2\cr
-\sin 2\theta = 2\sin\theta \cos\theta\cr}} etex, point 1/4 of bb);
-
-label.bot(btex \vbox{\openup 4pt\halign{\hfil $#$\hfil\cr
-AD \Big/ AC = AC \Big/ AB\cr
-\bigl(1 + \cos 2\theta \bigr) \big/ 2 \cos\theta = 2 \cos\theta \big/ 2\cr
-\cos 2\theta = 2\cos^2\theta - 1\cr}} etex, point 3/4 of bb);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-angle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-dragon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-dragon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-dragon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,57 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\mplibnumbersystem{double}
-\begin{mplibcode}
-beginfig(1);
-
-vardef zinverse(expr z) = 1/abs z * dir - angle z enddef;
-
-vardef fizz(expr X) =
- pair m, n;
- m = right;
- n = origin;
- numeric a, x;
- x = X;
- forever:
- exitif x = 0;
- m := m zscaled zinverse((-1, 1));
- a := x mod 2;
- n := n + a * m;
- x := x div 2;
- endfor
- n
-enddef;
-input colorbrewer-rgb
-color shade[];
-shade0 = Reds 5 4; shade1 = Oranges 5 4;
-shade2 = Greens 5 4; shade3 = Blues 5 4;
-
-beginfig(1);
- numeric s, t; s = 256; t = 4;
- for n=0 upto (s/t*s/t-1):
- numeric h, v;
- h = floor 1/8 (n mod 32);
- v = n mod 4;
- fill fullcircle scaled t shifted (fizz(n) scaled s)
- withcolor (1/2 + 1/8 v)[white, shade[h]];
- endfor;
- path xx, yy;
- xx = (left--right) scaled (s+8);
- yy = xx rotated 90;
- for i=-1 upto 1:
- draw xx shifted (0, s*i) withpen pencircle scaled 1/8;
- draw yy shifted (s*i, 0) withpen pencircle scaled 1/8;
- endfor
- dotlabel.lrt(btex $-1-i$ etex, (-1, -1) scaled s);
- dotlabel.lrt(btex $-1$ etex, (-1, 0) scaled s);
- dotlabel.lrt(btex $-1+i$ etex, (-1, 1) scaled s);
- dotlabel.lrt(btex $-i$ etex, (0, -1) scaled s);
- dotlabel.lrt(btex $+i$ etex, (0, 1) scaled s);
- dotlabel.lrt(btex $+1-i$ etex, (1, -1) scaled s);
- dotlabel.lrt(btex $+1$ etex, (1, 0) scaled s);
- dotlabel.lrt(btex $+1+i$ etex, (1, 1) scaled s);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/double-dragon.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/draw-picture.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/draw-picture.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/draw-picture.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,73 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- numeric s; s = 21;
- path alpha;
- alpha = ((-2s, s) {right}
- .. halfcircle rotated -90 scaled 2s shifted (2s, 0)
- .. {left} (-2s, -s)) shifted (s*left);
-
- vardef overdraw(expr a, b, r, P, shade) =
- linecap := butt;
- undraw subpath (a+r, b-r) of P withpen pencircle scaled 2;
- draw subpath (a, b) of P withcolor shade;
- enddef;
-
- picture cb; cb = image(
- draw alpha withcolor 2/3 red;
- undraw alpha rotated 180 withpen pencircle scaled 2;
- draw alpha rotated 180 withcolor 2/3 blue;
- overdraw(0.21, 0.36, 0.02, alpha, 2/3 red);
- overdraw(0.67, 0.86, 0.02, alpha, 2/3 red);
- overdraw(3.4, 4.3, 0.1, alpha, 2/3 red);
- overdraw(5.4, 5.6, 0.02, alpha, 2/3 red);
- overdraw(5.4, 5.6, 0.02, alpha rotated 180, 2/3 blue);
- );
-
- picture P[];
-
- P1 = image(draw cb; label.rt("\texttt{draw cb;}", point 3/2 of bbox currentpicture));
- P2 = image(draw cb withpen pencircle scaled 4; label.rt("\texttt{draw cb withpen pencircle scaled 4;}", point 3/2 of bbox currentpicture));
- P3 = image(draw cb withcolor 1/2; label.rt("\texttt{draw cb withcolor 1/2;}", point 3/2 of bbox currentpicture));
- P4 = image(draw cb withpen pencircle scaled 4 withcolor 1/2; label.rt("\texttt{draw cb withpen pencircle scaled 4 withcolor 1/2;}", point 3/2 of bbox currentpicture));
- P5 = image(
- color bagel; bagel = 1/256(187, 146, 79);
- for i=4 step -1/4 until 1/2:
- draw cb withpen pencircle scaled i
- withcolor (i/4)[white, bagel];
- endfor
- label.rt(btex \vbox{\halign{\texttt{#}\cr
- for i=4 step -1/4 until 1/2:\cr
- \quad draw cb withpen pencircle scaled i \cr
- \qquad withcolor sqrt(i/4)[white, bagel];\cr
- endfor\cr}} etex, point 3/2 of bbox currentpicture);
- );
-
- P6 = image(
- for e within cb:
- draw pathpart e withpen penpart e scaled 4
- withcolor 7/8[colorpart e, background];
- endfor
- label.rt(btex \vbox{\halign{\texttt{#}\cr
- for e within cb:\cr
- \quad draw pathpart e withpen penpart e scaled 4\cr
- \qquad withcolor 7/8[colorpart e, background];\cr
- endfor\cr}} etex, point 3/2 of bbox currentpicture);
- );
-
- for i=1 upto 6:
- if known P[i]:
- pair p; p = 60i * down;
- label.rt(P[i], p);
- fill superellipse(right, up, left, down, 0.8) scaled 6 shifted p
- withcolor 2/3;
- label("\textsf{" & decimal i & "}", p) withcolor white;
- fi;
- endfor
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/draw-picture.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/drawing-circles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/drawing-circles.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/drawing-circles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,64 +0,0 @@
-\documentclass[border=0mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-color TR, TB, TG;
-TB = (.2,.2,.7);
-TR = (0.54,0,0);
-TG = (0, 0.44, 0);
-
-path xx, yy;
-xx = (left--right) scaled 144;
-yy = (down--up) scaled 89;
-
-ahangle := 30;
-picture P[];
-P0 = image(drawarrow xx withcolor 1/2; drawarrow yy withcolor 1/2);
-P1 = image(draw P0;
- path c, a;
- c = fullcircle scaled 4cm shifted (34, 21);
- a = point 1 of c -- center c;
- draw c withcolor TR;
- draw fullcircle scaled 3 shifted (34,21); label.lrt("$(34,21)$", (34,21));
- drawdblarrow a; label.ulft("2 cm", point 1/2 of a);
-);
-
-vardef circle_through(expr A, B, C) =
- save o; pair o;
- o = whatever * (A-B) rotated 90 shifted 1/2[A,B]
- = whatever * (B-C) rotated 90 shifted 1/2[B,C];
- fullcircle scaled 2 abs (A-o) shifted o
-enddef;
-
-P2 = image(draw P0;
- pair A, B, C;
- A = (-21, -13);
- B = (58, 21);
- C = (89, -34);
-
- path c[];
- c1 = fullcircle scaled 2 abs(A-B) shifted A;
- c2 = fullcircle scaled abs(A-B) shifted 1/2[A, B];
- c3 = circle_through(A, B, C);
-
- draw c1 withcolor TR; label.ulft("I", point 3 of c1) withcolor TR;
-
- draw A -- B dashed withdots scaled 1/4 withpen pencircle scaled 1/4 withcolor TB;
- draw c2 withcolor TB; label.ulft("II", point 3 of c2) withcolor TB;
- draw fullcircle scaled 2 shifted 1/2[A, B] withcolor TB;
-
- draw c3 withcolor TG; label.urt("III", point 1 of c3) withcolor TG;
-
- dotlabel.llft("$A$", A);
- dotlabel.urt("$B$", B);
- dotlabel.lrt("$C$", C);
-);
-
-beginfig(1);
-labeloffset := 10;
-label.top(P1, origin);
-label.bot(P2, origin);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/drawing-circles.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dwmpcode.sty
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dwmpcode.sty 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dwmpcode.sty 2024-10-30 20:00:04 UTC (rev 72705)
@@ -2,11 +2,13 @@
\ProvidesPackage{dwmpcode}[2021/12/30 v0.01 Code setting in DwMP]
\RequirePackage{listings}
\RequirePackage{xcolor}
+\RequirePackage{luamplib}
\definecolor{textblue}{rgb}{.2,.2,.7}
\definecolor{textred}{rgb}{0.54,0,0}
\definecolor{textgreen}{rgb}{0,0.43,0}
\definecolor{squash}{rgb}{0.793, 0.359, 0.05}
\definecolor{carrot}{rgb}{0.934, 0.445, 0.082}
+\definecolor{purple}{rgb}{0.398, 0.008, 0.234}
\def\red#1{\textcolor{textred}{#1}}
\def\blue#1{\textcolor{textblue}{#1}}
\def\green#1{\textcolor{textgreen}{#1}}
@@ -16,6 +18,7 @@
keywordstyle=\color{textblue},
keywordstyle=[5]\color{squash},
keywordstyle=[6]\color{carrot},
+keywordstyle=[7]\color{purple},
commentstyle=\color{textred},
stringstyle=\color{textgreen},
frame=none,
@@ -23,13 +26,85 @@
keepspaces=true,
xleftmargin=\parindent,
showstringspaces=false,
-morekeywords={cmykcolor, step, eps, exitif, rotatedabout},
-morestring=[s]{btex}{etex}
+% keywords[1] = Syntax primitive + plain sugar
+keywords=[1]{beginfig, begingroup, bye, controls, curl, verbatimtex,%
+ cycle, def, delimiters, downto, else, elseif, end, enddef, endfig,%
+ endfor, endgroup, etex, exitif, exitunless, expr, fi, for, forever,%
+ forsuffixes, if, input, numtok, outer, primary, primarydef, range,%
+ relax, scantokens, secondary, secondarydef, step, suffix, tension,%
+ tertiary, tertiarydef, text, thru, until, upto, vardef, within},%
+% keywords[2] = Operators - nullary, unary, binary, thing x of y
+keywords=[2]{abs, and, angle, arclength, arctime, ASCII, bbox,%
+ blackpart, bluepart, bounded, byte, ceiling, center, char,%
+ clipped, colormodel, colorpart, cosd, counterclockwise, cutafter,%
+ cutbefore, cyanpart, dashpart, decimal, dir, direction,%
+ directionpoint, directiontime, div, dotprod, false, filled, floor,%
+ fontpart, fontsize, glyph, gobbled, greenpart, greypart, hex,%
+ infont, intersectionpoint, intersectiontimes, inverse, known,%
+ length, llcorner, lrcorner, magentapart, makepath, makepen,%
+ mexp, mlog, mod, normaldeviate, not, nullpen, nullpicture, oct,%
+ odd, of, or, pathpart, pencircle, penoffset, penpart, point,%
+ postcontrol, precontrol, readfrom, redpart, reflectedabout,%
+ reverse, rotated, rotatedabout, rotatedaround, round, scaled,%
+ shifted, sind, slanted, softjoin, sqrt, str, stroked, subpath,%
+ substring, textpart, textual, transformed, true,%
+ turningnumber, ulcorner, uniformdeviate, unitvector, unknown,%
+ urcorner, whatever, xpart, xscaled, xxpart, xypart, yellowpart,%
+ ypart, yscaled, yxpart, yypart, zscaled,
+ top, bot, lft, rt, ulft, urt, llft, lrt},%
+% keywords[3] = Commands
+keywords=[3]{addto, also, batchmode, clearit, clearpen, clearxy,%
+ clear_pen_memory, clip, closefrom, contour, cutdraw, dotlabel,%
+ doublepath, draw, drawarrow, drawdblarrow, drawdot, drawoptions,%
+ errhelp, errmessage, errorstopmode, filenametemplate, fill,%
+ filldraw, fontmapfile, fontmapline, interim, label, let,%
+ loggingall, makelabel, message, newinternal, nonstopmode,%
+ penstroke, pickup, randomseed, readstring, save, savepen,%
+ scrollmode, setbounds, shipit, shipout, show, showdependencies,%
+ showtoken, showvariable, special, to, tracingall, tracingnone,%
+ undraw, undrawdot, unfill, unfilldraw, write},%
+% keywords[4] = Specials, fancy macros, etc
+keywords=[4]{boxit, boxjoin, bpath, buildcycle, circleit, dashed,%
+ dashpattern, decr, dotlabels, drawboxed, drawboxes, drawunboxed,%
+ erase, fixpos, fixsize, flex, gobble, hide, image, incr, interact,%
+ interpath, labels, magstep, max, min, off, on, penlabels, penpos,%
+ solve, stop, superellipse, takepower, tensepath, thelabel,%
+ withcmykcolor, withcolor, withgreyscale, withoutcolor, withpen,%
+ withpostscript, withprescript, withrgbcolor, withalpha, z},%
+% keywords[5] = Predefined variables
+keywords=[5]{ahangle, ahlength, arrowhead, background, bboxmargin,%
+ charcode, circmargin, currentpen, currentpicture, cuttings, day,%
+ defaultcolormodel, defaultdx, defaultdy, defaultfont, defaultpen,%
+ defaultscale, dotlabeldiam, eps, extra_beginfig, extra_endfig,%
+ hour, hppp, jobname, join_radius, labeloffset, laboff, labxf,%
+ labyf, linecap, linejoin, minute, miterlimit, month, mpprocset,%
+ numberprecision, numbersystem, outputfilename, outputformat,%
+ outputformatoptions, outputtemplate, pausing, pen_bot, pen_lft,%
+ pen_rt, pen_top, prologues, restoreclipcolor, showstopping, time,%
+ tolerance, tracingcapsules, tracingchoices, tracingcommands,%
+ tracingequations, tracinglostchars, tracingmacros, tracingonline,%
+ tracingoutput, tracingrestores, tracingspecs, tracingstats,%
+ tracingtitles, troffmode, truecorners, vppp, warningcheck, year},%
+% keywords[6] = Constants
+keywords=[6]{base_name, base_version, beveled, black,%
+ blankpicture, blue, bp, butt, cc, cm, dd, ditto, down, EOF,%
+ epsilon, evenly, fullcircle, green, halfcircle, identity, in, left,%
+ mitered, mm, mpversion, origin, pc, penrazor, penspeck,%
+ pensquare, pt, quartercircle, red, right, rounded, squared,%
+ unitsquare, up, white, withdots, infinity},%
+% keywords[7] = Types
+keywords=[7]{boolean, cmykcolor, color, numeric, pair, path, pen,%
+ picture, rgbcolor, string, transform},%
+sensitive=true,%
+alsoother={0123456789$@},%
+morestring=[s]{verbatimtex}{etex},%
+morestring=[s]{btex}{etex}%
}}
\lstnewenvironment{smallcode}[1][]{\mpstyle\lstset{basicstyle=\small\ttfamily,#1}}{}
\lstnewenvironment{code}[1][]{\mpstyle\lstset{#1}}{}
\newcommand\mpexternal[2][]{{\mpstyle\lstinputlisting[#1]{#2}}}
-\newcommand\mpl[1]{{\mpstyle\lstinline!#1!}}
+\newcommand\smallmpexternal[2][]{{\mpstyle\lstinputlisting[basicstyle=\small\ttfamily,#1]{#2}}}
+\newcommand\mpl[1]{{\normalfont\mpstyle\lstinline!#1!}}
%
\newcommand\texstyle{\lstset{
language=[LaTeX]Tex,
@@ -42,8 +117,21 @@
keepspaces=true,
xleftmargin=\parindent,
showstringspaces=false,
+morekeywords={everymplib, everyendmplib, setmainfont,
+mplibtextextlabel, mplibnumbersystem, mplibsetformat, mplibshowlog},
}}
\lstnewenvironment{texcode}[1][]{\texstyle\lstset{basicstyle=\small\ttfamily,#1}}{}
\newcommand\txl[1]{{\texstyle\lstinline!#1!}}
+\newcommand\texternal[2][]{{\texstyle\lstinputlisting[#1]{#2}}}
+\newcommand\smalltexternal[2][]{{\texstyle\lstinputlisting[basicstyle=\small\ttfamily,#1]{#2}}}
%
+% Labels..
+%
+\newcommand\sep[1]{$\vcenter{\begin{mplibcode}
+picture T; T = thelabel(TEX("\ttfamily " & #1), origin); interim bboxmargin := 3; path p; p = bbox T;
+path S; S = superellipse(point 3/2 of p, point 5/2 of p, point 7/2 of p, point 1/2 of p, 0.78);
+string x; x = substring (0, 1) of #1;
+fill S withcolor if x = "m": 7/8[red, white] elseif x = "c": 7/8[blue, white] else: white fi;
+draw S; draw T;\end{mplibcode}}$}
+%
\endinput
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dynamic-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dynamic-labels.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dynamic-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,19 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(2);
-path c; c = fullcircle scaled 100; draw c withcolor .67 red;
-for i=0 upto 7:
- fill fullcircle scaled 3 shifted point i of c;
- z[i] = point i of c scaled 1.15;
- write "label(btex $p_" & decimal i & "$ etex,("
- & decimal x[i] & "," & decimal y[i]
- & "));" to ".mplabels";
-endfor
-write EOF to ".mplabels";
-input ".mplabels";
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/dynamic-labels.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-357.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-357.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-357.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -7,26 +7,18 @@
beginfig(1);
path base, cup, cap, egg;
-
base = fullcircle scaled 180;
-z0 = origin;
z1 = point -2/3 of base;
z2 = point 2/3 of base;
z3 = point 10/3 of base;
z4 = point 14/3 of base;
-z5 = 1/2[z2, z3];
-z6 = 1/2[z4, z1];
-
-numeric a, b, c;
-a = abs(z3 - z1);
-b = a - abs(z4 - z6);
-c = a - abs(z4 - z5);
-
-cup = subpath (4, 8) of fullcircle scaled 2b shifted z6;
-cap = fullcircle scaled 2c shifted z5
- cutbefore (z5 -- 2[z4, z5])
- cutafter (z5 -- 2[z1, z5]);
-
+z5 = 1/2[z2, z3]; z6 = 1/2[z4, z1];
+numeric a, b;
+a = abs(z3-z1) - abs(z4-z6);
+b = abs(z3-z1) - abs(z4-z5);
+cup = subpath (4, 8) of fullcircle scaled 2a shifted z6;
+cap = fullcircle scaled 2b shifted z5
+ cutbefore (z5 -- 2[z4, z5]) cutafter (z5 -- 2[z1, z5]);
egg = point 4 of cup {up} .. cap .. {down} cup & cycle;
fill egg withpen pencircle scaled 2 withcolor eggshell;
@@ -39,7 +31,7 @@
label.ulft("$\scriptstyle \sqrt 7$", 7/16[z4, z5]);
draw base;
draw z1 -- z2 -- z3 -- z4 -- z6 -- z5;
-draw z0 withpen pencircle scaled 2;
+draw origin withpen pencircle scaled 2;
drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
draw point 0 of egg -- point 4 of egg;
draw z4 -- point 1 of egg;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-357.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-five-better.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-five-better.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-five-better.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,7 +3,7 @@
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
-numeric a; a = 56;
+numeric a; a = 56;
path r[]; % the rings
r1 = fullcircle scaled 2a shifted (0, -3/2 a);
r2 = fullcircle scaled 2a shifted (0, -1/2 a);
@@ -11,7 +11,6 @@
r4 = fullcircle scaled 2a shifted (0, +3/2 a);
r5 = r2 rotatedabout(point 2 of r2, -60);
r6 = r2 rotatedabout(point 2 of r2, +60);
-
pair o[]; % the centres of rotation for each arc
o1 = point 6 of r5;
o2 = point 2 of r3;
@@ -21,13 +20,11 @@
o6 = 1/2[point 2-4/3 of r1, point 2+4/3 of r1];
o5 = whatever[o6, point 2-4/3 of r3] = whatever[o4, point 2+4/3 of r1];
o7 = whatever[o6, point 2+4/3 of r3] = whatever[o8, point 2-4/3 of r1];
-
pair u[], t[]; % directions and points for the egg
u0 = (o8 - o1) rotated 90; t0 = directionpoint u0 of r6;
u1 = (o2 - o1) rotated 90; t1 = directionpoint u1 of r4;
u2 = (o2 - o3) rotated 90; t2 = directionpoint u2 of r4;
u3 = (o4 - o3) rotated 90; t3 = directionpoint u3 of r5;
-
u4 = (o5 - o4) rotated 90;
u5 = (o6 - o5) rotated 90;
u6 = (o6 - o7) rotated 90;
@@ -37,8 +34,7 @@
t6 = directionpoint u6 of fullcircle scaled 2 abs (t5 - o6) shifted o6;
t7 = directionpoint u7 of fullcircle scaled 2 abs (t6 - o7) shifted o7;
-path egg;
-egg = for i=0 upto 7: t[i] {u[i]} .. endfor cycle;
+path egg; egg = for i=0 upto 7: t[i] {u[i]} .. endfor cycle;
input eggs-common
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-five-better.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-four-point.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-four-point.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-four-point.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -9,13 +9,16 @@
path egg, a, b, c, d;
a = fullcircle scaled 80;
b = a scaled 2 shifted point 6 of a;
-c = halfcircle scaled 2 (abs(point 0 of a - point 5 of b) - abs(point 0 of a));
-d = fullcircle scaled 2 abs(point 2 of a - point 2 of c) shifted point 2 of c;
-egg = point 0 of c {up} .. subpath (1,3) of d .. {down} point 4 of c .. subpath (5, 7) of b .. cycle;
+c = halfcircle
+ scaled 2 (abs(point 0 of a - point 5 of b) - abs(point 0 of a));
+d = fullcircle
+ scaled 2 abs(point 2 of a - point 2 of c) shifted point 2 of c;
+egg = point 0 of c {up} .. subpath (1,3) of d .. {down} point 4 of c
+ .. subpath (5, 7) of b .. cycle;
fill egg withpen pencircle scaled 2 withcolor 3/4[1/4[red, green], white];
picture P; P = currentpicture;
-drawoptions(withpen pencircle scaled 1/4 withcolor darker_eggshell);
+drawoptions(withpen pencircle scaled 1/4 withcolor dark_eggshell);
draw a; draw b; draw c; draw d;
drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
draw point 0 of c -- point 3 of egg;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-four-point.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-fried.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-fried.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-fried.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,29 +4,20 @@
\begin{mplibcode}
beginfig(1);
path yolk, base;
-color cooked_egg_yolk, cooked_egg_white;
-cooked_egg_yolk = 1/256(216, 136, 49);
-cooked_egg_white = 1/256(235, 237, 233);
-
-vardef fried_egg(expr r) =
+color cooked_egg_yolk; cooked_egg_yolk = 1/256(216, 136, 49);
+color cooked_egg_white; cooked_egg_white = 1/256(235, 237, 233);
+vardef fried_egg(expr r) = image(
save base, yolk; path base, yolk;
yolk = for i=0 upto 17: (r + 1/8 normaldeviate) * dir 20i .. endfor cycle;
base = (for i=0 upto 17: (2r + 1/8r * normaldeviate) * dir 20i .. endfor cycle)
- shifted (uniformdeviate r/2, uniformdeviate r/2);
- image(
- fill base withcolor cooked_egg_white;
- fill yolk withcolor cooked_egg_yolk;
- fill subpath (6.7, 9.6) of yolk scaled 0.8 --
- subpath (9.6, 6.7) of yolk scaled 0.66 -- cycle
- withcolor 1/2[cooked_egg_yolk, white];
- )
-enddef;
-
-for i=0 upto 1:
- draw fried_egg(40) shifted 120 dir 120i;
-endfor
-
-
+ shifted (uniformdeviate r/2, uniformdeviate r/2);
+ fill base withcolor cooked_egg_white;
+ fill yolk withcolor cooked_egg_yolk;
+ fill subpath (6.7, 9.6) of yolk scaled 0.8 --
+ subpath (9.6, 6.7) of yolk scaled 0.66 -- cycle
+ withcolor 1/2[cooked_egg_yolk, white]
+) enddef;
+for i=0 upto 1: draw fried_egg(40) shifted 120 dir 120i; endfor
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-fried.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-gold.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-gold.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-gold.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,29 +6,21 @@
input eggs-common
beginfig(1);
-path base;
-base = fullcircle scaled 200;
-
-pair m, n, n', p;
-path aa, bb;
-
-m = 1/2 point 0 of base;
-aa = halfcircle scaled 2 abs (point 2 of base - m) shifted m cutbefore (origin -- 1000 up);
-n = point infinity of aa;
-n' = n reflectedabout(up, down);
+path base, aa, bb; pair m, n, n';
+base = fullcircle scaled 200; m = 1/2 point 0 of base;
+aa = halfcircle scaled 2 abs (point 2 of base - m)
+ shifted m cutbefore (origin -- 1000 up);
+n = point infinity of aa; n' = n reflectedabout(up, down);
bb = subpath (0, 2) of base shifted n cutafter (origin -- 1000 up);
-p = point infinity of bb;
-
-path dome;
-path cap, cup, egg;
+path dome, cap, cup, egg;
dome = fullcircle
scaled 2 (abs(n - point 0 of base) - abs(n - point 0 of bb))
- shifted p;
+ shifted point length bb of bb;
cap = dome
cutbefore (point 4 of bb -- 2[n, point 4 of bb])
cutafter (point 4 of bb -- 2[n', point 4 of bb]);
cup = subpath (4, 8) of base;
-path egg; egg = point 4 of cup {up} .. cap .. {down} cup & cycle;
+egg = point 4 of cup {up} .. cap .. {down} cup & cycle;
fill egg withpen pencircle scaled 2 withcolor eggshell;
picture P; P = currentpicture;
@@ -40,7 +32,6 @@
label.bot("$m$", m);
label.ulft("$n$", n);
label.urt("$n'$", n');
-% label.lft("$p$", p);
drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
draw n -- point 1 of egg;
@@ -48,7 +39,7 @@
draw point 0 of egg -- point 4 of egg;
draw egg;
-forsuffixes $=n, n', p, origin: draw $ withpen pencircle scaled 2; endfor
+forsuffixes $=n, n', origin: draw $ withpen pencircle scaled 2; endfor
draw m withpen pencircle scaled 2 withcolor dark_eggshell;
draw numbered_points(egg);
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-gold.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-moss.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-moss.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-moss.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -11,21 +11,21 @@
shifted point 2 of a;
egg = subpath (0, 1) of b .. point 2 of d ..
subpath (3, 4) of c .. subpath (5, 7) of a .. cycle;
+
beginfig(1);
-fill egg withpen pencircle scaled 2 withcolor eggshell;
-picture P; P = currentpicture;
-drawoptions(withpen pencircle scaled 1/4 withcolor dark_eggshell);
-draw a; draw d;
-drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
-draw point 1 of egg -- point 4 of egg --
- point 0 of egg -- point 3 of egg;
-draw egg;
-drawoptions(withpen pencircle scaled 2 withcolor 7/16);
-draw center a;
-draw center d;
-draw numbered_points(egg);
-drawoptions();
-draw P shifted 240 right;
+ fill egg withpen pencircle scaled 2 withcolor eggshell;
+ picture plain_egg; plain_egg = currentpicture;
+ drawoptions(withpen pencircle scaled 1/4 withcolor dark_eggshell);
+ draw a; draw d;
+ drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
+ draw point 1 of egg -- point 4 of egg --
+ point 0 of egg -- point 3 of egg;
+ draw egg;
+ drawoptions(withpen pencircle scaled 2 withcolor 7/16);
+ draw center a; draw center d;
+ draw numbered_points(egg);
+ drawoptions();
+ draw plain_egg shifted 240 right;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-perfect.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-perfect.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-perfect.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,9 +5,8 @@
\begin{mplibcode}
input eggs-common
beginfig(1);
+
path egg;
-%egg = for t=90,105,120,135,150,165,-180,-165,-150,-135,-120,-105,-90,-75,-60,-45,-30,-15,0,15,30,45,60,75:
-%egg = for t=90, 135, 180, -135, -90, -45, 0, 45:
egg = for t=-180 step 15 until 180 - eps:
(0.78 cosd(1/4 t) * sind(t), -cosd(t)) ..
endfor cycle;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-perfect.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-shaded.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-shaded.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-shaded.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,22 +5,18 @@
\begin{mplibcode}
path egg, spot;
egg = (for t=-180 step 15 until 180 - eps:
- (0.78 cosd(1/4 t) * sind(t), -cosd(t)) ..
+ (0.78 cosd(1/4 t) * sind(t), -cosd(t)) ..
endfor cycle) scaled 100;
-
spot = fullcircle scaled 4 shifted 3/4 point 3 of egg;
-
vardef fade_filled(expr egg, spot, dark, light, n) = image(
- for i = 0 upto n:
- fill interpath(i/n, egg, spot) withcolor ((i/n)**1/3)[dark,light];
- endfor)
+ for i = 0 upto n:
+ fill interpath(i/n, egg, spot) withcolor ((i/n)**1/3)[dark,light];
+ endfor)
enddef;
-
beginfig(1);
- color a, b;
- a = 1/256(150, 100, 60);
- b = 1/256(256, 220, 180);
- draw fade_filled(egg, spot, a, b, 256) rotated -30;
+ color a; a = 1/256(150, 100, 60);
+ color b; b = 1/256(256, 220, 180);
+ draw fade_filled(egg, spot, a, b, 256) rotated -30;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-shaded.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-super.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-super.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-super.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,7 +4,8 @@
\begin{document}
\begin{mplibcode}
path egg;
-egg = (superellipse(right, 1.6 up, left, 1.2 down, 0.69)) scaled 100;
+egg = (superellipse(right, 1.6 up, left, 1.2 down, 0.69));
+egg := egg scaled 100;
input eggs-common
beginfig(1);
fill egg withpen pencircle scaled 2 withcolor eggshell;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-super.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-thom.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-thom.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/eggs-thom.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -13,8 +13,7 @@
cutbefore ((b, 0) -- (b, 2r))
cutafter ((-b, 0) -- (-b, 2r));
egg = point 4 of base {up} .. cap .. {down} base & cycle;
-% more naturally
-% base {up} .. cap .. {down} & cycle
+% more naturally "base {up} .. cap .. {down} & cycle"
% but then point 0 would not be at 3 o'clock
beginfig(1);
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/escher.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/escher.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/escher.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,38 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-
-numeric s; s = 13;
-path atom;
-atom = origin
- -- (2s,0) rotated -30 -- (2s,0) rotated -30 + (0,s)
- -- ( s,0) rotated 30 -- ( s,0) rotated 30 + (0,s)
- -- (0,2s) -- cycle;
-
-picture p[];
-for i=0 upto 2:
- p[i] = image(
- fill atom rotated -120i withcolor (7/8 - 1/8i) ;
- draw atom rotated -120i;
- );
-endfor
-
-n = 13;
-for i=-n upto n:
- for j=-n upto n:
- forsuffixes $=0,1,2:
- draw p$ shifted ((3i*s,0) rotated -30
- + (0,floor(1/2i)*3s + 3j*s));
- endfor
- endfor
-endfor
-
-clip currentpicture to (unitsquare shifted -(1/2,1/2)
- xscaled 55.425s yscaled 30s);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/escher.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/euler-sampler.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/euler-sampler.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/euler-sampler.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,24 +0,0 @@
-\documentclass[border=8pt]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
- for i=0 upto 15:
- label.top(decimal i infont "cmss10" scaled 0.7, (15i,108)) withcolor .67 red;
- for j=0 upto 7:
- draw char (i+16j) infont "eurm10" shifted (15i-3,97-14j);
- if i=0:
- label.lft(decimal 16j infont "cmss10" scaled 0.7, (-8,100-14j)) withcolor .67 red;
- fi
- % if (i + 16j) > 0:
- % draw char (i + 16j) infont "cmmi10"
- % scaled 0.5
- % shifted (15i - 6, 97-14j)
- % withcolor .67 blue;
- % fi
- endfor
- endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/euler-sampler.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/excircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/excircle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/excircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,39 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef through(expr a, b, o) =
- save t; numeric t; t = 1+o/abs(a-b);
- t[b,a] -- t[a,b]
-enddef;
-
-beginfig(1);
- pair A, B, C;
- A = origin; B = 233 dir 10; C = 144 dir 70;
- pair a, b, m, t;
- a = A + 22 unitvector (C-A) - 22 unitvector (B-A);
- b = B + 22 unitvector (A-B) + 22 unitvector (C-B);
- m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
- t-m = whatever * (B-A) rotated 90;
-
- drawoptions(dashed evenly scaled 1/4 withcolor 1/2 white);
- draw t -- m;
- draw unitsquare scaled 5 rotated angle (B-A) shifted t;
- draw through(A, m, 10);
- draw through(A, t, 10);
- draw through(B, m, 10);
- drawoptions();
- draw fullcircle scaled 2 abs (t-m) shifted m withcolor 2/3 blue;
- draw A--B--C--cycle;
- dotlabel.urt(btex $m$ etex, m);
- dotlabel.bot(btex $t$ etex, t);
- dotlabel.bot(btex $A$ etex, A);
- dotlabel.urt(btex $B$ etex, B);
- dotlabel.top(btex $C$ etex, C);
- dotlabel.urt(btex $a$ etex, a);
- dotlabel.top(btex $b$ etex, b);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/excircle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/explode.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/explode.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/explode.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,31 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\usepackage{fontspec}
-\setmainfont{PlayfairDisplay-Black}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-randomseed:=2128.5073;
-beginfig(1);
-n = 40; r = 7 ; s = 44;
-path explosion, splash;
-explosion = for i=1 upto n:
- (s if odd(i): - else: + fi r + uniformdeviate r,0) rotated (i*360/n) --
-endfor cycle;
-
-splash = for i=1 upto n:
- (s if odd(i): - else: + fi r + uniformdeviate r,0) rotated (i*360/n) ..
-endfor cycle;
-splash := splash shifted (3s,0);
-
-fill explosion withcolor Oranges 7 4;
-draw explosion withpen pencircle scaled 2 withcolor Reds 7 7;
-label(TEX("\textbf{BOOM!}") scaled 1.6, center explosion) withcolor Reds 7 7;
-
-fill splash withcolor Blues 7 2;
-draw splash withpen pencircle scaled 2 withcolor Blues 7 7;
-label(TEX("\bfseries SPLAT!") scaled 1.6, center splash) withcolor Blues 7 7;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/explode.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/fake-transparency.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/fake-transparency.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/fake-transparency.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,57 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-% parameters
-u = 1cm;
-ymax = xmax = 2.75;
-xmin = ymin = -1.75;
-
-% make a plain grid
-path xx, yy;
-xx = ((xmin,0) -- (xmax,0)) scaled u;
-yy = ((0,ymin) -- (0,ymax)) scaled u;
-
-drawoptions(dashed withdots scaled 1/4 withcolor 3/4 white);
-for i = ceiling ymin upto floor ymax: draw xx shifted (0,i*u); endfor
-for i = ceiling xmin upto floor xmax: draw yy shifted (i*u,0); endfor
-
-drawoptions(withpen pencircle scaled .7);
-xx := xx scaled 1.05;
-yy := yy scaled 1.05;
-drawarrow xx;
-drawarrow yy;
-drawoptions();
-
-label.urt("A" infont defaultfont scaled 8, origin) withcolor 1/4 green;
-
-% draw the "transparent" superellipse box
-path se;
-%se = unitsquare shifted 1/2 down shifted 1/4 left scaled 3cm;
-se = (superellipse(right, up, left, down, 0.81))
-shifted 1/2 right scaled 30 rotated 30;
-
-alpha = 5/8; % alpha: 0=invisible, 1=opaque
-color filler; filler = .95[red,white];
-picture fg, bg;
-bg = currentpicture;
-fg = image(
- for e within bg:
- draw e withcolor alpha[colorpart e, filler];
- endfor
- draw se withpen pencircle scaled 2 withcolor 3/4;
- draw subpath (2.718, 3.1415) of se
- shifted - center se scaled 7/8 shifted + center se
- withpen pencircle scaled 2 withcolor white;
-
-);
-clip fg to se;
-
-fill se withcolor filler;
-draw fg;
-draw se withcolor 3/4 blue;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/fake-transparency.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-addition-of-sines.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-addition-of-sines.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-addition-of-sines.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -19,40 +19,41 @@
enddef;
beginfig(1);
- numeric u, pi; u = 50; pi = 3.141592653589793;
+ numeric u, pi; u = 50; pi = 3.141592653589793;
- path xx, yy;
- xx = (3.5 left -- 4 right) scaled u;
- yy = (1.2 down -- 1.3 up) scaled u;
-
- path ss, tt, uu;
- ss = origin for x=1 upto 360: -- (x, sind(x)) endfor;
- tt = origin for x=1 upto 360: -- (x, 1/2 sind(3x)) endfor;
- uu = origin for x=1 upto 360: -- (x, ypart point x of ss + ypart point x of tt) endfor;
+ path xx, yy;
+ xx = (3.5 left -- 4 right) scaled u;
+ yy = (1.2 down -- 1.3 up) scaled u;
+
+ path ss, tt, uu;
+ ss = origin for x=1 upto 360: -- (x, sind(x)) endfor;
+ tt = origin for x=1 upto 360: -- (x, 1/2 sind(3x)) endfor;
+ uu = origin for x=1 upto 360:
+ -- (x, ypart point x of ss + ypart point x of tt)
+ endfor;
- forsuffixes $=ss, tt, uu:
- $ := $ shifted 360 left & $;
- $ := $ xscaled (pi/180) scaled u;
- $ := $ cutbefore yy shifted point 0 of xx
- cutafter yy shifted point 1 of xx;
- endfor
+ forsuffixes $=ss, tt, uu:
+ $ := $ shifted 360 left & $;
+ $ := $ xscaled (pi/180) scaled u;
+ $ := $ cutbefore yy shifted point 0 of xx
+ cutafter yy shifted point 1 of xx;
+ endfor
- draw ss withcolor 1/2[blue, white];
- draw tt withcolor 1/2[red, white];
- draw uu withcolor 1/4 green;
+ drawoptions(withcolor 3/4 blue);
+ draw ss; label.top("$f(x)=\sin(x)$", point 290 of ss);
+ drawoptions(withcolor 2/3 red);
+ draw tt; label.bot("$g(x)=\frac12 \sin(3x)$", point 295 of tt);
+ drawoptions(withcolor 1/4 green);
+ draw uu; label.urt("$f(x) + g(x)$", point 350 of uu);
+ drawoptions();
+
+ drawarrow xx; label.rt("$x$", point 1 of xx);
+ drawarrow yy; label.top("$y$", point 1 of yy);
- label.top("$f(x)=sin(x)$", point 290 of ss) withcolor 1/2[blue, white];
- label.bot("$g(x)=\frac12 sin(3x)$", point 295 of tt) withcolor 1/2[red, white];
- label.urt("$f(x) + g(x)$", point 350 of uu) withcolor 1/4 green;
-
- drawarrow xx; label.rt("$x$", point 1 of xx);
- drawarrow yy; label.top("$y$", point 1 of yy);
-
- for i=-6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7:
- draw (down--up) scaled 2 shifted (pi * i/6 * u, 0);
- label.bot(pi_sixths(i), (pi * i/6 * u, -2));
- endfor
-
+ for i=-6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7:
+ draw (down--up) scaled 2 shifted (pi * i/6 * u, 0);
+ label.bot(pi_sixths(i), (pi * i/6 * u, -2));
+ endfor
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-addition-of-sines.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,53 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ numeric u; u = 1cm;
+ path xx; xx = (2 left -- 10 right) scaled u;
+ path yy; yy = (down -- 7 up) scaled u;
+
+ numeric theta, psi; psi = 28; theta = 50;
+ pair P, Q, H, N, M, T, L; P = (4, 3) scaled u;
+
+ path ell, tee, arc;
+ ell = (left--right) scaled 10u rotated theta shifted P cutbefore xx;
+ tee = (left--right) scaled 10u rotated psi shifted P cutbefore xx;
+ arc = subpath (1.6, 3.2) of halfcircle rotated -180 shifted 1/2 up
+ scaled 10u shifted P rotatedabout(P, psi);
+
+ Q = ell intersectionpoint subpath (1.5, 3) of arc;
+ H = P + whatever * dir psi;
+ xpart H = xpart Q = xpart M; ypart M = ypart N = 0;
+ xpart N = xpart P;
+ L = point 0 of ell;
+ T = point 0 of tee;
+
+ % now we can get with the drawing
+ draw arc withcolor 1/2 red;
+ draw P--N dashed withdots scaled 1/2;
+ draw Q--M dashed withdots scaled 1/2;
+ drawarrow xx; label.rt("$x$", point 1 of xx);
+ drawarrow yy; label.top("$y$", point 1 of yy);
+ drawoptions(withcolor 2/3 blue);
+ draw fullcircle scaled 32 shifted T cutafter tee;
+ draw fullcircle scaled 28 shifted L cutafter ell;
+ label("$\psi$", 24 right rotated 1/2 psi shifted T);
+ label("$\theta$", 20 right rotated 1/2 theta shifted L);
+ drawoptions();
+
+ % draw the lines trimmed neatly
+ path invisible_boundary;
+ z1 = point .95 of xx;
+ z2 = point .95 of yy;
+ invisible_boundary = z1--(x1,y2)--z2;
+ draw ell cutafter invisible_boundary;
+ draw tee cutafter invisible_boundary;
+
+ % and finally label the points.
+ forsuffixes @ = T, L, N, M: label.bot("$" & str @ & "$", @); endfor
+ forsuffixes @ = H, P, Q: dotlabel.lrt("$" & str @ & "$", @); endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-angles-lines.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-epi-v-pie.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-epi-v-pie.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-epi-v-pie.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,8 +6,7 @@
beginfig(1);
numeric minx, maxx, s, u, v;
-minx = 13/8; s = 1/16; maxx = 19/4;
-u = 89; v = 3072;
+minx = 13/8; s = 1/16; maxx = 19/4; u = 89; v = 3072;
def f(expr x) = 1/256 mlog(x) / x enddef;
@@ -22,11 +21,9 @@
numeric pi, e, fpi, fe;
pi = 3.141592653589793 u; fpi = f(3.141592653589793) * v;
e = 2.718281828459045 u; fe = f(2.718281828459045) * v;
-
path ee, pp;
ee = (e, ypart point 0 of xx) -- (e, fe) -- (xpart point 0 of yy, fe);
pp = (pi, ypart point 0 of xx) -- (pi, fpi) -- (xpart point 0 of yy, fpi);
-
draw ee dashed withdots scaled 1/4 withcolor 2/3 red;
draw pp dashed withdots scaled 1/2 withcolor 2/3 red;
draw ff withcolor 3/4 blue;
@@ -37,11 +34,11 @@
draw (down--up) scaled 2 shifted (x * u, ypart point 0 of xx);
label.bot("$" & decimal x & "$", (x * u, ypart point 0 of xx - 2));
endfor
-for y=31 upto 38:
- draw (left--right) scaled 2 shifted (xpart point 0 of yy, y/100*v);
+for y=.31, .32, .33, .34, .35, .36, .37, .38:
+ draw (left--right) scaled 2 shifted (xpart point 0 of yy, y*v);
endfor
-for y=32, 35, 38:
- label.lft("$" & decimal (y/100) & "$", (xpart point 0 of yy-2, y/100*v));
+for y=.32, .35, .38:
+ label.lft("$" & decimal y & "$", (xpart point 0 of yy-2, y*v));
endfor
drawoptions(withcolor 1/2 red);
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-epi-v-pie.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-exponential.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-exponential.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-exponential.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,46 +4,39 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
-numeric u; u = 42;
-
-path xx, yy;
-xx = (-3u, 0) -- (5u, 0);
-yy = xx rotated 90;
-
-path ee, ll, nn;
-numeric minx, maxx, s;
-minx = -3; maxx = 1/256 mlog(4.5); s = 1/4;
-ee = (for x = minx step s until maxx - s:
+ numeric u, minx, s, maxx;
+ u = 42; minx = -3; s = 1/4; maxx = 1/256 mlog(4.5);
+ path xx; xx = (-3u, 0) -- (5u, 0);
+ path yy; yy = xx rotated 90;
+ path ee, ll, nn;
+ ee = (for x = minx step s until maxx - s:
(x, mexp(256x)){1, mexp(256x)} ...
-endfor (maxx, mexp(256 maxx)){1, mexp(256 maxx)}) scaled u;
-ll = ee reflectedabout(origin, dir 45);
-nn = (for x=1 step s until 4-s: (x, 1/x) ... endfor (4, 1/4)) scaled u;
-nn := reverse nn reflectedabout(origin, dir 45) & nn;
-
-draw unitsquare xscaled mexp(256) scaled u withcolor 7/8;
-draw unitsquare yscaled mexp(256) scaled u withcolor 7/8;
-
-path T[];
-numeric p; p = directiontime dir 45 of ee;
-T1 = (precontrol p of ee -- postcontrol p of ee) shifted - point p of ee scaled 1/2 u shifted point p of ee;
-T2 = (precontrol p of ll -- postcontrol p of ll) shifted - point p of ll scaled 1/2 u shifted point p of ll;
-drawoptions(withpen pencircle scaled 1/4 withcolor 1/2);
-draw T1; draw T2; draw interpath(1/2, T1, T2) dashed evenly;
-drawoptions();
-
-draw nn; label.urt("$1/x$", point 0 of nn);
-draw ee withcolor 2/3 blue; label.top("$e^x$", point infinity of ee) withcolor 2/3 blue;
-draw ll withcolor 3/4 red; label.top("$\ln(x)$", point infinity of ll) withcolor 3/4 red;
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-
-dotlabel.lft("$e$", (0, mexp(256) * u));
-dotlabel.bot("$e$", (mexp(256) * u, 0));
-dotlabel.ulft("$1$", (0, u));
-dotlabel.lrt("$1$", (u, 0));
-
-
+ endfor (maxx, mexp(256 maxx)){1, mexp(256 maxx)}) scaled u;
+ ll = ee reflectedabout(origin, dir 45);
+ nn = (for x=1 step s until 4-s: (x, 1/x) ... endfor (4, 1/4)) scaled u;
+ nn := reverse nn reflectedabout(origin, dir 45) & nn;
+ drawoptions(withcolor 7/8);
+ draw unitsquare xscaled mexp(256) scaled u;
+ draw unitsquare yscaled mexp(256) scaled u;
+ drawoptions(withcolor 3/4);
+ forsuffixes $ = ee, ll:
+ path T$; T$ = (left--right) scaled 2u rotated 45
+ shifted directionpoint dir 45 of $;
+ draw T$;
+ endfor
+ draw interpath(1/2, T.ee, T.ll) dashed evenly;
+ drawoptions(withcolor 2/3 blue);
+ draw ee; label.top("$e^x$", point infinity of ee);
+ drawoptions(withcolor 2/3 red);
+ draw ll; label.top("$\ln(x)$", point infinity of ll);
+ drawoptions();
+ draw nn; label.urt("$1/x$", point 0 of nn);
+ drawarrow xx; label.rt("$x$", point 1 of xx);
+ drawarrow yy; label.top("$y$", point 1 of yy);
+ dotlabel.lft("$e$", (0, mexp(256) * u));
+ dotlabel.bot("$e$", (mexp(256) * u, 0));
+ dotlabel.ulft("$1$", (0, u));
+ dotlabel.lrt("$1$", (u, 0));
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-exponential.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-lemniscate.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-lemniscate.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-lemniscate.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,22 +4,20 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
-numeric a, c; c = 100; a = sqrt(2) * c;
-vardef f(expr x) = a * cosd(x) / (1 + sind(x) ** 2) enddef;
-vardef g(expr x) = f(x) * sind(x) enddef;
-numeric mint, maxt, s; mint = 0; s = 30; maxt = 360;
-path p;
-p = for t = mint step s until maxt - s:
+ numeric a, c; c = 100; a = sqrt(2) * c;
+ vardef f(expr x) = a * cosd(x) / (1 + sind(x) ** 2) enddef;
+ vardef g(expr x) = f(x) * sind(x) enddef;
+ numeric mint, maxt, s; mint = 0; s = 30; maxt = 360;
+ path p; p = for t = mint step s until maxt - s:
(f(t), g(t)) ...
-endfor cycle;
-draw p withcolor 3/4 blue;
-path xx, yy;
-xx = (left -- right) scaled 150;
-yy = (down -- up) scaled 55;
-drawarrow xx; label.rt("$x$", point 1 of xx);
-drawarrow yy; label.top("$y$", point 1 of yy);
-dotlabel.bot("$F_1$", c * left);
-dotlabel.bot("$F_2$", c * right);
+ endfor cycle;
+ draw p withcolor 3/4 blue;
+ path xx; xx = (left -- right) scaled 150;
+ path yy; yy = (down -- up) scaled 55;
+ drawarrow xx; label.rt("$x$", point 1 of xx);
+ drawarrow yy; label.top("$y$", point 1 of yy);
+ dotlabel.bot("$F_1$", c * left);
+ dotlabel.bot("$F_2$", c * right);
endfig;
\end{mplibcode}
\end{document}
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,51 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1); % Using \mplibtextextlabel{enable} ...
+ numeric u, m, m', b, b';
+ u = 1.44cm;
+ b = 3.6u; b' = b + 1/2 u;
+ m = -1; m' = 3/4 m;
+
+ path xx, yy;
+ xx = (left -- 5 right) scaled u;
+ yy = xx rotated 90;
+
+ numeric minx, maxx; path ff, gg;
+ minx = xpart point 1/16 of xx;
+ maxx = xpart point 15/16 of xx;
+ ff = (minx, minx * m + b) -- (maxx, maxx * m + b);
+ gg = (minx, minx * m' + b') -- (maxx, maxx * m' + b');
+
+ z0 = point 0.4 of ff;
+ z1 = point 0.54 of ff;
+ z1 0 = whatever [point 0 of gg, point 1 of gg]; x1 0 = x0;
+ z1 1 = whatever [point 0 of gg, point 1 of gg]; x1 1 = x1;
+
+ forsuffixes @=0, 1:
+ draw (x@, 0) -- z@ -- (0, y@) dashed evenly scaled 3/4;
+ draw z@ -- z1 @ -- (0, y1 @) dashed withdots scaled 1/2;
+ label.bot("$x_{" & decimal @ & "}$", (x@, 0));
+ label.lft("$y_{" & decimal @ & "}$", (0, y@));
+ label.lft("$y'_{" & decimal @ & "}$", (0, y1 @));
+ endfor
+
+ draw ff withcolor 2/3 red;
+ draw gg withcolor 3/4 blue;
+ drawarrow xx; drawarrow yy;
+
+ label.rt("$x$", point 1 of xx);
+ label.top("$y$", point 1 of yy);
+
+ dotlabel.urt("$b$", (0, b));
+ dotlabel.urt("$b'$", (0, b'));
+
+ draw thelabel("slope: $m=" & decimal m & "$", 7 up)
+ rotated angle (1, m) shifted point 2/3 of ff;
+ draw thelabel("slope: $m'=" & decimal m' & "$", 7 up)
+ rotated angle (1, m') shifted point 2/3 of gg;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-linear-graph.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-maurer-rose.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-maurer-rose.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-maurer-rose.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,28 +4,22 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
+ path r, k;
+ r = for t = 1 upto 360: cosd 2t * dir t .. endfor cycle;
+ r := r scaled 150;
+ k = for t = 1 upto 360: point 29t of r -- endfor cycle;
- numeric n; n = 2;
- path r; r = (for t=0 upto 360:
- cosd(n * t) * dir t ...
- endfor cycle) scaled 150;
+ draw k dashed withdots scaled 1/8
+ withpen pencircle scaled 1/4
+ withcolor 1/2[blue, white];
- numeric d; d = 29;
- path k; k = for t = 0 upto 360:
- point d * t mod 360 of r --
- endfor cycle;
-
- draw k dashed withdots scaled 1/8
- withpen pencircle scaled 1/4
- withcolor 1/2[blue, white];
- draw r withcolor 2/3 red;
+ draw r withcolor 2/3 red;
- path xx, yy;
- xx = (left -- right) scaled 160;
- yy = (down -- up) scaled 160;
- drawarrow xx; label.rt("$x$", point 1 of xx);
- drawarrow yy; label.top("$y$", point 1 of yy);
-
+ path xx, yy; % you might nor need the axes...
+ xx = (left -- right) scaled 160;
+ yy = (down -- up) scaled 160;
+ drawarrow xx; label.rt("$x$", point 1 of xx);
+ drawarrow yy; label.top("$y$", point 1 of yy);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-maurer-rose.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,25 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+numeric u, v; u = 40; v = 29; path xx, yy;
+xx = (3/2 left -- 5 right) scaled u;
+yy = (3/2 down -- 4 up) scaled v;
+for x=-1, 1, 2, 3, 4:
+ draw yy shifted (x * u, 0) withcolor 7/8; % grid
+ draw (down--up) shifted (x * u, 0); % ticks
+ label(TEX("$" & decimal x & "$"), (x * u, -8));
+endfor
+for y=-1, 1, 2, 3:
+ draw xx shifted (0, y * v) withcolor 7/8; % grid
+ draw (left--right) shifted (0, y * v); % ticks
+ label(TEX("$" & decimal y & "$"), (-10, y * v));
+endfor
+drawarrow xx; label.rt(TEX("$x$"), point 1 of xx);
+drawarrow yy; label.top(TEX("$y$"), point 1 of yy);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-numbered-axes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-parametric.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-parametric.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-parametric.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,20 +4,14 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
-path p;
-numeric a, b, j, k; a = 144; b = 89; j = 3; k = 2;
-p = for t = 0 upto 360:
- (a * cosd(j * t), b * sind(k * t)) ...
-endfor cycle;
-
-draw p withcolor 2/3 red;
-
path xx, yy;
xx = (left -- right) scaled 150;
yy = (down -- up) scaled 100;
drawarrow xx; label.rt("$x$", point 1 of xx);
drawarrow yy; label.top("$y$", point 1 of yy);
-
+path p;
+p = for t = 0 upto 360: (144 cosd(3t), 89 sind(2t)) ... endfor cycle;
+draw p withcolor 2/3 red;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-parametric.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,14 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+path xx, yy;
+xx = (left -- right) scaled 130;
+yy = (down -- up) scaled 80;
+drawarrow xx; label.rt(TEX("$x$"), point 1 of xx);
+drawarrow yy; label.top(TEX("$y$"), point 1 of yy);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-plain-axes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-pulse.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-pulse.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-pulse.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,33 +3,29 @@
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
-
+beginfig(1);
vardef pulse(expr w, h, d) =
-for i=0 upto 4: x[i] = w/4 * i; endfor
- y0 = y1 = 0;
- y3 = y4 = d;
- y2 = h;
- z0 .. 1/2[z0, z1] .. controls z1
- .. 1/2[z1, z2] .. controls z2
- .. 1/2[z2, z3] .. controls z3
- .. 1/2[z3, z4] .. z4
+ clearxy; % protect (x,y) values
+ x0 = 0; x1 = 1/4w; x2 = 1/2w; x3 = 3/4w; x4 = w;
+ y0 = 0; y1 = 0; y2 = h; y3 = d; y4 = d;
+ z0 .. 1/2[z0, z1] .. controls z1
+ .. 1/2[z1, z2] .. controls z2
+ .. 1/2[z2, z3] .. controls z3
+ .. 1/2[z3, z4] .. z4
enddef;
+path p; p = pulse(300, 100, -40); draw p withcolor 1/2 blue;
-beginfig(1);
- path p; p = pulse(300, 100, -40);
+picture pcon; pcon = image(
+ draw point 0 of p -- postcontrol 1 of p -- postcontrol 2 of p -- postcontrol 3 of p -- point 5 of p
+ dashed withdots scaled 1/2 withcolor 2/3 red;
+ for i=1 upto 3: draw postcontrol i of p withpen pencircle scaled 2 withcolor 2/3 red; endfor
+ label.lrt("$z_1$", postcontrol 1 of p) withcolor 2/3 red;
+ label.top("$z_2$", postcontrol 2 of p) withcolor 2/3 red;
+ label.llft("$z_3$", postcontrol 3 of p) withcolor 2/3 red;
+ draw p withcolor 1/2 blue;
+ for i=0 upto length p: draw point i of p withpen pencircle scaled 2; endfor
+); draw pcon shifted 120 down;
- draw point 0 of p -- postcontrol 1 of p -- postcontrol 2 of p -- postcontrol 3 of p -- point 5 of p
- dashed withdots scaled 1/2 withcolor 2/3 red;
- for i=1 upto 3: draw postcontrol i of p withpen pencircle scaled 2 withcolor 2/3 red; endfor
- label.lrt("$z_1$", postcontrol 1 of p) withcolor 2/3 red;
- label.top("$z_2$", postcontrol 2 of p) withcolor 2/3 red;
- label.llft("$z_3$", postcontrol 3 of p) withcolor 2/3 red;
-
- draw p withcolor 1/2 blue;
- draw p shifted 120 up withcolor 1/2 blue;
- for i=0 upto length p: draw point i of p withpen pencircle scaled 2; endfor
-
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-pulse.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-reflection.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-reflection.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-reflection.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -7,20 +7,22 @@
path xx, yy;
xx = (left -- right) scaled 150;
yy = (down -- up) scaled 150;
+for i=-6 upto 6:
+ draw xx shifted (0, 24i) withpen pencircle scaled 1/4 withcolor 7/8;
+ draw yy shifted (24i, 0) withpen pencircle scaled 1/4 withcolor 7/8;
+endfor
path ff, negative_ff;
+
ff = (1,1) for x = 3/2 step 1/2 until 6: ... (x, 1/x) endfor;
ff := reverse ff reflectedabout(origin, dir 45) & ff;
ff := ff scaled 24;
negative_ff = ff reflectedabout(origin, dir -45);
-for i=-6 upto 6:
- draw xx shifted (0, 24i) withpen pencircle scaled 1/4 withcolor 7/8;
- draw yy shifted (24i, 0) withpen pencircle scaled 1/4 withcolor 7/8;
-endfor
+draw ff withcolor 2/3 red;
+draw negative_ff withcolor 2/3 red;
forsuffixes @ = ff, negative_ff:
- draw @ withcolor 2/3 red;
for i=0 upto length @:
draw point i of @ withpen pencircle scaled 1;
endfor
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-sines.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-sines.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-sines.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,54 +4,49 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
vardef pi_quarters(expr n) =
- save s, f, q; string s, f; numeric q;
- s = if n < 0: "-" else: "" fi; q = abs(n);
- if q mod 4 = 0:
- f = if q > 4: decimal 1/4 q else: "" fi;
- elseif q mod 2 = 0:
- f = "\frac{" & decimal 1/2 q & "}{2}";
- else:
- f = "\frac{" & decimal q & "}{4}";
- fi
- "$\scriptstyle" & s & f & "\pi$"
+ save s, f, q; string s, f; numeric q;
+ s = if n < 0: "-" else: "" fi; q = abs(n);
+ if q mod 4 = 0: f = if q > 4: decimal 1/4 q else: "" fi;
+ elseif q mod 2 = 0: f = "\frac{" & decimal 1/2 q & "}{2}";
+ else: f = "\frac{" & decimal q & "}{4}";
+ fi TEX("$\scriptstyle" & s & f & "\pi$")
enddef;
beginfig(1);
- numeric u, pi; u = 50; pi = 3.141592653589793;
+ numeric u, pi; u = 50; pi = 3.141592653589793;
- path xx, yy;
- xx = (3.5 left -- 3.6 right) scaled u;
- yy = (1.1 down -- 1.2 up) scaled u;
-
- path ss;
- ss = origin for t=1 upto 360: -- (t, sind(t)) endfor;
- ss := ss shifted 360 left & ss;
- ss := ss xscaled (pi/180) scaled u;
+ path xx, yy;
+ xx = (3.5 left -- 3.6 right) scaled u;
+ yy = (1.1 down -- 1.2 up) scaled u;
- drawoptions(dashed withdots scaled 1/4);
- draw ((1/4 pi, 0) .. (1/4 pi, sind(45))) scaled u;
- draw ((1/2 pi, 0) .. (1/2 pi, sind(90))) scaled u;
- draw ((3/4 pi, 0) .. (3/4 pi, sind(135))) scaled u;
- drawoptions();
+ path ss;
+ ss = origin for t=1 upto 360: -- (t, sind(t)) endfor;
+ ss := ss shifted 360 left & ss;
+ ss := ss xscaled (pi/180) scaled u;
- draw ss cutbefore yy shifted point 0 of xx
- cutafter yy shifted point 1 of xx
- withcolor 3/4 blue;
- draw ss shifted (-1/2 pi * u ,0)
- cutbefore yy shifted point 0 of xx
- cutafter yy shifted point 1 of xx
- withcolor 2/3 red;
-
- drawarrow xx; label.rt("$t$", point 1 of xx);
- drawarrow yy; label.top("$u(t)$", point 1 of yy);
+ drawoptions(dashed withdots scaled 1/4);
+ draw ((1/4 pi, 0) .. (1/4 pi, sind(45))) scaled u;
+ draw ((1/2 pi, 0) .. (1/2 pi, sind(90))) scaled u;
+ draw ((3/4 pi, 0) .. (3/4 pi, sind(135))) scaled u;
+ drawoptions();
- for i=-4, -3, -2, -1, 1, 2, 3, 4:
- draw (down--up) scaled 2 shifted (pi * i/4 * u, 0);
- label.bot(pi_quarters(i), (pi * i/4 * u, -2));
- endfor
+ draw ss
+ cutbefore yy shifted point 0 of xx
+ cutafter yy shifted point 1 of xx
+ withcolor 3/4 blue;
+
+ draw ss shifted (-1/2 pi * u ,0)
+ cutbefore yy shifted point 0 of xx
+ cutafter yy shifted point 1 of xx
+ withcolor 2/3 red;
+ drawarrow xx; label.rt(TEX("$t$"), point 1 of xx);
+ drawarrow yy; label.top(TEX("$u(t)$"), point 1 of yy);
+ for i=-4, -3, -2, -1, 1, 2, 3, 4:
+ draw (down--up) scaled 2 shifted (pi * i/4 * u, 0);
+ label.bot(pi_quarters(i), (pi * i/4 * u, -2));
+ endfor
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-sines.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-stress.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-stress.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/func-stress.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,40 +4,39 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- z1 = 377 right; z2 = 233 up;
+ z1 = 377 right; z2 = 233 up;
+ path ff; ff = origin .. (72, 144){1,2} .. (84, 144) ..
+ (96, 144){1,1} .. (220, 220){right} .. (370, 160){2,-1.3};
- path ff;
- ff = origin .. (72, 144){1,2} .. (84, 144) .. (96, 144){1,1} .. (220, 220){right} .. (370, 160){2,-1.3};
+ for t=2, 4, 4.9:
+ draw point t of ff -- (xpart point t of ff, y2 + 6) d
+ ashed evenly scaled 1/2;
+ endfor
+ label.top("Strain hardening",
+ (1/2 (xpart point 2 of ff + xpart point 4 of ff), y2));
+ label.top("Necking",
+ (1/2 (xpart point 4 of ff + xpart point 4.9 of ff), y2));
- for t=2, 4, 4.9:
- draw point t of ff -- (xpart point t of ff, y2 + 6) dashed evenly scaled 1/2;
- endfor
- label.top("Strain hardening", (1/2 (xpart point 2 of ff + xpart point 4 of ff), y2));
- label.top("Necking", (1/2 (xpart point 4 of ff + xpart point 4.9 of ff), y2));
+ path rr;
+ rr = point 0.4 of ff -- (xpart point 0.8 of ff, ypart point 0.4 of ff) -- point 0.8 of ff;
+ draw rr; label.bot("Run", point 1/2 of rr); label.rt("Rise", point 3/2 of rr);
- path rr;
- rr = point 0.4 of ff -- (xpart point 0.8 of ff, ypart point 0.4 of ff) -- point 0.8 of ff;
- draw rr; label.bot("Run", point 1/2 of rr); label.rt("Rise", point 3/2 of rr);
+ vardef pin_label@#(expr p, a, b)=
+ draw a -- b cutbefore fullcircle scaled 8 shifted a withpen pencircle scaled 1/4 withcolor 1/2 white;
+ label@#(p, b);
+ enddef;
+ pin_label.lrt("Yield strength", point 1.2 of ff, point 2 of ff + (8, -18));
+ pin_label.bot("Ultimate strength", point 4 of ff, point 4 of ff + (4, -24));
+ pin_label.bot("Fracture", point 5 of ff, point 5 of ff + (-8, -18));
- vardef pin_label@#(expr p, a, b)=
- draw a -- b cutbefore fullcircle scaled 8 shifted a withpen pencircle scaled 1/4 withcolor 1/2 white;
- label@#(p, b);
- enddef;
+ draw ff withpen pencircle scaled 1 withcolor 2/3 blue;
+ clip currentpicture to unitsquare scaled 400; % clip thick pen at origin
- pin_label.lrt("Yield strength", point 1.2 of ff, point 2 of ff + (8, -18));
- pin_label.bot("Ultimate strength", point 4 of ff, point 4 of ff + (4, -24));
- pin_label.bot("Fracture", point 5 of ff, point 5 of ff + (-8, -18));
+ drawdblarrow z1 -- origin -- z2;
+ label.ulft("Strain, $\epsilon$", z1);
+ label.urt("Stress, $\sigma$", z2);
- draw ff withpen pencircle scaled 1 withcolor 2/3 blue;
- clip currentpicture to unitsquare scaled 400; % clip thick pen at origin
-
- drawdblarrow z1 -- origin -- z2;
- label.ulft("Strain, $\epsilon$", z1);
- label.urt("Stress, $\sigma$", z2);
-
- label("$\displaystyle\hbox{Young's modulus} = \hbox{Slope} = {\hbox{Rise}\over\hbox{Run}}$",
- 1/2 z1 shifted 36 up) withcolor 2/3 blue;
-
+ label("$\displaystyle\hbox{Young's modulus} = \hbox{Slope} = {\hbox{Rise}\over\hbox{Run}}$", 1/2 z1 shifted 36 up) withcolor 2/3 blue;
endfig;
\end{mplibcode}
\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gaussian.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gaussian.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gaussian.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,69 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-numeric _sqrtpp;
-_sqrtpp = 2.50662827463;
-
-vardef gauss(expr mu, sigma, x) =
- if abs(x - mu) < 4 sigma:
- mexp(-128 * (((x - mu) / sigma) ** 2)) / _sqrtpp / sigma
- else:
- 0
- fi
- enddef;
-
-vardef gauss_curve(expr mu, sigma, a, b, s) =
- (a, gauss(mu, sigma, a)) for x = a + s step s until b: .. (x, gauss(mu, sigma, x)) endfor
- enddef;
-
-vardef percent(expr n, N) =
- save p, s;
- numeric p;
- string s;
- p = 1 - n / N / N;
- s = decimal floor(1000 p);
- substring (0, length(s) - 1) of s & "." & substring (length(s)-1, infinity) of s & "\thinspace\%"
-enddef;
-
-path Z; Z = gauss_curve(0, 1, -4, 4, 1/8) xscaled 50 yscaled 220;
-path A, B;
-A = subpath (16,48) of Z -- (xpart point 48 of Z, 0) -- (xpart point 16 of Z, 0) -- cycle;
-B = subpath (24,40) of Z -- (xpart point 40 of Z, 0) -- (xpart point 24 of Z, 0) -- cycle;
-beginfig(1);
- draw Z withcolor Reds 8 5;
- numeric N, stack_height[]; N = 100;
- numeric plump, fat, gross; gross = plump = fat = 0;
- for i=1 upto N: for j = 1 upto N:
- numeric r, k;
- r = 50 normaldeviate;
- k = round(r);
- if known stack_height[k]:
- stack_height[k] := stack_height[k] + 1;
- else:
- stack_height[k] := 1;
- fi
- pair z; z = (r, uniformdeviate 1/4 + stack_height[k]);
- color shade; shade = Greens 8 8;
- if abs(r) > 50: plump := plump + 1; shade := Blues 8 8; fi
- if abs(r) > 100: fat := fat + 1; shade := Oranges 8 6 ; fi
- if abs(r) > 150: gross := gross + 1; shade := Reds 8 8; fi
- draw z withpen pencircle scaled 1/2 withcolor shade;
- undraw z withpen pencircle scaled 1/4;
- endfor endfor
- label("\textsc{Observed values}", (-180, 96));
- label("$abs(r) \le 1$: " & percent(plump, N), (-180, 80));
- label("$abs(r) \le 2$: " & percent(fat, N), (-180, 68));
- label("$abs(r) \le 3$: " & percent(gross, N), (-180, 56));
- draw (left--right) scaled 220;
- for i = -4 upto 4:
- draw (50i, 0) -- (50i, -5);
- label.bot("\hbox to 5pt{\hss$" & decimal i & "$}", (50i, -5));
- endfor
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gaussian.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,156 @@
+\documentclass[border=1mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef radical_axis(expr ca, cb) =
+ numeric t, d, ra, rb;
+ ra = abs(center ca - point 0 of ca);
+ rb = abs(center cb - point 0 of cb);
+ d = abs(center cb - center ca);
+ 2t = 1 + (ra+rb) / d * (ra-rb) / d;
+ (up -- down) scaled 89
+ rotated angle (center cb - center ca)
+ shifted t[center ca, center cb]
+enddef;
+
+vardef invert_point(expr P, o, r) =
+ save p, d; pair p; numeric d;
+ p = P - o; d = abs p;
+ if d > 0:
+ o + unitvector p scaled (r/d*r)
+ else:
+ errmessage("Inversion undefined at center.")
+ fi
+enddef;
+
+vardef pole(expr Line, Circle) =
+ save p, o, r; pair o, p; numeric r;
+ o = center Circle;
+ r = 1/2 abs (point 4 of Circle - point 0 of Circle);
+ p = whatever [point 1 of Line, point 0 of Line];
+ p - o = whatever * direction 0 of Line rotated 90;
+ invert_point(p, o, r)
+enddef;
+
+vardef polex(expr a, b, o, r) =
+ save p; pair p;
+ p = whatever [a, b];
+ p - o = whatever * (a-b) rotated 90;
+ invert_point(p, o, r)
+enddef;
+
+vardef three_point_circle(expr a,b,c) =
+ save m; pair m;
+ m = whatever [a,b] rotatedaround(.5[a,b],90)
+ = whatever [b,c] rotatedaround(.5[b,c],90);
+ fullcircle scaled 2 length(m-a) shifted m
+ enddef;
+
+vardef through(expr a, b, o) =
+ save d; numeric d; d = abs(a-b);
+ (1+o/d)[b, a] -- (1+o/d)[a, b]
+enddef;
+
+beginfig(1);
+ path c[]; numeric r[];
+ z1 = origin; r1 = 101;
+ z2 = 233 right rotated 4; r2 = 53;
+ z3 = 209 right rotated -42; r3 = 31;
+
+ forsuffixes $=1, 2, 3:
+ c$ = fullcircle scaled 2 r$ shifted z$;
+ endfor
+
+ pair ecs[], ics[];
+
+ for i=1 upto 3:
+ numeric j, k;
+ j = i mod 3 + 1;
+ k = 10i + j;
+ ics[k] = (r[i]/(r[i]+r[j]))[z[i], z[j]];
+ ecs[k] = (r[i]/(r[i]-r[j]))[z[i], z[j]];
+ endfor
+ path a[];
+ a1 = radical_axis(c1, c2);
+ a2 = radical_axis(c2, c3);
+ a3 = radical_axis(c3, c1);
+
+ z0 = whatever [point 0 of a1, point 1 of a1]
+ = whatever [point 0 of a2, point 1 of a2];
+
+ z11 = polex(ecs31, ecs12, z1, r1);
+ z21 = polex(ecs31, ecs12, z2, r2);
+ z31 = polex(ecs31, ecs12, z3, r3);
+
+ z12 = c1 intersectionpoint (z0 -- z11);
+ z22 = c2 intersectionpoint (z0 -- z21);
+ z32 = c3 intersectionpoint (z0 -- z31);
+
+ z13 = c1 intersectionpoint (z11 -- 8[z0,z11]);
+ z23 = c2 intersectionpoint (z21 -- 8[z0,z21]);
+ z33 = c3 intersectionpoint (z31 -- 8[z0,z31]);
+
+ z14 = whatever[ecs12, ecs31] = whatever[z1, z11];
+ z24 = whatever[ecs12, ecs31] = whatever[z2, z21];
+ z34 = whatever[ecs12, ecs31] = whatever[z3, z31];
+
+ drawoptions(withcolor 3/4[blue, white]);
+ draw c1; draw c2; draw c3;
+ drawoptions(withcolor 1/4[blue, white]);
+ label.urt(btex $C_1$ etex, point 1 of c1);
+ label.top(btex $C_2$ etex, point 2 of c2);
+ label.rt (btex $C_3$ etex, point 1/2 of c3);
+ draw ecs12 -- ecs31 -- ecs23;
+
+ drawoptions(withpen pencircle scaled 1/4 withcolor 3/4[2/3 blue, white]);
+ draw a1; draw a2; draw a3;
+ draw through(z1, z14, 6);
+ draw through(z2, z24, 6);
+ draw through(z3, z34, 6);
+
+ drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 white);
+ draw through(z0, z13, 6);
+ draw through(z0, z23, 6);
+ draw through(z0, z33, 6);
+
+ drawoptions(withcolor 1/256(203, 92, 13));
+ drawdot z0 withpen pencircle scaled 3/2 dotlabeldiam;
+ z99 = z0 shifted 24 dir -6;
+ label.rt("\vbox{\openup-4pt\halign{\hss #\hss\cr Radical\cr centre\cr}}", z99);
+ interim ahangle := 20; drawarrow z99 -- z0
+ cutafter fullcircle scaled 16 shifted z0
+ withpen pencircle scaled 1/3;
+
+ drawoptions(withcolor 1/256(239, 114, 21));
+ dotlabel.urt("\small Pole", z11);
+ dotlabel.ulft("\small Pole", z21);
+ dotlabel.urt("\small Pole", z31);
+
+ drawoptions(withcolor 2/3 red);
+ draw three_point_circle(z12, z22, z32);
+ draw three_point_circle(z13, z23, z33);
+ drawdot z12 withpen pencircle scaled 3/4 dotlabeldiam;
+ drawdot z22 withpen pencircle scaled 3/4 dotlabeldiam;
+ drawdot z32 withpen pencircle scaled 3/4 dotlabeldiam;
+ drawdot z13 withpen pencircle scaled 3/4 dotlabeldiam;
+ drawdot z23 withpen pencircle scaled 3/4 dotlabeldiam;
+ drawdot z33 withpen pencircle scaled 3/4 dotlabeldiam;
+
+ drawoptions(withcolor 1/2[blue, white]);
+ drawdot z1 withpen pencircle scaled dotlabeldiam;
+ drawdot z2 withpen pencircle scaled dotlabeldiam;
+ drawdot z3 withpen pencircle scaled dotlabeldiam;
+ drawdot z14 withpen pencircle scaled dotlabeldiam;
+ drawdot z24 withpen pencircle scaled dotlabeldiam;
+ drawdot z34 withpen pencircle scaled dotlabeldiam;
+ draw thelabel.top(btex Axis of similitude, as polar etex, origin)
+ rotated angle (ecs12 - ecs31)
+ shifted 3/4[ecs31, ecs12];
+
+ drawoptions();
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-apollonius.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,54 @@
+\RequirePackage{luatex85}
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef invert(expr P, C) = % invert path P or pair P in circle C
+ save I, r, s, T; pair I; I = center C; r = abs(point 0 of C-I);
+ if pair P: s = abs(P-I); I if s > eps: + (P-I) / s * r / s * r fi
+ elseif path P: T = length P; for t=0 upto T-1:
+ invert(point t of P, C) .. endfor
+ if cycle P: cycle else: invert(point T of P, C) fi
+ fi
+enddef;
+beginfig(1);
+ pair A,B,C; A = origin; C = 254 right; B = 7/8[A, C];
+ path c[];
+ c1 = fullcircle scaled 2 abs(A-C); % large circle for the inversions
+ c2 = fullcircle scaled abs(A-C) shifted 1/2[A,C];
+ c3 = fullcircle scaled abs(A-B) shifted 1/2[A,B];
+ c4 = fullcircle scaled abs(B-C) shifted 1/2[B,C];
+ c5 = invert(c4,c1);
+
+ drawoptions(withcolor 3/4 white);
+ draw c4; draw c5;
+ draw invert(subpath(-3/8, 3/2) of c2, c1); % vertical lines
+ draw invert(subpath(-3/8, 3/2) of c3, c1);
+
+ drawoptions(withcolor 1/2 red);
+ draw subpath(-1/4,7/8) of c1 withpen pencircle scaled 1/4;
+ label.lft("\textit{circle of inversion}", point 7/8 of c1);
+
+ numeric d; d = abs(point 0 of c5 - point 4 of c5); % diameter of c5
+ for i=1 upto 48:
+ path c, c'; c = c5 shifted (0, i*d); c' = invert(c, c1);
+ draw c' withpen pencircle scaled 1/4 withcolor 2/3 blue;
+ if i<5:
+ drawoptions(withcolor 3/4 white);
+ draw c; draw origin -- center c;
+ draw center c withpen pencircle scaled dotlabeldiam;
+ draw center c' withpen pencircle scaled dotlabeldiam;
+ drawoptions();
+ fi
+ endfor
+
+ drawoptions(withcolor 2/3 blue);
+ draw A--C;
+ draw subpath (0,4) of c2 withpen pencircle scaled 1/4;
+ draw subpath (0,4) of c3 withpen pencircle scaled 1/4;
+ draw subpath (0,4) of c4 withpen pencircle scaled 1/4;
+ dotlabel.lft("$A$", A); dotlabel.llft("$B$", B); dotlabel.rt("$C$", C);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-arbelos.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,113 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef straight_through(expr Prefix, Path, Suffix) =
+ reverse (left scaled Prefix rotated angle direction 0 of Path shifted point 0 of Path)
+ .. Path .. (right scaled Suffix rotated angle direction infinity of Path shifted point infinity of Path)
+enddef;
+
+vardef tangent_times(expr C, p) =
+ save m, a, b, G, H;
+ pair m; numeric a, b; path G, H;
+ m = 1/2[p, center C];
+ H = halfcircle scaled abs (p - center C)
+ rotated angle (p - center C) shifted m;
+ G = H rotatedabout(m, 180);
+ (a, whatever) = C intersectiontimes H;
+ (b, whatever) = C intersectiontimes G;
+ (a, b if b < a: + 8 fi)
+enddef;
+vardef arc_of_tangents(expr C, p) =
+ subpath tangent_times(C, p) of C
+enddef;
+
+beginfig(1);
+
+ path c[]; numeric r[];
+ z1 = origin; r1 = 101;
+ z2 = 233 right rotated 4; r2 = 53;
+ z3 = 209 right rotated -42; r3 = 31;
+
+ forsuffixes $=1, 2, 3:
+ c$ = fullcircle scaled 2 r$ shifted z$;
+ endfor
+
+ pair ecs[], ics[];
+
+ for i=1 upto 3:
+ numeric j, k;
+ j = i mod 3 + 1;
+ k = 10i + j;
+ ics[k] = (r[i]/(r[i]+r[j]))[z[i], z[j]];
+ ecs[k] = (r[i]/(r[i]-r[j]))[z[i], z[j]];
+ endfor
+
+ show unitvector(ecs31 - ics12) dotprod unitvector(ecs12 - ics31);
+
+ fill ecs12 -- arc_of_tangents(c1, ecs12) -- cycle withcolor 15/16[blue, white];
+ fill ics12 -- arc_of_tangents(c1, ics12) -- cycle withcolor 7/8 [blue, white];
+ fill ics12 -- arc_of_tangents(c2, ics12) -- cycle withcolor 7/8 [blue, white];
+
+ unfill c1; unfill c2; unfill c3;
+
+ drawoptions(withcolor 3/4[blue, white]);
+ draw c1 withpen pencircle scaled 1;
+ draw c2 withpen pencircle scaled 1;
+ draw c3 withpen pencircle scaled 1;
+
+ numeric t, u, v;
+ (t, whatever) = tangent_times(c1, ecs12);
+ (u, whatever) = tangent_times(c1, ics12);
+ (whatever, v) = tangent_times(c2, ics12);
+ draw point t of c1 -- z1 -- point u of c1 dashed evenly;
+ draw point t of c2 -- z2 -- point v of c2 dashed evenly;
+
+ drawoptions(withcolor 1/4[blue, white]);
+ drawdot z1 withpen pencircle scaled dotlabeldiam;
+ drawdot z2 withpen pencircle scaled dotlabeldiam;
+ drawdot z3 withpen pencircle scaled dotlabeldiam;
+ label(btex $C_1$ etex, z1 shifted 10 dir 254);
+ label(btex $C_2$ etex, z2 shifted 10 dir 299);
+ label(btex $C_3$ etex, z3 shifted 10 dir 6);
+ label.lft(btex $r_1$ etex, 1/2[z1, point t of c1]);
+ label.lft(btex $r_2$ etex, 1/2[z2, point t of c2]);
+
+ drawoptions();
+ draw ecs31 -- ics12 -- ecs23 -- ecs12 -- ics31 dashed withdots scaled 1/2;
+
+ drawoptions(withcolor 1/2 white);
+ draw straight_through(r1+24, z1 -- ecs12, 24);
+ draw straight_through(r1+24, z1 -- ecs31, 24);
+ draw straight_through(r2+24, z2 -- ecs23, 24);
+
+ drawoptions(withcolor 2/3 red);
+ drawdot ics12 withpen pencircle scaled dotlabeldiam;
+ drawdot ics23 withpen pencircle scaled dotlabeldiam;
+ drawdot ics31 withpen pencircle scaled dotlabeldiam;
+ label(btex $I_{12}$ etex, ics12 shifted 12 dir 100);
+ label(btex $I_{23}$ etex, ics23 shifted 12 dir 340);
+ label(btex $I_{31}$ etex, ics31 shifted 10 dir 200);
+
+ drawoptions(withcolor 5/8 blue);
+ drawdot ecs12 withpen pencircle scaled dotlabeldiam;
+ drawdot ecs23 withpen pencircle scaled dotlabeldiam;
+ drawdot ecs31 withpen pencircle scaled dotlabeldiam;
+ label(btex $E_{12}$ etex, ecs12 shifted 8 dir 100);
+ label(btex $E_{23}$ etex, ecs23 shifted 11 dir 345);
+ label(btex $E_{31}$ etex, ecs31 shifted 10 dir 277);
+
+ draw thelabel.top(btex Axis of Similitude etex, origin)
+ rotated angle (ecs12 - ecs31)
+ shifted 1/4[ecs31, ecs12];
+
+ label(btex $\displaystyle {C_1E_{12} \over C_2E_{12}} = {r_1 \over r_2}
+ = {C_1I_{12} \over C_2I_{12}}$ etex, (x1, y3));
+
+ label(btex \it \& cetera \dots etex, (x1, y3-28));
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-axis-of-similitude.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,33 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\mplibtextextlabel{enable}
+\begin{document}
+\vbox{\openup 1pt \halign to 4in{#\cr
+\begin{code}
+vardef euclidean_bisector(expr a,b,c,r) =
+ save arc,p,q,e;
+ path arc; pair p,q,e;
+ arc = fullcircle scaled r shifted b;
+ p = (a--b) intersectionpoint arc;
+ q = (b--c) intersectionpoint arc ;
+ e = equilateral_triangle_point(p,q);
+ e
+enddef;
+\end{code}
+\cr\kern 64pt
+\begin{mplibcode}
+input geometry-bisection
+beginfig(1);
+z0 = euclidean_bisector(A,B,C,100);
+draw B -- 1.2[B,z0] withcolor .67 red;
+draw A--B--C;
+dotlabel.top(btex $A$ etex, A);
+dotlabel.lft(btex $B$ etex, B);
+dotlabel.lrt(btex $C$ etex, C);
+dotlabel.lrt(btex $E$ etex, z0);
+undraw bbox currentpicture;
+endfig;
+\end{mplibcode}
+\cr}}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-euclidean.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,28 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\mplibtextextlabel{enable}
+\begin{document}
+\vbox{\openup 1pt \halign to 4in{#\cr
+\begin{code}
+vardef interior_bisector(expr a,b,c) =
+ (1/(1+abs(c-b)/abs(a-b)))[a,c]
+enddef;
+\end{code}
+\cr\kern 64pt
+\begin{mplibcode}
+input bisection
+beginfig(1);
+z0 = interior_bisector(A,B,C);
+draw A--B--C--cycle;
+draw B -- 1.2[B,z0] withcolor .67 red;
+dotlabel.top(btex $A$ etex, A);
+dotlabel.lft(btex $B$ etex, B);
+dotlabel.lrt(btex $C$ etex, C);
+draw z0 withpen pencircle scaled dotlabeldiam;
+label(btex $E$ etex, z0 + (3,9));
+undraw bbox currentpicture;
+endfig;
+\end{mplibcode}
+\cr}}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-interior.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,25 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\mplibtextextlabel{enable}
+\begin{document}
+\vbox{\openup 1pt \halign to 4in{#\cr
+\mpexternal[firstline=21,lastline=24]{geometry-bisection.mp}
+\cr\kern 64pt
+\begin{mplibcode}
+input geometry-bisection
+beginfig(1);
+z0 = vector_bisector(A,B,C,50);
+drawarrow B--A cutafter fullcircle scaled 5 shifted A;
+drawarrow B--C cutafter fullcircle scaled 5 shifted C;
+drawarrow B--z0 cutafter fullcircle scaled 5 shifted z0
+withcolor .67 red;
+dotlabel.top(btex $A$ etex, A);
+dotlabel.lft(btex $B$ etex, B);
+dotlabel.lrt(btex $C$ etex, C);
+dotlabel.lrt(btex $E$ etex, z0);
+undraw bbox currentpicture;
+endfig;
+\end{mplibcode}
+\cr}}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection-vector.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,33 @@
+vardef equilateral_triangle_point(expr a, b) =
+ b shifted -a rotated 60 shifted a
+enddef;
+
+vardef euclidean_bisector(expr a,b,c,r) =
+ save arc,p,q,e;
+ path arc; numeric p,q; pair e;
+ arc = fullcircle scaled r shifted b;
+ p = ypart ( (a--b) intersectiontimes arc );
+ q = ypart ( (b--c) intersectiontimes arc );
+ e = equilateral_triangle_point(point p of arc, point q of arc);
+ hide(
+ draw subpath(p-1/4,p+1/4) of arc withcolor .7[red,white];
+ draw subpath(q-1/4,q+1/4) of arc withcolor .7[red,white];
+ draw point p of arc -- point q of arc -- e -- cycle
+ withcolor .7[blue,white];
+ )
+ e
+enddef;
+
+vardef vector_bisector(expr a,b,c,r) =
+ b + unitvector (a-b) scaled r
+ + unitvector (c-b) scaled r
+enddef;
+
+vardef interior_bisector(expr a,b,c) =
+ (1/(1+abs(c-b)/abs(a-b)))[a,c]
+enddef;
+
+pair A,B,C;
+A = 120 right rotated 52;
+B = origin;
+C = 144 right rotated -4;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-bisection.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,59 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef through(expr a, b, o) =
+ save t; numeric t; t = 1+o/abs(a-b);
+ t[b,a] -- t[a,b]
+enddef;
+
+vardef circumcircle(expr T) =
+ save m; pair m;
+ m = whatever * (point 0 of T - point 1 of T) rotated 90 shifted point 1/2 of T
+ = whatever * (point 1 of T - point 2 of T) rotated 90 shifted point 3/2 of T;
+ fullcircle scaled 2 abs (point 0 of T - m) shifted m
+enddef;
+
+beginfig(1);
+ path T; T = origin -- 377 dir 10 -- 233 dir 70 -- cycle;
+ pair m;
+ m = whatever * (point 0 of T - point 1 of T) rotated 90 shifted point 1/2 of T
+ = whatever * (point 2 of T - point 3 of T) rotated 90 shifted point 5/2 of T;
+
+ drawoptions(withcolor 3/4);
+ draw unitsquare scaled 5 rotated angle (point 1 of T-point 0 of T) shifted point 1/2 of T;
+ draw unitsquare scaled 5 rotated angle (point 2 of T-point 1 of T) shifted point 3/2 of T;
+ draw unitsquare scaled 5 rotated angle (point 0 of T-point 2 of T) shifted point 5/2 of T;
+ drawoptions(dashed evenly scaled 1/4 withcolor 1/2);
+ draw through(point 1/2 of T, m, 10);
+ draw through(point 3/2 of T, m, 10);
+ draw through(point 5/2 of T, m, 10);
+ drawoptions();
+ draw circumcircle(T) withcolor 2/3 red;
+ draw T;
+
+ draw m withpen pencircle scaled dotlabeldiam; label("$m$", m + 10 dir 12);
+
+ vardef mark_equal(expr a, b, n) =
+ save m, s; picture m; m = image(
+ numeric s; 2s = n - 1; for t=-s upto s:
+ draw (down--up) scaled 2 rotated -13 shifted (t,0)
+ withpen pencircle scaled 1/4;
+ endfor
+ );
+ draw m rotated angle (b-a) shifted 1/4[a,b];
+ draw m rotated angle (b-a) shifted 3/4[a,b];
+ enddef;
+
+ mark_equal(point 0 of T, point 1 of T, 1);
+ mark_equal(point 1 of T, point 2 of T, 2);
+ mark_equal(point 2 of T, point 0 of T, 3);
+
+ numeric wd; wd = xpart (urcorner currentpicture - llcorner currentpicture);
+ currentpicture := currentpicture scaled (303/wd);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-circumcircle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,64 @@
+\documentclass[border=0mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+color TR, TB, TG;
+TB = (.2,.2,.7);
+TR = (0.54,0,0);
+TG = (0, 0.44, 0);
+
+path xx, yy;
+xx = (left--right) scaled 144;
+yy = (down--up) scaled 89;
+
+ahangle := 30;
+picture P[];
+P0 = image(drawarrow xx withcolor 1/2; drawarrow yy withcolor 1/2);
+P1 = image(draw P0;
+ path c, a;
+ c = fullcircle scaled 4cm shifted (34, 21);
+ a = point 1 of c -- center c;
+ draw c withcolor TR;
+ draw fullcircle scaled 3 shifted (34,21); label.lrt("$(34,21)$", (34,21));
+ drawdblarrow a; label.ulft("2 cm", point 1/2 of a);
+);
+
+vardef circle_through(expr A, B, C) =
+ save o; pair o;
+ o = whatever * (A-B) rotated 90 shifted 1/2[A,B]
+ = whatever * (B-C) rotated 90 shifted 1/2[B,C];
+ fullcircle scaled 2 abs (A-o) shifted o
+enddef;
+
+P2 = image(draw P0;
+ pair A, B, C;
+ A = (-21, -13);
+ B = (58, 21);
+ C = (89, -34);
+
+ path c[];
+ c1 = fullcircle scaled 2 abs(A-B) shifted A;
+ c2 = fullcircle scaled abs(A-B) shifted 1/2[A, B];
+ c3 = circle_through(A, B, C);
+
+ draw c1 withcolor TR; label.ulft("I", point 3 of c1) withcolor TR;
+
+ draw A -- B dashed withdots scaled 1/4 withpen pencircle scaled 1/4 withcolor TB;
+ draw c2 withcolor TB; label.ulft("II", point 3 of c2) withcolor TB;
+ draw fullcircle scaled 2 shifted 1/2[A, B] withcolor TB;
+
+ draw c3 withcolor TG; label.urt("III", point 1 of c3) withcolor TG;
+
+ dotlabel.llft("$A$", A);
+ dotlabel.urt("$B$", B);
+ dotlabel.lrt("$C$", C);
+);
+
+beginfig(1);
+labeloffset := 10;
+label.top(P1, origin);
+label.bot(P2, origin);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-drawing-circles.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,55 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ pair P, A, B, C, A', B', C', R, S, T;
+ P = 200 dir 102;
+ A = 100 dir 159; B = origin; C = 90 dir 42;
+
+ A' = 3/8[P, A]; % the factors should not
+ B' = 1/2[P, B]; % be the same!
+ C' = 5/8[P, C];
+
+ R = whatever [A, B] = whatever [A', B'];
+ S = whatever [B, C] = whatever [B', C'];
+ T = whatever [C, A] = whatever [C', A'];
+
+ path t[];
+ t1 = A -- B -- C -- cycle;
+ t2 = A' -- B' -- C' -- cycle;
+ fill t1 withcolor 7/8[red, white];
+ fill t2 withcolor 7/8[blue, white];
+ draw t1 withcolor 1/2 white;
+ draw t2 withcolor 1/2 white;
+
+ drawoptions(dashed withdots scaled 1/2);
+ draw P--A;
+ draw P--B;
+ draw P--C;
+
+ drawoptions(dashed evenly scaled 1/2);
+ draw B--R--B';
+ draw C--S--C';
+ undraw subpath (1/4, 3/4) of (C'--T) withpen
+ pencircle scaled 5;
+ draw C--T--C';
+
+ drawoptions(withcolor 2/3 red);
+ draw 9/8[S,R] -- 9/8[R,S];
+ draw thelabel.bot("perspectrix", origin)
+ rotated angle (T-R) shifted 1/2[T, R];
+ dotlabel.urt("perspector", P);
+ drawoptions();
+
+ dotlabel.lft ("$A$ ", A);
+ dotlabel.llft("$B$ ", B);
+ dotlabel.lrt ("$C$ ", C);
+ dotlabel.lft ("$A'$ ", A');
+ dotlabel.llft("$B'$ ", B');
+ dotlabel.bot ("$C'$ ", C');
+ label.rt("\textsc{Desargues' Theorem}", 1/2[P, C'] shifted 10 right);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-desargues.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,40 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+def equilateral_triangle_point(expr a, b) =
+ a rotatedabout(b, 60)
+enddef;
+primarydef o beyond z = z scaled (1+o/abs(z)) enddef;
+beginfig(1);
+ randomseed := 543.01811;
+
+ pair A, B, C, D, E, F, G, H, I;
+ A = 91 dir ( 0 + 18 normaldeviate);
+ B = 92 dir (120 + 18 normaldeviate);
+ C = 93 dir (240 + 18 normaldeviate);
+
+ D = equilateral_triangle_point(A, B);
+ E = equilateral_triangle_point(B, C);
+ F = equilateral_triangle_point(C, A);
+
+ G = 1/3(A + B + D);
+ H = 1/3(B + C + E);
+ I = 1/3(C + A + F);
+
+ draw A -- B -- C -- cycle withcolor blue;
+ draw A -- D -- B -- E -- C -- F -- cycle withcolor 3/4;
+ draw G -- H -- I -- cycle withcolor 2/3 red;
+
+ forsuffixes @ = A, B, C, D, E, F, G, H, I:
+ draw @ withpen pencircle scaled dotlabeldiam;
+ label("$" & str @ & "$", 10 beyond @);
+ endfor
+
+ label.bot("\textsc{Napoleon's Theorem}",
+ point 1/2 of bbox currentpicture);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-napoleon.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,43 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+% define the end points of the three rays
+z1 = right scaled 200 rotated 10;
+z2 = right scaled 100 rotated 135;
+z3 = right scaled 225 rotated -17.5;
+% define the other points, relative to Q
+pair A, B, P, Q, R;
+Q = 0.8125 z3;
+A = whatever[origin, z1]; A-Q = whatever * z1 rotated 90;
+P = whatever[origin, z2]; P-Q = whatever * z2 rotated 90;
+B = whatever[origin, z1]; B-P = whatever * z1 rotated 90;
+R = whatever[A,Q]; R-P = whatever * (B-P) rotated 90;
+% mark the angles
+drawoptions(withcolor .67 blue);
+path c; c = fullcircle scaled 30;
+draw c rotated angle (Q-P) shifted P cutafter (P--B);
+draw c rotated angle (P-Q) shifted Q cutafter (Q--R);
+draw c rotated angle P cutafter (origin--z1);
+drawoptions();
+% draw the rays and A--Q
+drawarrow origin -- z1; label(btex $r_1$ etex, z1 scaled 1.05);
+drawarrow origin -- z2; label(btex $r_2$ etex, z2 scaled 1.08);
+drawarrow origin -- z3; label(btex $r_3$ etex, z3 scaled 1.05);
+draw A--Q;
+% draw the dashed lines
+drawoptions(dashed evenly);
+draw B--P--R--Q--P; drawarrow origin -- P scaled 4/3;
+drawoptions();
+% label the points
+dotlabel.urt(btex $Q$ etex, Q);
+dotlabel.top(btex $A$ etex, A);
+dotlabel.lrt(btex $R$ etex, R) withcolor .67 blue;
+dotlabel.top (btex $B$ etex, B);
+dotlabel.llft(btex $P$ etex, P);
+dotlabel.llft(btex $O$ etex, origin);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-projections.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,42 @@
+\documentclass[border=0mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+randomseed := 2485.81543;
+vardef measured_angle(expr p, o, q) =
+ (angle (p-o) - angle (q-o)) mod 360
+enddef;
+beginfig(1);
+picture T;
+for i=0 upto 1:
+ for j=0 upto 1:
+ clearxy;
+ T := image(
+ z1 = (120 + uniformdeviate 21, 0);
+ z2 = (120 + uniformdeviate 21, 0) rotated 120 rotated 21 normaldeviate;
+ z3 = (120 + uniformdeviate 21, 0) rotated 240 rotated 21 normaldeviate;
+ numeric a, b, c;
+ a = measured_angle(z3, z1, z2);
+ b = measured_angle(z1, z2, z3);
+ c = measured_angle(z2, z3, z1);
+ z4 = whatever [z1, z2 rotatedabout(z1, 1/3 a)]
+ = whatever [z2, z3 rotatedabout(z2, 2/3 b)];
+ z5 = whatever [z2, z3 rotatedabout(z2, 1/3 b)]
+ = whatever [z3, z1 rotatedabout(z3, 2/3 c)];
+ z6 = whatever [z3, z1 rotatedabout(z3, 1/3 c)]
+ = whatever [z1, z2 rotatedabout(z1, 2/3 a)];
+ fill z4--z5--z6--cycle withcolor 3/4[red + 1/2 green, white];
+ draw z4--z5--z6--cycle;
+ draw z1 -- z4 -- z2 -- z5 -- z3 -- z6 -- cycle
+ dashed withdots scaled 1/4;
+ draw z1 -- z2 -- z3 -- cycle;
+ );
+ draw T shifted (200i, 240j);
+ endfor
+endfor
+label.rt(btex \vbox{\halign{#\hfil\cr The trisectors of each angle\cr
+in any given triangle form a\cr central equilateral triangle.\cr}} etex, (24, 128));
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-examples-trisections.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,50 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef through(expr a, b, o) =
+ save t; numeric t; t = 1+o/abs(a-b);
+ t[b,a] -- t[a,b]
+enddef;
+
+vardef excircle(expr A, B, C) =
+ save a, b, m, t; pair a, b, m, t;
+ a = A + unitvector (C-A) - unitvector (B-A);
+ b = B + unitvector (A-B) + unitvector (C-B);
+ m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
+ t-m = whatever * (B-A) rotated 90;
+ fullcircle scaled 2 abs (t-m) shifted m
+enddef;
+
+beginfig(1);
+ pair A, B, C;
+ A = origin; B = 233 dir 10; C = 144 dir 70;
+ pair a, b, m, t;
+ a = A + 22 unitvector (C-A) - 22 unitvector (B-A);
+ b = B + 22 unitvector (A-B) + 22 unitvector (C-B);
+ m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
+ t-m = whatever * (B-A) rotated 90;
+
+ drawoptions(dashed evenly scaled 1/4 withcolor 1/2 white);
+ draw t -- m;
+ draw unitsquare scaled 5 rotated angle (B-A) shifted t;
+ draw through(A, m, 10);
+ draw through(A, t, 10);
+ draw through(B, m, 10);
+ drawoptions();
+ draw excircle(A, B, C) withcolor 2/3 blue;
+ draw A--B--C--cycle;
+ dotlabel.urt(btex $m$ etex, m);
+ dotlabel.bot(btex $t$ etex, t);
+ dotlabel.bot(btex $A$ etex, A);
+ dotlabel.urt(btex $B$ etex, B);
+ dotlabel.top(btex $C$ etex, C);
+ dotlabel.urt(btex $a$ etex, a);
+ dotlabel.top(btex $b$ etex, b);
+ numeric wd; wd = xpart (urcorner currentpicture - llcorner currentpicture);
+ currentpicture := currentpicture scaled (333/wd);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-excircle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,50 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef through(expr a, b, o) =
+ save t; numeric t; t = 1+o/abs(a-b);
+ t[b,a] -- t[a,b]
+enddef;
+
+vardef incircle(expr A, B, C) =
+ save a, b, m, t; pair a, b, m, t;
+ a = A + unitvector (C-A) + unitvector (B-A);
+ b = B + unitvector (A-B) + unitvector (C-B);
+ m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
+ t-m = whatever * (B-A) rotated 90;
+ fullcircle scaled 2 abs (t-m) shifted m
+enddef;
+
+beginfig(1);
+ pair A, B, C;
+ A = origin; B = 377 dir 10; C = 233 dir 70;
+ pair a, b, m, t;
+ a = A + 22 unitvector (C-A) + 22 unitvector (B-A);
+ b = B + 22 unitvector (A-B) + 22 unitvector (C-B);
+ m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
+ t-m = whatever * (B-A) rotated 90;
+
+ drawoptions(dashed evenly scaled 1/4 withcolor 1/2 white);
+ draw t -- m;
+ draw unitsquare scaled 5 rotated angle (B-A) shifted t;
+ draw through(A, m, 10);
+ draw through(B, m, 10);
+ drawoptions();
+ draw incircle(A, B, C) withcolor 2/3 red;
+ draw A--B--C--cycle;
+ dotlabel.top(btex $m$\thinspace\strut etex, m);
+ dotlabel.bot(btex $t$ etex, t);
+ dotlabel.bot(btex $A$ etex, A);
+ dotlabel.urt(btex $B$ etex, B);
+ dotlabel.top(btex $C$ etex, C);
+ dotlabel.top(btex $a$ etex, a);
+ dotlabel.top(btex $b$ etex, b);
+
+ numeric wd; wd = xpart (urcorner currentpicture - llcorner currentpicture);
+ currentpicture := currentpicture scaled (333/wd);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-incircle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,44 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+label(btex \vbox{\halign{\hfil\itshape # \hfil\cr
+The paths are drawn with\cr
+arrows to show where\cr
+they start \& stop.\cr}} etex, origin);
+
+ahangle := 30;
+path A, B;
+A = fullcircle scaled 200 shifted 40 left;
+B = fullcircle scaled 200 rotated 144 shifted 40 right;
+
+forsuffixes $=A, B:
+ drawarrow $ cutafter fullcircle scaled 6 shifted point 0 of $;
+ for t=0 upto 7:
+ drawdot point t of $ withpen pencircle scaled 2;
+ endfor
+endfor
+
+label.ulft("$A$", point 3.14 of A);
+label.urt("$B$", point 6.28 of B);
+
+drawoptions(withcolor 0.54 red);
+numeric t, u; (t,u) = A intersectiontimes B;
+draw fullcircle scaled 6 shifted point t of A;
+z0 = point t of A shifted (-3, 16);
+draw z0 -- point t of A cutafter fullcircle scaled 8 shifted point t of A;
+label.top("\texttt{A intersectiontimes B}", z0);
+drawoptions(withcolor (.2, .2, .7));
+numeric t, u; (t,u) = B intersectiontimes A;
+draw fullcircle scaled 6 shifted point t of B;
+z1 = point t of B shifted (-3, -16);
+draw z1 -- point t of B cutafter fullcircle scaled 8 shifted point t of B;
+label.bot("\texttt{B intersectiontimes A}", z1);
+drawoptions();
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-AB-or-BA.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,93 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+color tr, tb; tr = 0.54 red; tb = (0.2, 0.2, 0.7);
+ahangle := 30;
+path A, B;
+A = subpath (1, 2) of fullcircle scaled 240 shifted 48 left;
+B = subpath (7, 8) of fullcircle scaled 240 rotated 144 shifted 48 right;
+
+picture P[];
+P1 = image(
+ drawarrow A; label.rt("$A$", point 0 of A);
+ drawarrow B; label.rt("$B$", point 0 of B);
+);
+vardef boxed(expr p) =
+ save d; pair d; d = point infinity of p - point 0 of p;
+ unitsquare xscaled xpart d yscaled ypart d shifted point 0 of p
+enddef;
+
+P2 = image(
+ draw A withcolor 3/4;
+ draw B withcolor 3/4;
+ draw boxed(A) withcolor tr;
+ draw boxed(B) withcolor tb;
+);
+
+P3 = image(
+ draw A withcolor 3/4;
+ draw B withcolor 3/4;
+ path s[];
+ numeric m; m = arctime 1/2 arclength A of A;
+ s1 = boxed(subpath (0, m) of A);
+ s3 = boxed(subpath (m, infinity) of A);
+ numeric m; m = arctime 1/2 arclength B of B;
+ s2 = boxed(subpath (0, m) of B);
+ s4 = boxed(subpath (m, infinity) of B);
+ draw s3 withcolor 7/8;
+ draw s4 withcolor 7/8;
+ draw s2 withcolor tb;
+ draw s1 withcolor tr;
+ label.urt("$\scriptstyle 1$", point 1 of s1);
+ label.ulft("$\scriptstyle 2$", point 0 of s2);
+ label.urt("$\scriptstyle 3$", point 1 of s3);
+ label.ulft("$\scriptstyle 4$", point 3 of s4);
+);
+
+draw P1;
+draw P2 shifted 120 right;
+draw P3 shifted 240 right;
+
+P4 = image(
+ draw A withcolor 3/4;
+ draw B withcolor 3/4;
+ numeric m[];
+ m1 = arctime 1/4 arclength A of A;
+ m2 = arctime 1/2 arclength A of A;
+ draw boxed(subpath (0, m1) of A) withcolor 7/8;
+ draw boxed(subpath (m1, m2) of A) withcolor tr;
+ numeric m[];
+ m1 = arctime 1/4 arclength B of B;
+ m2 = arctime 1/2 arclength B of B;
+ draw boxed(subpath (0, m1) of B) withcolor 7/8;
+ draw boxed(subpath (m1, m2) of B) withcolor tb;
+);
+P5 = image(
+ draw A withcolor 3/4;
+ draw B withcolor 3/4;
+ numeric m[];
+ m1 = arctime 1/4 arclength A of A;
+ m2 = arctime 3/8 arclength A of A;
+ m3 = arctime 1/2 arclength A of A;
+ draw boxed(subpath (m1, m2) of A) withcolor 7/8;
+ draw boxed(subpath (m2, m3) of A) withcolor tr;
+ numeric m[];
+ m1 = arctime 1/4 arclength B of B;
+ m2 = arctime 3/8 arclength B of B;
+ m3 = arctime 1/2 arclength B of B;
+ draw boxed(subpath (m2, m3) of B) withcolor 7/8;
+ draw boxed(subpath (m1, m2) of B) withcolor tb;
+);
+
+draw P4 shifted 89 down;
+draw P5 shifted 89 down shifted 120 right;
+interim bboxmargin := 0;
+label.top("and so on\dots", center bbox P5 shifted 89 down shifted 240 right);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-algorithm.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,28 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path A, B;
+A = (origin {dir 42} .. 120 right {dir 42}) rotated 6;
+B = A reflectedabout (left, right) shifted 10 up;
+drawarrow A; label.llft("$A$", point 0 of A);
+drawarrow B; label.ulft("$B$", point 0 of B);
+
+pair P[]; numeric n; n=0;
+path R; R := A; %take a copy of A
+forever:
+ R := R cutbefore B; % snip where we cross B
+ exitif length cuttings = 0; % stop if nothing was cut
+ P[incr n] = point 0 of R; % capture the point
+ R := subpath (epsilon, infinity) of R; % nudge along
+endfor
+
+draw fullcircle scaled 4 shifted P1 withcolor .54 red;
+draw fullcircle scaled 4 shifted P2 withcolor .54 red;
+draw fullcircle scaled 4 shifted P3 withcolor .54 red;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-all-three.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,21 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path A, B;
+A = (origin {dir 42} .. 120 right {dir 42}) rotated 6;
+B = A reflectedabout (left, right) shifted 10 up;
+drawarrow A; label.llft("$A$", point 0 of A);
+drawarrow B; label.ulft("$B$", point 0 of B);
+draw fullcircle scaled 4
+ shifted (A intersectionpoint B)
+ withcolor .54 red;
+draw fullcircle scaled 4
+ shifted (reverse A intersectionpoint B)
+ withcolor (.2, .2, .7);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-intersection-only-two.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,40 @@
+\documentclass[border=2mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+beginfig(1);
+z1 = (10,10);
+z4 = 144 right rotated 12;
+z5 = z4 shifted (2, 78);
+z7 = z4 reflectedabout(origin, (1,1));
+
+z2 = 1/2 [z5, z7];
+z9 = whatever [z1, z4];
+z2-z9 = whatever * (z7-z1);
+z8 = whatever [z1, z5] = whatever [z2, z4];
+z3 = whatever [z2, z9] = whatever [z4, z7];
+z6 = whatever [z1, z7] = whatever [z3, z5];
+
+drawoptions(dashed withdots scaled 1/4 withcolor Blues 7 7);
+draw z1 -- z4 -- z7 -- z1 -- z5 -- z6;
+draw z4 -- z2 -- z9;
+draw z5 -- z7;
+drawoptions();
+
+for i=1 upto 9:
+ fill fullcircle scaled 12 shifted z[i] withcolor Blues 7 2;
+ draw fullcircle scaled 12 shifted z[i] withcolor Blues 7 7;
+ label("\textsf{" & decimal i & "}", z[i]);
+endfor
+
+for i=1 upto 2:
+ draw (50i, 0) -- (50i, 150) dashed withdots scaled 1/4 withcolor Reds 7 7;
+ draw (0, 50i) -- (150, 50i) dashed withdots scaled 1/4 withcolor Reds 7 7;
+endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-magic-square-14.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,27 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+pair a,b;
+a = 42 up; b = 72 right;
+beginfig(1);
+
+draw (-1/4)[origin,b]--5/4[origin,b] withcolor .8 white;
+draw (-1/4)[origin,a]--5/4[origin,a] withcolor .8 white;
+
+draw (-1)[a,b]--a dashed evenly;
+draw a--b withcolor .67 red;
+draw b--2[a,b] dashed evenly;
+
+dotlabel.urt(btex $a$ etex, a);
+dotlabel.urt(btex $b$ etex, b);
+dotlabel.urt(btex ${1\over2}[a,b]$ etex, 1/2[a,b]);
+dotlabel.urt(btex $\left(-{1\over2}\right)[a,b]$ etex, (-1/2)[a,b]);
+dotlabel.llft(btex $-{1\over2}[a,b]$ etex, -1/2[a,b]);
+label(btex Probably not what was intended\dots etex, -1/2[a,b] shifted (0,-24)) withcolor .58 blue;
+dotlabel.urt(btex ${3\over2}[a,b]$ etex, (3/2)[a,b]);
+dotlabel.lrt(btex $(0,0)$ etex, origin);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-pitfall.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,44 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(3);
+path t; t = (0,0) -- (220,42) -- (180,-90) -- cycle;
+pair centroid;
+centroid = 2/3[point 0 of t,point 3/2 of t];
+
+path s[];
+for i=0 upto 5:
+ s[i] = point 1/2 i of t -- point 1/2 + 1/2 i of t -- centroid -- cycle;
+endfor
+
+color c[];
+c[0] = (1,0.96863,0.73725);
+c[1] = (0.99608,0.76863,0.3098);
+c[2] = (0.85098,0.37255,0.054902);
+
+picture a,b;
+a = image(
+for i=0 upto 2:
+ fill s[2i] withcolor .6[c[i],white];
+ fill s[2i+1] withcolor .4[c[i],white];
+endfor
+for i=0 upto 2:
+draw point i of t -- point 3/2+i of t;
+endfor
+draw t;);
+b = image(
+for i=0 upto 2:
+ fill s[2i] withcolor .6[c[i],white];
+ fill s[2i+1] rotatedabout(point i+1/2 of t, 180) withcolor .4[c[i],white];
+endfor
+for i=0 upto 2:
+ draw point i of t -- centroid -- centroid rotatedabout(point i+1/2 of t,180) -- cycle;
+endfor
+draw t;);
+draw a;
+draw b shifted 222 right;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-sallows.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,29 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+pair a,b;
+a = 42 up; b = 72 right;
+path t,s,p,c;
+t = origin--a--b--cycle;
+s = unitsquare scaled 40 shifted 92 right;
+p = (for i=0 upto 4: down scaled 21 rotated 72i -- endfor cycle)
+ shifted 180 right shifted 21 up;
+c = fullcircle scaled 42 shifted 250 right shifted 21 up;
+
+beginfig(2);
+forsuffixes $=t,s,p,c:
+ draw $;
+ draw point 0 of $ -- point 1/2 length $ of $
+ dashed withdots scaled 1/3
+ withcolor .67 red;
+endfor
+label.bot("\textsl{Dotted lines drawn with}: \mpl{point 0 of p -- point 1/2 length p of p}",
+ point 1/2 of bbox currentpicture);
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-mediation-shapes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,54 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ pair A, B, C, D, N, M, p, q, r;
+ A = origin; B = 343 dir 10; C = 212 dir 70;
+ % pedal points (not labelled)
+ p = whatever[B, C]; A - p = whatever * (B-C) rotated 90;
+ q = whatever[C, A]; B - q = whatever * (C-A) rotated 90;
+ r = whatever[A, B]; C - r = whatever * (A-B) rotated 90;
+
+ D = whatever[A, p] = whatever[B, q];
+ N = 1/4(A + B + C + D); % remarkably...
+ M = D rotatedabout(N, 180); % M is also the circumcentre
+
+ path circumcircle, nine_point_circle;
+ nine_point_circle = fullcircle scaled 2 abs(N - 1/2[A, B]) shifted N;
+ circumcircle = fullcircle scaled 2 abs(M - A) shifted M;
+
+ draw nine_point_circle withcolor 3/4 red;
+ draw circumcircle withcolor 1/2[3/4 blue, white];
+
+ drawoptions(dashed evenly scaled 1/4 withcolor 1/2);
+ draw 1/2[A,B] -- M -- 1/2[B, C];
+ draw 1/2[C,A] -- M -- D;
+ draw A -- p;
+ draw B -- q;
+ draw C -- r;
+
+ % mark the nine points with small circles
+ drawoptions(withpen pencircle scaled 1/4);
+ draw fullcircle scaled 2 shifted 1/2[A, B];
+ draw fullcircle scaled 2 shifted 1/2[A, C];
+ draw fullcircle scaled 2 shifted 1/2[A, D];
+ draw fullcircle scaled 2 shifted 1/2[B, C];
+ draw fullcircle scaled 2 shifted 1/2[B, D];
+ draw fullcircle scaled 2 shifted 1/2[C, D];
+ draw fullcircle scaled 2 shifted p;
+ draw fullcircle scaled 2 shifted q;
+ draw fullcircle scaled 2 shifted r;
+
+ drawoptions();
+ draw A--B--C--cycle;
+ dotlabel.llft("$A$", A);
+ dotlabel.rt("$B$", B);
+ dotlabel.ulft("$C$", C);
+ dotlabel.urt("\ $D$", D);
+ dotlabel.llft("$M$", M);
+ dotlabel.llft("$N$", N);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-nine-point-circle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,48 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ z0 = origin;
+ z1 = 333 dir -18;
+ z2 = 104 dir 45;
+ z3 = 233 dir 34;
+ z4 = 166 dir 12;
+
+ z5 = whatever[z0, z1];
+ z6 = whatever[z0, z1];
+ z7 = whatever[z0, z1];
+
+ z5 - z4 = whatever * (z3 - z2);
+ z6 - z4 = whatever * (z3 - z2) rotated 90;
+ z7 - z4 = whatever * (z1 - z0) rotated 90;
+
+ z9 = whatever [z2,z3] = whatever [z4,z6];
+
+ numeric t, u, o;
+ t = abs(z4-z5);
+ u = abs(z6-z7);
+ o = 12;
+ drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 white);
+ draw unitsquare scaled 5 rotated angle (z6 - z4) shifted z9;
+ draw unitsquare scaled 5 rotated angle (z4 - z6) shifted z4;
+ draw (1+o/t)[z5,z4] -- (1+o/t)[z4,z5];
+ draw (1+o/t)[z9,z6] -- (1+o/t)[z6,z9];
+ drawoptions();
+
+ draw z0--z1;
+ draw z2--z3;
+
+ interim labeloffset := 6;
+ forsuffixes $=0,1,2,3,4,5,6,7:
+ dotlabel.top("$\;\;" & char ($ + ASCII "A") & "$", z$)
+ if $=5: withcolor 2/3 red fi
+ if $=6: withcolor 2/3 blue fi
+ if $=7: withcolor 1/2 green fi
+ ;
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-parallel.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,68 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef invert(expr P, C) =
+ save o; pair o; o = 1/2[point 0 of C, point 4 of C];
+ save r; numeric r; r = abs (point 0 of C - o);
+ save s; numeric s; s = abs (P - o);
+ o + (P - o) * r / s * r / s
+enddef;
+beginfig(1);
+ path C, L;
+ numeric r;
+ r = 89;
+ C = fullcircle scaled 2r;
+ L = (up--down) scaled 120 shifted 184 right rotated 38;
+ pair a, b, o;
+ a = point 0 of L; b = point 1 of L; o = center C;
+
+ pair P, Q, R, P', m;
+ P = whatever[a, b]; o - P = whatever * (a - b) rotated 90;
+ Q = C intersectionpoint halfcircle zscaled (P-o) shifted 1/2[P, o];
+ R = C intersectionpoint halfcircle zscaled (o-P) shifted 1/2[P, o];
+ P' = whatever[o, P] = whatever [Q, R];
+
+ draw subpath (-3.5,3.5) of fullcircle zscaled (P'-o) shifted 1/2[o, P']
+ dashed withdots scaled 1/4
+ withcolor 1/3 blue;
+
+ draw unitsquare scaled 5 rotated (270 + angle (P-Q)) shifted Q withcolor 3/4 white;
+ draw unitsquare scaled 5 rotated (90 + angle (P-o)) shifted P withcolor 3/4 white;
+ draw unitsquare scaled 5 rotated (90 + angle (P-o)) shifted P' withcolor 3/4 white;
+
+ draw P -- Q -- o -- R -- cycle withcolor 1/2 white;
+ draw Q--R; draw o -- P;
+ draw L withcolor 2/3 blue;
+
+ draw C dashed evenly scaled 1/2 withcolor 1/2[2/3 blue, white];
+
+ dotlabel.top("$Q$", Q);
+ dotlabel.lrt("$R$", R);
+ dotlabel.urt("$P$", P);
+ dotlabel.llft("$O$", o); fill fullcircle scaled 3/4 dotlabeldiam shifted o withcolor white;
+ label.lft("$r$", 1/2[o, Q]);
+
+ drawdot P' withpen pencircle scaled dotlabeldiam;
+ label("$P'$", P' shifted 10 dir 68) withcolor 2/3 blue;
+
+ drawoptions(withcolor 2/3 blue);
+ label.bot("\textit{circle of inversion}", point 6 of C);
+ label.top(TEX("\textit{polar}") rotated angle direction 0 of L, point 1/4 of L);
+ z0 = P' + 20 dir -20; draw z0 -- P' cutafter fullcircle scaled 8 shifted P'
+ withpen pencircle scaled 1/4;
+ label.rt("\textit{pole}", z0);
+ drawoptions(withpen pencircle scaled 2 withcolor 2/3 blue);
+ for i = 1/8, 1/4, 3/8, 5/8, 3/4, 7/8:
+ draw point i of L;
+ draw invert(point i of L, C);
+ endfor
+ drawoptions();
+
+ label("$\displaystyle {r\over OP} = {OP' \over r}$", 1/2[point 0 of C, point 1 of L] + 12 down);
+ label("$\displaystyle r^2 = OP \times OP'$", 1/2[point 0 of C, point 1 of L] + 36 down);
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-pole-and-polar.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,53 @@
+\documentclass[border=1mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef radical_axis(expr ca, cb) =
+ numeric t, d, ra, rb;
+ ra = abs(center ca - point 0 of ca);
+ rb = abs(center cb - point 0 of cb);
+ d = abs(center cb - center ca);
+ 2t = 1 + (ra+rb) / d * (ra-rb) / d;
+ (up -- down) scaled 89
+ rotated angle (center cb - center ca)
+ shifted t[center ca, center cb]
+enddef;
+beginfig(1);
+ z1 = origin; z2 = 233 dir 4; z3 = 209 dir -42;
+ path c[], a[];
+ c1 = fullcircle scaled 202 shifted z1;
+ c2 = fullcircle scaled 106 shifted z2;
+ c3 = fullcircle scaled 62 shifted z3;
+ a1 = radical_axis(c1, c2);
+ a2 = radical_axis(c2, c3);
+ a3 = radical_axis(c3, c1);
+
+ pair radix, t; path orthogonal_circle;
+ radix = whatever[point 0 of a1, point 1 of a1]
+ = whatever[point 0 of a2, point 1 of a2];
+ t = c1 intersectionpoint
+ halfcircle zscaled (radix-z1) shifted 1/2[radix, z1];
+ orthogonal_circle = fullcircle
+ scaled 2 abs (t - radix) shifted radix;
+
+ draw z1 -- z2 -- z3 -- cycle withpen pencircle scaled 1/4;
+ draw a1; draw a2; draw a3;
+ drawoptions(withcolor 3/4[blue, white]);
+ draw c1; draw c2; draw c3;
+ draw z1 -- t dashed evenly;
+ drawoptions(withcolor 2/3 red);
+ draw orthogonal_circle;
+ draw radix -- t dashed evenly;
+ draw radix withpen pencircle scaled dotlabeldiam;
+ drawoptions(withcolor 1/4[blue, white]);
+ draw z1 withpen pencircle scaled dotlabeldiam;
+ draw z2 withpen pencircle scaled dotlabeldiam;
+ draw z3 withpen pencircle scaled dotlabeldiam;
+
+ label.urt(btex $C_1$ etex, point 1 of c1);
+ label.urt(btex $C_2$ etex, point 1 of c2);
+ label.rt (btex $C_3$ etex, point 0 of c3);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-radical-axis.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,24 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input geometry-tangent-times
+
+beginfig(1);
+path C; pair p; numeric a, b;
+C = fullcircle scaled 100;
+p = 189 right rotated 30;
+(a, b) = tangent_times(C, p);
+
+draw C withpen pencircle scaled 2 withcolor 3/4[(.2, .2, .7), white];
+draw p -- subpath (a, b) of C -- cycle dashed evenly;
+label.llft("$C$", point 5 of C);
+dotlabel.urt("$p$", p);
+dotlabel.ulft("point $a$ of $C$", point a of C);
+dotlabel.lrt("point $b$ of $C$", point b of C);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times-on-circle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,12 @@
+% return a <pair> with the two times on C that
+% correspond to the external tangents from p to C
+vardef tangent_times(expr C, p) =
+ save m, o, G, H, a, b;
+ pair m, o; path G, H; numeric a, b;
+ o = center C; m = 1/2[o, p];
+ H = halfcircle zscaled (p-o) shifted m;
+ G = halfcircle zscaled (o-p) shifted m;
+ (a, whatever) = C intersectiontimes H;
+ (b, whatever) = C intersectiontimes G;
+ (a, b if b < a: + 8 fi)
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangent-times.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,61 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path p; numeric s; s = 144;
+p := (origin {1, 3} .. (1, 0) .. {1, 2} (2, 0)) scaled s;
+
+ahangle := 20;
+ahlength := 6;
+picture P[];
+P1 = image(
+ draw p withcolor 0.54 red;
+ for t=0 upto length p: draw fullcircle scaled dotlabeldiam shifted point t of p; endfor
+ label.bot(TEX("\mpl{point 0 of p}") scaled 0.8, point 0 of p shifted 16 right);
+ label.urt(TEX("\mpl{point 1 of p}") scaled 0.8, point 1 of p);
+ label.top(TEX("\mpl{point 2 of p}") scaled 0.8, point 2 of p shifted 16 left);
+);
+P2 = image(
+ draw p withcolor 0.54 red;
+ drawoptions(withcolor 1/2);
+ for t=0 upto length p:
+ drawarrow precontrol t of p -- postcontrol t of p;
+ fill fullcircle scaled 2 shifted precontrol t of p;
+ draw fullcircle scaled 4 shifted point t of p;
+ endfor
+ label.bot(TEX("\mpl{precontrol 0 of p}") scaled 0.8, precontrol 0 of p shifted (24, -2));
+ label.top(TEX("\mpl{postcontrol 0 of p}") scaled 0.8, postcontrol 0 of p shifted (24, 4));
+ label.top(TEX("\mpl{precontrol 1 of p}") scaled 0.8, precontrol 1 of p);
+ label.bot(TEX("\mpl{postcontrol 1 of p}") scaled 0.8, postcontrol 1 of p);
+ label.bot(TEX("\mpl{precontrol 2 of p}") scaled 0.8, precontrol 2 of p);
+ label.top(TEX("\mpl{postcontrol 2 of p}") scaled 0.8, postcontrol 2 of p shifted (-24, 2));
+ drawoptions();
+);
+P3 = image(
+ draw p withcolor 0.54 red;
+ drawoptions(withcolor 1/2);
+ pair s;
+ for t=0 step 1/4 until length p:
+ s := 16 unitvector(direction t of p);
+ drawarrow (-s -- s) shifted point t of p;
+ draw point t of p withpen pencircle scaled 2;
+ endfor
+ drawoptions();
+ numeric x, y; x = 8; y = -12;
+ label.rt(TEX("\mpl{pair s;}") scaled 0.7, (x, y+10));
+ label.rt(TEX("\mpl{for t=0 step 1/4 until length p:}") scaled 0.7, (x, y));
+ label.rt(TEX("\quad\mpl{s := 16 unitvector(direction t of p);}") scaled 0.7, (x, y-10));
+ label.rt(TEX("\quad\mpl{drawarrow (-s -- s) shifted point t of p);}") scaled 0.7, (x, y-20));
+ label.rt(TEX("\quad\mpl{draw point t of p withpen pencircle scaled 2;}") scaled 0.7, (x, y-30));
+ label.rt(TEX("\mpl{endfor}") scaled 0.7, (x, y-40));
+);
+draw P1;
+draw P2 shifted 144 down;
+draw P3 shifted 248 down;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-on-path.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,36 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path C; pair p;
+C = fullcircle scaled 100;
+p = 189 right rotated 30;
+
+pair o, m, t, t'; o = center C; m = 1/2[o, p];
+t = C intersectionpoint halfcircle zscaled (p-o) shifted m;
+t' = C intersectionpoint halfcircle zscaled (o-p) shifted m;
+
+drawoptions(dashed withdots scaled 1/4 withcolor (.2, .2, .7));
+ draw fullcircle zscaled p shifted 1/2 p;
+ draw t -- center C -- p;
+
+drawoptions(withcolor (.2, .2, .7));
+ dotlabel.lrt("$m$", 1/2 p);
+ dotlabel.llft("$o$", center C);
+
+drawoptions(dashed evenly);
+ draw t -- p -- t';
+
+drawoptions();
+
+draw C; label.llft("$C$", point 5 of C);
+dotlabel.urt("$p$", p);
+dotlabel.ulft("$t$", t);
+dotlabel.bot("\strut $t'$", t');
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-point-to-circle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,56 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input geometry-tangent-times
+color tb; tb = (0.2, 0.2, 0.7);
+beginfig(1);
+path A, B;
+A = fullcircle scaled 144;
+B = fullcircle scaled 60 shifted (200, 140);
+
+numeric R, r;
+R = abs (point 0 of A - center A);
+r = abs (point 0 of B - center B);
+
+path C; numeric t, u;
+C = fullcircle scaled (2R-2r) shifted center A;
+(t, u) = tangent_times(C, center B);
+
+draw A withpen pencircle scaled 2 withcolor 3/4[blue, white];
+draw B withpen pencircle scaled 2 withcolor 3/4[blue, white];
+
+draw subpath (t, u) of A -- subpath (u-8, t) of B -- cycle;
+
+draw C withpen pencircle scaled 1 withcolor 7/8[blue, white];
+draw subpath (t, u) of C -- center B -- cycle dashed evenly withcolor 1/2;
+
+drawoptions(dashed withdots scaled 1/2 withcolor 1/4);
+forsuffixes $=t, u:
+ draw point $ of C -- point $ of A;
+ draw center B -- point $ of B;
+endfor
+
+drawoptions(withcolor tb);
+label.urt("$A$", point 1 of A);
+label.ulft("$B$", point 4 of B);
+label.urt("$C$", point 1/2 of C);
+drawdot center B withpen pencircle scaled dotlabeldiam;
+
+drawoptions();
+dotlabel.lrt("$t$", point t of C);
+dotlabel.ulft("$t$", point t of A);
+dotlabel.ulft("$t$", point t of B);
+dotlabel.ulft("$u$", point u of C);
+dotlabel.lrt("$u$", point u of A);
+dotlabel.lrt("$u$", point u of B);
+
+label.rt("$r$", 1/2[center B, point t of B]);
+label.rt("$r$", 1/2[point t of C, point t of A]);
+
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-exterior.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,58 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input geometry-tangent-times
+vardef adjust_time(expr tt, AA, BB) =
+ tt + 1/45 angle (point 0 of AA - center AA)
+ - 1/45 angle (point 0 of BB - center BB)
+enddef;
+beginfig(1);
+path A, B; % randomly rotated to show off "adjust_time"
+A = fullcircle scaled 144 rotated uniformdeviate 360;
+B = fullcircle scaled 60 shifted 240 right rotated 36;
+
+numeric R, r;
+R = abs (point 0 of A - center A);
+r = abs (point 0 of B - center B);
+
+path C;
+C = fullcircle scaled (2R+2r) shifted center A; % NB +ve
+
+numeric t, t', t'', u, u', u'';
+(t, u) = tangent_times(C, center B);
+t' = adjust_time(t, C, A);
+u' = adjust_time(u, C, A);
+t'' = adjust_time(t + 4, C, B); % Note the plus fours
+u'' = adjust_time(u + 4, C, B);
+
+draw A withpen pencircle scaled 2 withcolor 3/4[blue, white];
+draw B withpen pencircle scaled 2 withcolor 3/4[blue, white];
+draw C withpen pencircle scaled 1 withcolor 3/4[blue, white];
+
+draw subpath (t', u') of A -- subpath (u'', t'') of B -- cycle;
+draw center B -- subpath (t, u) of C -- cycle dashed evenly;
+
+draw center B -- point t'' of B dashed withdots scaled 1/2;
+draw center B -- point u'' of B dashed withdots scaled 1/2;
+draw point t of C -- point t' of A dashed withdots scaled 1/2;
+draw point u of C -- point u' of A dashed withdots scaled 1/2;
+
+dotlabel.ulft(btex $t$ etex, point t of C);
+dotlabel.lrt (btex $t'$ etex, point t' of A);
+dotlabel.lrt (btex $t''$ etex, point t'' of B);
+dotlabel.lrt (btex $u$ etex, point u of C);
+dotlabel.ulft(btex $u'$ etex, point u' of A);
+dotlabel.ulft(btex $u''$ etex, point u'' of B);
+drawdot center B withpen pencircle scaled dotlabeldiam;
+
+drawoptions(withcolor 1/2[blue, white]);
+ label.urt(btex $A$ etex, point 1/2(t'+u'- 7.6) of A);
+ label.rt (btex $B$ etex, point 1/2(t''+u''- 2) of B);
+ label.urt(btex $C$ etex, point 1/2(t+u-8) of C);
+drawoptions();
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-tangents-two-circles-interior.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-triangles-on-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-triangles-on-circle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-triangles-on-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,18 +6,18 @@
b shifted -a rotated 60 shifted a
enddef;
beginfig(1);
-path c; c = fullcircle scaled 144;
-numeric n; n = 8;
-for i=0 upto n-1:
- pair a,b,p,q;
- a = point 8/n * i of c;
- b = point 8/n * (i + 1) of c;
- p = equilateral_triangle_point(a,b);
- q = equilateral_triangle_point(b,a);
- draw a -- p -- b withcolor .67 green;
- draw a -- q -- b withcolor .67 red;
-endfor
-draw c withcolor .53 blue;
+ path c; c = fullcircle scaled 144;
+ numeric n; n = 11;
+ for i=0 upto n-1:
+ pair a,b,p,q;
+ a = point 8/n * i of c;
+ b = point 8/n * (i + 1) of c;
+ p = equilateral_triangle_point(a,b);
+ q = equilateral_triangle_point(b,a);
+ draw a -- p -- b withcolor .67 green;
+ draw a -- q -- b withcolor .67 red;
+ endfor
+ draw c withcolor .53 blue;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-triangles-on-circle.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,41 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ path C, base, section, aa;
+ numeric theta;
+ C = fullcircle scaled 144;
+ base = origin -- right scaled 172.8;
+ theta = 60;
+
+ z1 = point 0 of C scaled 1.2 rotated theta;
+ z2 = point 4 of C rotated theta;
+
+ draw C;
+ draw z1 -- origin -- base;
+ draw origin -- z2 -- base shifted z2 dashed evenly;
+
+ section = base scaled 1.2 rotated 1/3 theta shifted z2 cutafter base;
+ draw section;
+
+ label.ulft("$a$", 1/2 z2);
+ aa = subpath (eps, infinity) of section cutbefore C;
+ label.lrt("$a$", point 1/2 of aa);
+
+ draw origin -- point 0 of aa dashed withdots scaled 1/2;
+
+ drawoptions(withcolor 2/3 blue); % distinguish angle labels
+ label("$\theta$", 16 dir 1/2 theta);
+ label("$\theta/3$", 52 dir 1/6 theta shifted z2);
+ drawoptions();
+
+ drawoptions(withpen pencircle scaled 2/3 dotlabeldiam);
+ draw origin; draw z2; draw point 0 of aa; draw point 1 of aa;
+ drawoptions();
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-classical.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,20 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ path ray; ray = origin -- 200 right;
+ numeric theta; theta = 42;
+ draw ray;
+ draw ray rotated 1/3 theta withcolor 2/3 red;
+ draw ray rotated 2/3 theta withcolor 2/3 red;
+ draw ray rotated theta;
+ dotlabel.llft("$0$", origin);
+ label("$\theta/3$", 72 right rotated 1/6 theta) withcolor 2/3 blue;
+ label("$\theta/3$", 72 right rotated 3/6 theta) withcolor 2/3 blue;
+ label("$\theta/3$", 72 right rotated 5/6 theta) withcolor 2/3 blue;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-trisection-simple.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,26 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\hbox to 5in{$\vcenter{%
+\begin{mplibcode}
+beginfig(1);
+ z1 = (10, 50);
+ z2 = (80, 190);
+ z3 = (0, 170);
+ z4 = (60, 10);
+
+ z0 = whatever [z1, z2] = whatever [z3, z4];
+
+ draw z1--z2; draw z3--z4;
+
+ forsuffixes @=0,1,2,3,4:
+ dotlabel.rt(TEX("$z_" & decimal @ & "$"), z@)
+ withcolor 2/3 if @=0: red else: blue fi;
+ endfor
+endfig;
+\end{mplibcode}
+}\quad\vcenter{
+\smallmpexternal[firstline=7,lastline=21]{geometry-whatever.mp}
+}$\hss}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/geometry-whatever.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gons.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gons.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gons.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,28 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-vardef gcd(expr a, b) =
- if b = 0: a else: gcd(b, a mod b) fi
-enddef;
-beginfig(1);
-for n=2 upto 24:
- for s=1 upto floor n/2:
- pair p; p = (12n - 24s, -24n);
- path gon; gon = (
- for t=0 upto n/gcd(s,n) - 1:
- 10 up rotated (360/n * s * t) --
- endfor cycle);
- if (n mod s = 0):
- fill gon shifted p withcolor PuBuGn[9][1+floor (n/s/6)];
- label("$" & decimal (n/s) & "$", p);
- fi
- draw gon shifted p withpen pencircle scaled 1/8;
- endfor
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/gons.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/graph-paper.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/graph-paper.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/graph-paper.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,34 +0,0 @@
-\documentclass[border=1mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef grid(expr ll, ur, grid_unit) =
- save llx, lly, urx, ury, G; numeric llx, lly, urx, ury;
- (llx, lly) = ll; (urx, ury) = ur;
- picture G; G = image(
- for x = floor(llx / grid_unit) + 1 upto floor(urx / grid_unit):
- draw (x * grid_unit, lly) -- (x * grid_unit, ury);
- endfor
- for y = floor(lly / grid_unit) + 1 upto floor(ury / grid_unit):
- draw (llx, y * grid_unit) -- (urx, y * grid_unit);
- endfor
- fill fullcircle; % <-- you might not want this
- ); G enddef;
-
-input colorbrewer-rgb
-beginfig(1);
- path C;
- C = fullcircle scaled 120 shifted 12 up rotated 6;
- for t=0, 1.23, 4: draw center C -- point t of C withcolor Blues 8 8; endfor
- draw C withcolor Reds 8 8;
- dotlabel.urt("Start", point 0 of C);
-
- picture P; P = currentpicture; currentpicture := nullpicture;
- draw grid(llcorner P, urcorner P, 1mm) withpen pencircle scaled 1/4 withcolor Blues 8 1;
- draw grid(llcorner P, urcorner P, 1cm) withpen pencircle scaled 1/4 withcolor Blues 8 2;
- draw P;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/graph-paper.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-default-encoding.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-default-encoding.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-default-encoding.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,29 +0,0 @@
-%\documentclass[border=5mm]{standalone}
-%\usepackage{luamplib}
-%\begin{document}
-%\begin{mplibcode}
-prologues := 3;
-outputtemplate := "%j.%{outputformat}";
-beginfig(1);
-string ab, AB;
-
-ab = ("" for i=11 upto 23: & char i endfor
- & "o" for i=24 upto 33: & char i endfor);
-
-AB = ("AB" & char 0 & char 1 & "EZH" & char 2 & "IK"
- & char 3 & "MNO" & char 4 & char 5 & "P"
- & char 6 & "T" & char 7 & char 8 & "X"
- & char 9 & char 10);
-
-draw ab infont "cmmi10";
-draw AB infont "cmmi10" shifted 12 down;
-draw ab infont "eurm10" shifted 32 down;
-draw AB infont "eurm10" shifted 44 down;
-
-undraw (6 left -- 180 right) shifted 12 up;
-undraw (6 left -- 180 right) shifted 50 down;
-
-endfig;
-%\end{mplibcode}
-%\end{document}
-end
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-default-encoding.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-gfs-encoding.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-gfs-encoding.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-gfs-encoding.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,21 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(2);
-string ab, AB;
-ab = "abgdezhjiklmnoxprstufqyw";
-AB = "ABGDEZHJIKLMNOXPRSTUFQYW";
-y := 0;
-for $="grmn1000", "gporsonrg6r", "gneohellenicrg6r":
- draw $ infont "cmss10" scaled 0.8 shifted (0,y) withcolor .67 red;
- draw ab infont $ shifted (0,y-10);
- draw AB infont $ shifted (0,y-22);
- y := y - 40;
-endfor
-undraw (6 left -- 180 right) shifted 12 up;
-undraw (6 left -- 180 right) shifted 108 down;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-gfs-encoding.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-homer.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-homer.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-homer.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,25 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-vardef setg(text t) =
- save G; picture G;
- save x; numeric x; x = 0;
- G = image(
- for w = t:
- picture g;
- g = w infont "gporsonrg6r";
- draw g shifted (x, 0);
- x := x + xpart (urcorner g - llcorner g) + 3;
- endfor
- ); G enddef;
-beginfig(1);
-picture homer;
-homer = setg("m" & char 168 & "nin", char 138 & "eide", "je" & char 128,
- "Phlh" & char 240 & char 136 & "deiw", ">Aqil" & char 168 & "oc");
-undraw 10 left -- 272 right;
-draw homer scaled 1.732 withcolor .54 red;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/greek-homer.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/icosahedron.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/icosahedron.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/icosahedron.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,53 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef thatch(expr a, b, c, penw, gap) =
- picture H;
- pair v;
- v = gap * unitvector(c - 1/2[a, b]);
- H = image(
- for i=1 upto 120:
- draw (a--b)
- shifted (i * v)
- withpen pencircle scaled penw;
- endfor
- );
- clip H to a--b--c--cycle; draw H;
-enddef;
-
-beginfig(1);
-
- path h, t;
-
- h = for i=0 upto 5: 84 right rotated 60i -- endfor cycle;
- t = (origin -- subpath (0, 1) of h -- cycle)
- shifted -1/3(point 0 of h + point 1 of h)
- scaled 1.08
- rotated 90;
-
- thatch(point 2 of t, point 0 of t, point 1 of t, 1/4, 3/2);
- thatch(point 4 of h, point 0 of t, point 2 of t, 1/4, 5/4);
- thatch(point 0 of t, point 0 of h, point 1 of t, 1/4, 3/4);
- thatch(point 1 of h, point 1 of t, point 0 of h, 1/4, 1);
- thatch(point 4 of h, point 2 of t, point 3 of h, 1/4, 2);
- thatch(point 4 of h, point 0 of t, point 5 of h, 1/4, 1);
- thatch(point 5 of h, point 0 of t, point 6 of h, 1/4, 3/4);
-
- draw h;
- draw t;
-
- for i=0 upto 2:
- draw point 2i of h -- point i of t;
- draw point 2i of h -- point i+1 of t;
- draw point 2i+1 of h -- point i+1 of t;
- endfor
-
- input ruler-cm
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/icosahedron.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh-open.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh-open.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh-open.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,9 +6,9 @@
path p; p = origin -- dir 30;
numeric n, r; r = 3;
for i=1 upto 12:
- n := length p;
- p := p rotated (45 - r);
- p := p & reverse p rotatedabout(point n of p, 90 + 2r);
+ n := length p;
+ p := p rotated (45 - r);
+ p := p & reverse p rotatedabout(point n of p, 90 + 2r);
endfor
draw p scaled (384 / xpart (urcorner p - llcorner p)) withcolor .54 red;
endfig;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh-open.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,15 +3,14 @@
\begin{document}
\begin{mplibcode}
beginfig(1);
-path p; p = origin -- right rotated 30;
+path p; p = origin -- dir 30;
numeric n;
for i=1 upto 12:
- n := length p;
- p := p rotated 45;
- p := p & reverse p rotatedabout(point n of p, 90);
+ n := length p;
+ p := p rotated 45;
+ p := p & reverse p rotatedabout(point n of p, 90);
endfor
-draw p scaled (384 / xpart (urcorner p - llcorner p))
- withcolor (.2, .2, .7);
+draw p scaled (384 / xpart (urcorner p - llcorner p)) withcolor (.2,.2,.7);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ifs-heigh.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,22 +3,21 @@
\begin{document}
\begin{mplibcode}
beginfig(1);
- numeric u; u = 21;
-picture strip;
-strip = image(
+ numeric u; u = 21;
+ picture strip;
+ strip = image(
for i=-10 upto 10:
- fill unitsquare shifted (2i,0) scaled u;
- draw unitsquare shifted (2i,0) scaled u withcolor 1/2;
+ fill unitsquare shifted (2i,0) scaled u;
+ draw unitsquare shifted (2i,0) scaled u withcolor 1/2;
endfor
for i=0, 1:
- draw ((-20, i) -- (20, i)) scaled u withcolor 1/2;
+ draw ((-20, i) -- (20, i)) scaled u withcolor 1/2;
endfor
-);
-for i=0 upto 9:
+ );
+ for i=0 upto 9:
draw strip shifted (4 normaldeviate, i*u);
-endfor
-clip currentpicture to unitsquare shifted 1/2 left xscaled 29.2 yscaled 10 scaled u;
+ endfor
+ clip currentpicture to unitsquare shifted 1/2 left xscaled 29.2 yscaled 10 scaled u;
endfig;
\end{mplibcode}
\end{document}
-
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cafe-wall.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,42 +5,41 @@
\begin{mplibcode}
input colorbrewer-rgb
beginfig(2);
- numeric u, v;
- u = 60;
- v = 21 * sqrt(3);
- path face[];
+ numeric u, v;
+ u = 60;
+ v = 21 * sqrt(3);
+ path face[];
+ for i=0 upto 2:
+ face[i] = unitsquare scaled u rotated 45 yscaled (1/sqrt(3)) rotated (120-120i);
+ endfor
+ picture cube, sides;
+ cube = image(
for i=0 upto 2:
- face[i] = unitsquare scaled u rotated 45 yscaled (1/sqrt(3)) rotated (120-120i);
+ fill face[i] withcolor Oranges[8][i+1];
endfor
- picture cube, sides;
- cube = image(
- for i=0 upto 2:
- fill face[i] withcolor Oranges[8][i+1];
- endfor
- for i=0 upto 2:
- draw subpath (1, 4) of face[i];
- endfor
- );
- sides = image(
- for i=0, 2:
- fill face[i] withcolor Oranges[8][i+1];
- endfor
- for i=0, 2:
- draw face[i];
- endfor
- );
- draw cube shifted (0u, 2v);
- draw cube shifted (0u, 4v);
- draw cube shifted (0u, 6v);
- draw cube shifted (1u, 5v);
- draw cube shifted (2u, 4v);
- draw cube shifted (3u, 3v);
- draw cube shifted (2u, 2v);
- draw cube shifted (u, v);
- draw cube;
- draw sides shifted (0u, 2v);
+ for i=0 upto 2:
+ draw subpath (1, 4) of face[i];
+ endfor
+ );
+ sides = image(
+ for i=0, 2:
+ fill face[i] withcolor Oranges[8][i+1];
+ endfor
+ for i=0, 2:
+ draw face[i];
+ endfor
+ );
+ draw cube shifted (0u, 2v);
+ draw cube shifted (0u, 4v);
+ draw cube shifted (0u, 6v);
+ draw cube shifted (1u, 5v);
+ draw cube shifted (2u, 4v);
+ draw cube shifted (3u, 3v);
+ draw cube shifted (2u, 2v);
+ draw cube shifted (u, v);
+ draw cube;
+ draw sides shifted (0u, 2v);
endfig;
\end{mplibcode}
\end{document}
-
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-cubes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,26 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\mplibsetformat{metafun}
-\begin{mplibcode}
-beginfig(1);
- path s;
- s = origin for i=1 upto 90: .. (30i, 0) rotated 4i endfor;
-
- path e[], f[];
- for i = 0 upto 17:
- e[i] = s rotated 20i;
- f[i] = s reflectedabout(left, right) rotated 20i;
- endfor
-
- for i=0 upto 8:
- fill e[2i] -- reverse e[2i+1] .. cycle withcolor 1/2;
- endfor
- for i=0 upto 8:
- fill f[2i] -- reverse f[2i+1] .. cycle withcolor transparent(2, 1/2, 0);
- endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-fraser-spiral.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,42 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\usepackage{graphicx}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-%label("$\includegraphics{ring-11.png}$", origin);
-path S;
-S = (-117, 4) {dir 30} .. {right} 30 up .. {dir -36} (117, -4) .. {left} 88 down
- .. (-200, -50) .. {up} (-266, 30) {down} -- (-266, -50)
- .. (-200, -108) {dir -28} .. 148 down {right}
- .. (200, -108) .. {up} (266, -30);
-S := S & subpath (5, 2) of S rotated 180 & cycle;
-input colorbrewer-rgb
-
-fill S withcolor Greens 8 3;
-fill S rotated 180 withcolor Reds 8 3;
-
-picture rules; rules = image(
- for t=0 step 1/32 until directiontime down of subpath(12, 13) of S:
- draw point 12+t of S -- point 12+t of S shifted 100 down
- cutafter S;
- endfor
- for t=3 step 1/16 until 5:
- draw point t of S -- point t of S shifted 100 down cutafter subpath (6, 8) of S;
- endfor
- for t=8+1/16 step 1/16 until 12:
- draw point t of S -- 1/2[point 1 of S, point 3 of S] cutafter subpath (1, 3) of S;
- endfor
-);
-
-for r = 0, 180:
- draw rules rotated r;
- draw S rotated r;
-endfor
-
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-ring.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,36 +6,34 @@
input colorbrewer-rgb
beginfig(1);
- numeric u;
+ numeric u;
- u = 42;
+ u = 42;
- z0 = (0, 3u);
- z1 = z0 rotated 120;
- z2 = z1 rotated 120;
+ z0 = (0, 3u);
+ z1 = z0 rotated 120;
+ z2 = z1 rotated 120;
- z3 = z0 shifted (1/2u, 3/2u * sqrt(3));
- z4 = z3 shifted (-u,0);
-
- z5-z4 = whatever * (z0-z1);
- z6 = whatever [z0, z2];
- y5 = y6 = y2 - sqrt(3) * 1/2 u;
-
- z7-z3 = whatever * (z0-z1);
- z7 = whatever [z1, z2];
+ z3 = z0 shifted (1/2u, 3/2u * sqrt(3));
+ z4 = z3 shifted (-u,0);
- %dotlabels.top(0, 1, 2, 3, 4, 5, 6, 7);
+ z5-z4 = whatever * (z0-z1);
+ z6 = whatever [z0, z2];
+ y5 = y6 = y2 - sqrt(3) * 1/2 u;
- path vii;
- vii = z3--z4--z5--z6--z2--z7--cycle;
+ z7-z3 = whatever * (z0-z1);
+ z7 = whatever [z1, z2];
- for i=0 upto 2:
- fill vii rotated 120i withcolor Blues[9][i+2];
- endfor
- for i=0 upto 2:
- draw vii rotated 120i;
- endfor
+ path vii;
+ vii = z3--z4--z5--z6--z2--z7--cycle;
+ for i=0 upto 2:
+ fill vii rotated 120i withcolor Blues[9][i+2];
+ endfor
+ for i=0 upto 2:
+ draw vii rotated 120i;
+ endfor
+
endfig;
\end{mplibcode}
\end{document}
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-impossible-triangle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,23 +1,20 @@
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
-\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- path s; s = unitsquare shifted -(1/2, 1/2) scaled 23;
- for n = 1 upto 4:
- numeric N; N = 10n + 8;
- numeric a; a = 30 normaldeviate;
- for t=0 upto N-1:
- draw s rotated if odd n: - fi 13 shifted (5N * right) rotated (360 / N * t + a)
- withcolor t mod 2;
- endfor
+ path s; s = unitsquare shifted -(1/2, 1/2) scaled 21;
+ for n = 1 upto 4:
+ numeric N; N = 9n + 8;
+ numeric a; a = 30 normaldeviate;
+ for t=0 upto N-1:
+ draw s rotated if odd n: - fi 13 shifted (5N * right) rotated (360 / N * t + a)
+ withpen pencircle scaled 1 withcolor t mod 2;
endfor
- picture P;
- P = currentpicture; currentpicture := nullpicture;
- fill bbox P withcolor 0.42;
- draw P;
+ endfor
+ picture P;
+ P = currentpicture; clearit;
+ fill bbox P withcolor 0.52; draw P;
endfig;
\end{mplibcode}
\end{document}
-
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-pinna.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,27 +6,24 @@
input colorbrewer-rgb
path diamond; picture shaded;
diamond = (left -- 3 down -- right -- 3 up -- cycle) scaled 13;
-shaded = image(
-for i=0 upto 256:
- draw (left--right) scaled 15 shifted (0, 78/256 i - 39)
- withpen pencircle scaled 0.32
- withcolor (i/256)[white, Greens 8 8];
+shaded = image(for i=0 upto 256:
+ draw (left--right) scaled 15 shifted (0, 78/256 i - 39)
+ withpen pencircle scaled 0.32
+ withcolor (i/256)[white, Greens 8 8];
endfor); clip shaded to diamond;
-
- pair u, v;
- u = point 2 of diamond - point 0 of diamond;
- v = point 3 of diamond - point 0 of diamond;
+pair u, v;
+u = point 2 of diamond - point 0 of diamond;
+v = point 3 of diamond - point 0 of diamond;
+
beginfig(1);
- for i=0 upto 8:
- for j=0 upto min(8-i, 4):
- draw shaded shifted (i * u + j * v);
- endfor
+ for i=0 upto 8:
+ for j=0 upto min(8-i, 4):
+ draw shaded shifted (i * u + j * v);
endfor
- clip currentpicture to -1/2u -- 9u -- 5u + 4v -- 4v - 1/2u -- cycle;
-
- draw currentpicture rotated 180;
-
+ endfor
+ clip currentpicture to -1/2u -- 9u -- 5u + 4v -- 4v - 1/2u -- cycle;
+ draw currentpicture rotated 180;
endfig;
\end{mplibcode}
\end{document}
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-shaded-diamonds.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,22 +4,22 @@
\begin{mplibcode}
input colorbrewer-rgb
beginfig(1);
- path o; numeric r; r = 1/4;
- o = (for i=0 upto 3: subpath (i+r, i+1-r) of unitsquare shifted -(1/2, 1/2) -- endfor cycle) scaled 42;
- picture unit; path s; s = unitsquare scaled arclength subpath (1, 3/2) of o
- rotated -45 shifted point 3/2 of o;
- unit = image(
- fill o withcolor Blues 8 5;
- for i=0 upto 3: fill s rotated 90i; endfor
- );
+ path o; numeric r; r = 1/4;
+ o = (for i=0 upto 3: subpath (i+r, i+1-r) of unitsquare shifted -(1/2, 1/2) -- endfor cycle) scaled 42;
+ picture unit; path s; s = unitsquare scaled arclength subpath (1, 3/2) of o
+ rotated -45 shifted point 3/2 of o;
+ unit = image(
+ fill o withcolor Blues 8 5;
+ for i=0 upto 3: fill s rotated 90i; endfor
+ );
- pair u, v; u = 42 right; v = u rotated 90; numeric n; n = 3;
- for i=-n upto n:
- for j=-2n upto 2n:
- draw unit if (i+j) mod 4 < 2: reflectedabout (dir 135, dir -45) fi
- shifted ((2i + j mod 2)*u + j*v);
- endfor
+ pair u, v; u = 42 right; v = u rotated 90; numeric n; n = 3;
+ for i=-n upto n:
+ for j=-2n upto 2n:
+ draw unit if (i+j) mod 4 < 2: reflectedabout (dir 135, dir -45) fi
+ shifted ((2i + j mod 2)*u + j*v);
endfor
+ endfor
endfig;
\end{mplibcode}
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/illusions-wonky-grid.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/incircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/incircle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/incircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,38 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef through(expr a, b, o) =
- save t; numeric t; t = 1+o/abs(a-b);
- t[b,a] -- t[a,b]
-enddef;
-
-beginfig(1);
- pair A, B, C;
- A = origin; B = 377 dir 10; C = 233 dir 70;
- pair a, b, m, t;
- a = A + 22 unitvector (C-A) + 22 unitvector (B-A);
- b = B + 22 unitvector (A-B) + 22 unitvector (C-B);
- m = whatever[A,a] = whatever [B,b]; t = whatever[A,B];
- t-m = whatever * (B-A) rotated 90;
-
- drawoptions(dashed evenly scaled 1/4 withcolor 1/2 white);
- draw t -- m;
- draw unitsquare scaled 5 rotated angle (B-A) shifted t;
- draw through(A, m, 10);
- draw through(B, m, 10);
- drawoptions();
- draw fullcircle scaled 2 abs (t-m) shifted m withcolor 2/3 red;
- draw A--B--C--cycle;
- dotlabel.top(btex $m$\thinspace\strut etex, m);
- dotlabel.bot(btex $t$ etex, t);
- dotlabel.bot(btex $A$ etex, A);
- dotlabel.urt(btex $B$ etex, B);
- dotlabel.top(btex $C$ etex, C);
- dotlabel.top(btex $a$ etex, a);
- dotlabel.top(btex $b$ etex, b);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/incircle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-annotated.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-annotated.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-annotated.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,48 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-picture p, pp;
-p = "proof" infont "pplri8r" scaled 4;
-pp = "proof" infont "pplri8r" scaled 8;
-(wd, ht) = urcorner pp;
-(xx, dp) = llcorner pp;
-xheight = ypart urcorner ("x" infont "pplri8r" scaled 8);
-
-beginfig(3);
-drawoptions( withpen pencircle scaled .5 withcolor .7[.74 red, white]);
-draw origin -- (0,ht) -- (wd, ht) -- (wd, dp) -- (0,dp) -- cycle;
-for y=0,xheight:
- draw (0,y) -- (wd,y);
-endfor
-draw bbox pp dashed withdots scaled 1/4;
-drawoptions();
-draw pp withcolor .5 white;
-fill fullcircle scaled 4 shifted center pp withcolor .7[3/4 red,white];
-
-vardef east primary p = 1/2[urcorner p, lrcorner p] enddef;
-vardef west primary p = 1/2[ulcorner p, llcorner p] enddef;
-vardef eastx primary p = lrcorner p shifted (+1,3) enddef;
-vardef westx primary p = llcorner p shifted (-1,3) enddef;
-
-picture c[]; ahangle := 30; string s[];
-c0 = "center" infont "pplr8r" shifted center pp shifted (21,27);
-c1 = "urcorner" infont "pplr8r" shifted urcorner pp shifted (13,8);
-c2 = "ulcorner" infont "pplr8r" shifted ulcorner pp; c2 := c2 shifted (-13-xpart urcorner c2,8);
-c3 = "llcorner" infont "pplr8r" shifted llcorner pp; c3 := c3 shifted (-13-xpart urcorner c3,-13);
-c4 = "lrcorner" infont "pplr8r" shifted lrcorner pp shifted (13,-13);
-c5 = "bboxmargin" infont "pplr8r" scaled 0.8;
-draw c0 withcolor .67 red; drawarrow center c0 .. {dir -120} center pp shifted ( 1, 3) cutbefore bbox c0;
-draw c1 withcolor .67 red; drawarrow westx c1 .. {dir -120} urcorner pp shifted ( 1, 1);
-draw c2 withcolor .67 red; drawarrow eastx c2 .. {dir -60} ulcorner pp shifted (-1, 1);
-draw c3 withcolor .67 red; drawarrow eastx c3 .. {dir +60} llcorner pp shifted (-2,-2);
-draw c4 withcolor .67 red; drawarrow westx c4 .. {dir +120} lrcorner pp shifted ( 1,-1);
-label.bot(c5, point 1/2 of bbox pp) withcolor 1/4[.67 red, white];
-
-c6 = ("x-height" infont "pplr8r"); c6 := c6 shifted (-13-xpart urcorner c6,xheight-2.2);
-c7 = ("origin" infont "pplr8r"); c7 := c7 shifted (-13-xpart urcorner c7,-2.2);
-draw c6 withcolor .67 blue; drawarrow (-12,xheight) -- (-1,xheight);
-draw c7 withcolor .67 blue; drawarrow (-12,0) -- (-1,0);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-annotated.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-example.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-example.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-example.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,19 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-interim bboxmargin := 2;
-picture p, pp;
-p = "proof" infont "pplri8r" scaled 4;
-pp = image(
-draw (left -- 7 right) scaled 14 withcolor .7 white;
-draw p;
-draw bbox currentpicture withcolor 3/4[red, white]);
-beginfig(1);
-draw bbox p withcolor 3/4[red, white];
-draw p;
-draw pp shifted 120 right;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/infont-example.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-AB-or-BA.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-AB-or-BA.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-AB-or-BA.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,44 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-label(btex \vbox{\halign{\hfil\itshape # \hfil\cr
-The paths are drawn with\cr
-arrows to show where\cr
-they start \& stop.\cr}} etex, origin);
-
-ahangle := 30;
-path A, B;
-A = fullcircle scaled 200 shifted 40 left;
-B = fullcircle scaled 200 rotated 144 shifted 40 right;
-
-forsuffixes $=A, B:
- drawarrow $ cutafter fullcircle scaled 6 shifted point 0 of $;
- for t=0 upto 7:
- drawdot point t of $ withpen pencircle scaled 2;
- endfor
-endfor
-
-label.ulft("$A$", point 3.14 of A);
-label.urt("$B$", point 6.28 of B);
-
-drawoptions(withcolor 0.54 red);
-numeric t, u; (t,u) = A intersectiontimes B;
-draw fullcircle scaled 6 shifted point t of A;
-z0 = point t of A shifted (-3, 16);
-draw z0 -- point t of A cutafter fullcircle scaled 8 shifted point t of A;
-label.top("\texttt{A intersectiontimes B}", z0);
-drawoptions(withcolor (.2, .2, .7));
-numeric t, u; (t,u) = B intersectiontimes A;
-draw fullcircle scaled 6 shifted point t of B;
-z1 = point t of B shifted (-3, -16);
-draw z1 -- point t of B cutafter fullcircle scaled 8 shifted point t of B;
-label.bot("\texttt{B intersectiontimes A}", z1);
-drawoptions();
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-AB-or-BA.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-algorithm.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-algorithm.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-algorithm.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,93 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-color tr, tb; tr = 0.54 red; tb = (0.2, 0.2, 0.7);
-ahangle := 30;
-path A, B;
-A = subpath (1, 2) of fullcircle scaled 240 shifted 48 left;
-B = subpath (7, 8) of fullcircle scaled 240 rotated 144 shifted 48 right;
-
-picture P[];
-P1 = image(
- drawarrow A; label.rt("$A$", point 0 of A);
- drawarrow B; label.rt("$B$", point 0 of B);
-);
-vardef boxed(expr p) =
- save d; pair d; d = point infinity of p - point 0 of p;
- unitsquare xscaled xpart d yscaled ypart d shifted point 0 of p
-enddef;
-
-P2 = image(
- draw A withcolor 3/4;
- draw B withcolor 3/4;
- draw boxed(A) withcolor tr;
- draw boxed(B) withcolor tb;
-);
-
-P3 = image(
- draw A withcolor 3/4;
- draw B withcolor 3/4;
- path s[];
- numeric m; m = arctime 1/2 arclength A of A;
- s1 = boxed(subpath (0, m) of A);
- s3 = boxed(subpath (m, infinity) of A);
- numeric m; m = arctime 1/2 arclength B of B;
- s2 = boxed(subpath (0, m) of B);
- s4 = boxed(subpath (m, infinity) of B);
- draw s3 withcolor 7/8;
- draw s4 withcolor 7/8;
- draw s2 withcolor tb;
- draw s1 withcolor tr;
- label.urt("$\scriptstyle 1$", point 1 of s1);
- label.ulft("$\scriptstyle 2$", point 0 of s2);
- label.urt("$\scriptstyle 3$", point 1 of s3);
- label.ulft("$\scriptstyle 4$", point 3 of s4);
-);
-
-draw P1;
-draw P2 shifted 120 right;
-draw P3 shifted 240 right;
-
-P4 = image(
- draw A withcolor 3/4;
- draw B withcolor 3/4;
- numeric m[];
- m1 = arctime 1/4 arclength A of A;
- m2 = arctime 1/2 arclength A of A;
- draw boxed(subpath (0, m1) of A) withcolor 7/8;
- draw boxed(subpath (m1, m2) of A) withcolor tr;
- numeric m[];
- m1 = arctime 1/4 arclength B of B;
- m2 = arctime 1/2 arclength B of B;
- draw boxed(subpath (0, m1) of B) withcolor 7/8;
- draw boxed(subpath (m1, m2) of B) withcolor tb;
-);
-P5 = image(
- draw A withcolor 3/4;
- draw B withcolor 3/4;
- numeric m[];
- m1 = arctime 1/4 arclength A of A;
- m2 = arctime 3/8 arclength A of A;
- m3 = arctime 1/2 arclength A of A;
- draw boxed(subpath (m1, m2) of A) withcolor 7/8;
- draw boxed(subpath (m2, m3) of A) withcolor tr;
- numeric m[];
- m1 = arctime 1/4 arclength B of B;
- m2 = arctime 3/8 arclength B of B;
- m3 = arctime 1/2 arclength B of B;
- draw boxed(subpath (m2, m3) of B) withcolor 7/8;
- draw boxed(subpath (m1, m2) of B) withcolor tb;
-);
-
-draw P4 shifted 89 down;
-draw P5 shifted 89 down shifted 120 right;
-interim bboxmargin := 0;
-label.top("and so on\dots", center bbox P5 shifted 89 down shifted 240 right);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-algorithm.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-all-three.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-all-three.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-all-three.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,28 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path A, B;
-A = (origin {dir 42} .. 120 right {dir 42}) rotated 6;
-B = A reflectedabout (left, right) shifted 10 up;
-drawarrow A; label.llft("$A$", point 0 of A);
-drawarrow B; label.ulft("$B$", point 0 of B);
-
-pair P[]; numeric n; n=0;
-path R; R := A; %take a copy of A
-forever:
- R := R cutbefore B; % snip where we cross B
- exitif length cuttings = 0; % stop if nothing was cut
- P[incr n] = point 0 of R; % capture the point
- R := subpath (epsilon, infinity) of R; % nudge along
-endfor
-
-draw fullcircle scaled 4 shifted P1 withcolor .54 red;
-draw fullcircle scaled 4 shifted P2 withcolor .54 red;
-draw fullcircle scaled 4 shifted P3 withcolor .54 red;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-all-three.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-only-two.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-only-two.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-only-two.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,21 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path A, B;
-A = (origin {dir 42} .. 120 right {dir 42}) rotated 6;
-B = A reflectedabout (left, right) shifted 10 up;
-drawarrow A; label.llft("$A$", point 0 of A);
-drawarrow B; label.ulft("$B$", point 0 of B);
-draw fullcircle scaled 4
- shifted (A intersectionpoint B)
- withcolor .54 red;
-draw fullcircle scaled 4
- shifted (reverse A intersectionpoint B)
- withcolor (.2, .2, .7);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/intersection-only-two.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/line-caps-and-joins.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/line-caps-and-joins.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/line-caps-and-joins.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,56 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-numeric u; u = 32;
-z1 = right scaled u;
-z2 = z1 rotated 90;
-z3 = z2 rotated 90;
-z4 = z3 rotated 90;
-z5 = 1/2[z1,z2];
-z6 = 1/2[z2,z3];
-z7 = 1/2[z3,z4];
-z8 = 1/2[z4,z1];
-
-color tb, tr;
-tb = (.2,.2,.7);
-tr = 0.54 red;
-
-drawoptions (withpen pencircle scaled 2);
-picture p;
-for i=0 upto 2:
- for j=0 upto 2:
- linecap := i;
- linejoin := j;
- p := image(
- draw unitsquare shifted -(1/2,1/2) scaled 2u withcolor 7/8;
- label(decimal linecap, z7) withcolor tb;
- label(decimal linejoin, z8) withcolor tr;
- drawarrow z1--z3;
- draw z2--z4;
- drawdot(z5);
- drawdot(z6);
- drawarrow halfcircle scaled u rotated 180 shifted z4;
- ) shifted (5/2u*i, -11/4u*j);
- draw p;
- if (i=1) and (j=1): draw bbox p dashed withdots scaled 3/4
- withpen pencircle scaled 1/2
- ; fi
- endfor
- endfor
-
- label("linecap" infont "cmtt10" scaled 1.2, (5/2u, 7/4u));
- label("butt" infont "cmtt10" , ( 0, 5/4u)) withcolor tb;
- label("rounded" infont "cmtt10" , (5/2u, 5/4u)) withcolor tb;
- label("squared" infont "cmtt10" , (5/1u, 5/4u)) withcolor tb;
-
- label("linejoin" infont "cmtt10" scaled 1.2 rotated 90, (-7/4u, -11/4u));
- label("mitered" infont "cmtt10" rotated 90, (-5/4u,0)) withcolor tr;
- label("rounded" infont "cmtt10" rotated 90, (-5/4u,-11/4u)) withcolor tr;
- label("beveled" infont "cmtt10" rotated 90, (-5/4u,-11/2u)) withcolor tr;
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/line-caps-and-joins.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/linear-graph.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/linear-graph.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/linear-graph.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,52 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- numeric u, m, m', b, b';
- u = 1.44cm;
- b = 3.6u; b' = b + 1/2 u;
- m = -1; m' = 3/4 m;
-
- path xx, yy;
- xx = (left -- 5 right) scaled u;
- yy = xx rotated 90;
-
- numeric minx, maxx; path ff, gg;
- minx = xpart point 1/16 of xx;
- maxx = xpart point 15/16 of xx;
- ff = (minx, minx * m + b) -- (maxx, maxx * m + b);
- gg = (minx, minx * m' + b') -- (maxx, maxx * m' + b');
-
- z0 = point 0.4 of ff;
- z1 = point 0.54 of ff;
- z1 0 = whatever [point 0 of gg, point 1 of gg]; x1 0 = x0;
- z1 1 = whatever [point 0 of gg, point 1 of gg]; x1 1 = x1;
-
- forsuffixes @=0, 1:
- draw (x@, 0) -- z@ -- (0, y@) dashed evenly scaled 3/4;
- draw z@ -- z1 @ -- (0, y1 @) dashed withdots scaled 1/2;
- label.bot("$x_{" & decimal @ & "}$", (x@, 0));
- label.lft("$y_{" & decimal @ & "}$", (0, y@));
- label.lft("$y'_{" & decimal @ & "}$", (0, y1 @));
- endfor
-
- draw ff withcolor 2/3 red;
- draw gg withcolor 3/4 blue;
- drawarrow xx; drawarrow yy;
-
- label.rt("$x$", point 1 of xx);
- label.top("$y$", point 1 of yy);
-
- dotlabel.urt("$b$", (0, b));
- dotlabel.urt("$b'$", (0, b'));
-
- draw thelabel("slope: $m=" & decimal m & "$", 7 up)
- rotated angle (1, m) shifted point 2/3 of ff;
- draw thelabel("slope: $m'=" & decimal m' & "$", 7 up)
- rotated angle (1, m') shifted point 2/3 of gg;
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/linear-graph.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/listex.py
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/listex.py (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/listex.py 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,131 @@
+'''Read a TeX .fls file and produce a consolidated, deduplicated list of the
+files involved. Optionally check for MP source files as well'''
+
+import argparse
+import pathlib
+import sys
+
+
+def get_files_from_fls(f, want_all):
+ '''resolve the names in the recorded list of files
+ and return a deduplicated, sorted list
+ '''
+ pwd = None
+ files = []
+ for line in f.read_text().splitlines():
+ key, name = line.split(None, 1)
+ if key == "PWD":
+ pwd = pathlib.Path(name)
+ continue
+
+ if name.startswith("."):
+ f = pwd / name
+ elif want_all:
+ f = pathlib.Path(name)
+ else:
+ continue
+
+ f = f.resolve()
+
+ if not f.is_file():
+ continue
+
+ if f.suffix in ('.aux', '.toc', '.log', '.maf'):
+ continue
+
+ if f.suffix.startswith('.mtc'):
+ continue
+
+ files.append(f)
+
+ return sorted(set(files))
+
+
+def get_source_files_for_pdfs(files):
+ '''Heuristically find the MP source for a PDF
+ '''
+ mp_source = []
+ for p in files:
+ # only PDFs...
+ if p.suffix != '.pdf':
+ continue
+
+ # but not the main PDF
+ if p.name == file_record.with_suffix('.pdf').name:
+ continue
+
+ pdfbytes = p.read_bytes()
+
+ if b'LuaTeX' in pdfbytes:
+ mp = p.with_suffix('.mp')
+ tex = p.with_suffix('.tex')
+ if mp.is_file():
+ mp_source.append(mp)
+ elif tex.is_file():
+ mp_source.append(tex)
+ else:
+ print(f'No source found for {p} (Luatex)', file=sys.stderr)
+
+ elif b'MetaPost' in pdfbytes:
+ mp_multi = pathlib.Path(p.stem[:-1]).with_suffix('.mp')
+ mp_single = p.with_suffix('.mp')
+ if mp_multi.is_file():
+ mp_source.append(mp_multi)
+ elif mp_single.is_file():
+ mp_source.append(mp_single)
+ else:
+ print(f'No source found for {p} (Plain MP)', file=sys.stderr)
+
+ else:
+ print(f'No source found for {p} (??)', file=sys.stderr)
+
+ mp_includes = []
+ for f in mp_source:
+ for line in f.read_text().splitlines():
+ if line.startswith("input "):
+ mp = f.with_stem(line.split()[1])
+ if mp.is_file():
+ mp_includes.append(mp)
+
+ return sorted(set(mp_source + mp_includes))
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument("file_record", help="TeX .FLS file")
+ parser.add_argument("--all", action="store_true",
+ help="Also files from /texmf")
+ parser.add_argument("--mp", action="store_true",
+ help="Also MP source files ")
+ args = parser.parse_args()
+
+ file_record = pathlib.Path(args.file_record).with_suffix(".fls")
+ # using with_suffix allows you to default to the tex name or no extension
+ # at all
+
+ if not file_record.is_file():
+ print("Cannot see", file_record, file=sys.stderr)
+ sys.exit(1)
+
+ file_record_mtime = file_record.stat().st_mtime
+
+ files = get_files_from_fls(file_record, args.all)
+ if args.mp:
+ files.extend(get_source_files_for_pdfs(files))
+
+ files = sorted(set(files))
+
+ need_to_recompile = False
+ for f in files:
+ if f.suffix in ('.tex', '.mp'):
+ if f.stat().st_mtime > file_record_mtime:
+ print(f, "has been updated since .FLS was created",
+ file=sys.stderr)
+ need_to_recompile = True
+
+ if need_to_recompile:
+ print("Please recompile with -recorder", file=sys.stderr)
+ sys.exit(1)
+
+ for f in files:
+ print(f)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/listex.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/little-hexagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/little-hexagon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/little-hexagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,9 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
- draw for i=0 upto 5: 20 dir 60i -- endfor cycle;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/little-hexagon.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/magic-square-14.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/magic-square-14.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/magic-square-14.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,40 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-beginfig(1);
-z1 = (10,10);
-z4 = 144 right rotated 12;
-z5 = z4 shifted (2, 78);
-z7 = z4 reflectedabout(origin, (1,1));
-
-z2 = 1/2 [z5, z7];
-z9 = whatever [z1, z4];
-z2-z9 = whatever * (z7-z1);
-z8 = whatever [z1, z5] = whatever [z2, z4];
-z3 = whatever [z2, z9] = whatever [z4, z7];
-z6 = whatever [z1, z7] = whatever [z3, z5];
-
-drawoptions(dashed withdots scaled 1/4 withcolor Blues 7 7);
-draw z1 -- z4 -- z7 -- z1 -- z5 -- z6;
-draw z4 -- z2 -- z9;
-draw z5 -- z7;
-drawoptions();
-
-for i=1 upto 9:
- fill fullcircle scaled 12 shifted z[i] withcolor Blues 7 2;
- draw fullcircle scaled 12 shifted z[i] withcolor Blues 7 7;
- label("\textsf{" & decimal i & "}", z[i]);
-endfor
-
-for i=1 upto 2:
- draw (50i, 0) -- (50i, 150) dashed withdots scaled 1/4 withcolor Reds 7 7;
- draw (0, 50i) -- (150, 50i) dashed withdots scaled 1/4 withcolor Reds 7 7;
-endfor
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/magic-square-14.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo-with-grid.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,32 +0,0 @@
-\documentclass[border=1mm]{standalone}
-\usepackage{luamplib}
-\usepackage{graphicx}
-\usepackage{fontspec}\setmainfont[Scale=0.6]{Helvetica}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-draw btex \includegraphics[width=5in]{glenshiel.jpg} etex;
-if false:
-for i=1 upto 36:
- draw (origin -- 180 up) shifted (10i, 0) withcolor if i mod 10 = 0: red else: 1/2 fi;
-endfor
-for i=1 upto 18:
- draw (origin -- 360 right) shifted (0, 10i) withcolor if i mod 10 = 0: red else: 1/2 fi;
-endfor
-fi
-vardef callout@#(expr t, p, o) =
- save T; picture T; T = thelabel.@#(t, p+o);
- draw T; drawarrow p+o -- p cutbefore bbox T;
-enddef;
-ahangle := 20; ahlength := 2; drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 blue);
-callout.top("Sgurr na Ciste Dubhe", (80, 96), (-10, 20));
-callout.top("Sgurr nan Spainteach", (100, 91), (6, 12));
-label.top("\tiny Cuillin Ridge, Isle of Skye", (140, 81));
-label.top("Sgurr na Carnach", (190, 90));
-label.top("Sgurr Fhuaran", (282, 94));
-label.bot("\itshape View looking west from the summit of Saileag – 19 April 2005", point 5/2 of bbox currentpicture shifted 4 down);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/marked-up-photo.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-pitfall.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-pitfall.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-pitfall.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,27 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-pair a,b;
-a = 42 up; b = 72 right;
-beginfig(1);
-
-draw (-1/4)[origin,b]--5/4[origin,b] withcolor .8 white;
-draw (-1/4)[origin,a]--5/4[origin,a] withcolor .8 white;
-
-draw (-1)[a,b]--a dashed evenly;
-draw a--b withcolor .67 red;
-draw b--2[a,b] dashed evenly;
-
-dotlabel.urt(btex $a$ etex, a);
-dotlabel.urt(btex $b$ etex, b);
-dotlabel.urt(btex ${1\over2}[a,b]$ etex, 1/2[a,b]);
-dotlabel.urt(btex $\left(-{1\over2}\right)[a,b]$ etex, (-1/2)[a,b]);
-dotlabel.llft(btex $-{1\over2}[a,b]$ etex, -1/2[a,b]);
-label(btex Probably not what was intended\dots etex, -1/2[a,b] shifted (0,-24)) withcolor .58 blue;
-dotlabel.urt(btex ${3\over2}[a,b]$ etex, (3/2)[a,b]);
-dotlabel.lrt(btex $(0,0)$ etex, origin);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-pitfall.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-sallows.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-sallows.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-sallows.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,44 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(3);
-path t; t = (0,0) -- (220,42) -- (180,-90) -- cycle;
-pair centroid;
-centroid = 2/3[point 0 of t,point 3/2 of t];
-
-path s[];
-for i=0 upto 5:
- s[i] = point 1/2 i of t -- point 1/2 + 1/2 i of t -- centroid -- cycle;
-endfor
-
-color c[];
-c[0] = (1,0.96863,0.73725);
-c[1] = (0.99608,0.76863,0.3098);
-c[2] = (0.85098,0.37255,0.054902);
-
-picture a,b;
-a = image(
-for i=0 upto 2:
- fill s[2i] withcolor .6[c[i],white];
- fill s[2i+1] withcolor .4[c[i],white];
-endfor
-for i=0 upto 2:
-draw point i of t -- point 3/2+i of t;
-endfor
-draw t;);
-b = image(
-for i=0 upto 2:
- fill s[2i] withcolor .6[c[i],white];
- fill s[2i+1] rotatedabout(point i+1/2 of t, 180) withcolor .4[c[i],white];
-endfor
-for i=0 upto 2:
- draw point i of t -- centroid -- centroid rotatedabout(point i+1/2 of t,180) -- cycle;
-endfor
-draw t;);
-draw a;
-draw b shifted 222 right;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-sallows.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-shapes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-shapes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-shapes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,29 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-pair a,b;
-a = 42 up; b = 72 right;
-path t,s,p,c;
-t = origin--a--b--cycle;
-s = unitsquare scaled 40 shifted 92 right;
-p = (for i=0 upto 4: down scaled 21 rotated 72i -- endfor cycle)
- shifted 180 right shifted 21 up;
-c = fullcircle scaled 42 shifted 250 right shifted 21 up;
-
-beginfig(2);
-forsuffixes $=t,s,p,c:
- draw $;
- draw point 0 of $ -- point 1/2 length $ of $
- dashed withdots scaled 1/3
- withcolor .67 red;
-endfor
-label.bot("\textsl{Dotted lines drawn with}: \mpl{point 0 of p -- point 1/2 length p of p}",
- point 1/2 of bbox currentpicture);
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/mediation-shapes.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/minus.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/minus.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/minus.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,19 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-
- u = 8mm;
- defaultfont := "texnansi-lmr10";
- string minus_sign;
- minus_sign := char 12; % if you are using the 8r encoding
- minus_sign := char 143; % if you are using the texnansi encoding
- for x=-3 upto 3: label(decimal x, (x*u,+9)) withcolor .67 red; endfor
- for x=-3 upto 3: label(if x<0: minus_sign & fi decimal abs(x), (x*u,-5)) withcolor .58 blue; endfor
- label.lft("with plain decimal:" infont "texnansi-lmss10" scaled 0.9, (-3.6u,9)) withcolor .67 red;
- label.lft("with this hack:" infont "texnansi-lmss10" scaled 0.9, (-3.6u,-5)) withcolor .58 blue;
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/minus.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/multi-line-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/multi-line-labels.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/multi-line-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,23 +0,0 @@
-\documentclass[border=0mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-label("\vbox{\hsize 4in It is a truth universally acknowledged,"
- & " that a single man in possession of a good fortune,"
- & " must be in want of a wife.\par}", origin);
-label(btex \vbox{\hsize 4in
- It is a truth universally acknowledged,
- that a single man in possession of a good fortune,
- must be in want of a wife.
- \par} etex, 128 down);
-label(btex
- \begin{tabular}{c}
- A way to get simple\\
- two line labels
- \end{tabular} etex, 256 down);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/multi-line-labels.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels-tte.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels-tte.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels-tte.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,24 +5,24 @@
\mplibtextextlabel{enable} % <-- added option
\begin{document}
\begin{mplibcode}
- beginfig(1);
- for x = 0 upto 1:
- draw (80x,16) -- (80x, -68) withcolor 3/4[red, white];
- endfor
- for y = 0 upto 3:
- draw (0, -20y) -- (160, -20y) withcolor 3/4[red, white];
- endfor
+beginfig(1);
+ for x = 0 upto 1:
+ draw (80x,16) -- (80x, -68) withcolor 3/4[red, white];
+ endfor
+ for y = 0 upto 3:
+ draw (0, -20y) -- (160, -20y) withcolor 3/4[red, white];
+ endfor
- string s; s = "Hand gloves";
- draw s infont defaultfont shifted (0, 0);
- draw s infont "phvr8r" shifted (0, -20);
- draw TEX(s) shifted (0, -40);
- draw btex Hand gloves etex shifted (0, -60);
+ string s; s = "Hand gloves";
+ draw s infont defaultfont shifted (0, 0);
+ draw s infont "phvr8r" shifted (0, -20);
+ draw TEX(s) shifted (0, -40);
+ draw btex Hand gloves etex shifted (0, -60);
- dotlabel.urt(s, (80, 0));
- dotlabel.urt(s infont "phvr8r", (80, -20));
- dotlabel.urt(TEX(s), (80, -40));
- dotlabel.urt(btex Hand gloves etex, (80, -60));
- endfig;
+ dotlabel.urt(s, (80, 0));
+ dotlabel.urt(s infont "phvr8r", (80, -20));
+ dotlabel.urt(TEX(s), (80, -40));
+ dotlabel.urt(btex Hand gloves etex, (80, -60));
+endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,24 +4,24 @@
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
- beginfig(1);
- for x = 0 upto 1:
- draw (80x,16) -- (80x, -68) withcolor 3/4[red, white];
- endfor
- for y = 0 upto 3:
- draw (0, -20y) -- (160, -20y) withcolor 3/4[red, white];
- endfor
+beginfig(1);
+ for x = 0 upto 1:
+ draw (80x,16) -- (80x, -68) withcolor 3/4[red, white];
+ endfor
+ for y = 0 upto 3:
+ draw (0, -20y) -- (160, -20y) withcolor 3/4[red, white];
+ endfor
- string s; s = "Hand gloves";
- draw s infont defaultfont shifted (0, 0);
- draw s infont "phvr8r" shifted (0, -20);
- draw TEX(s) shifted (0, -40);
- draw btex Hand gloves etex shifted (0, -60);
+ string s; s = "Hand gloves";
+ draw s infont defaultfont shifted (0, 0);
+ draw s infont "phvr8r" shifted (0, -20);
+ draw TEX(s) shifted (0, -40);
+ draw btex Hand gloves etex shifted (0, -60);
- dotlabel.urt(s, (80, 0));
- dotlabel.urt(s infont "phvr8r", (80, -20));
- dotlabel.urt(TEX(s), (80, -40));
- dotlabel.urt(btex Hand gloves etex, (80, -60));
- endfig;
+ dotlabel.urt(s, (80, 0));
+ dotlabel.urt(s infont "phvr8r", (80, -20));
+ dotlabel.urt(TEX(s), (80, -40));
+ dotlabel.urt(btex Hand gloves etex, (80, -60));
+endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-labels.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,11 @@
+\documentclass[border=1mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+undraw unitsquare xscaled 360 yscaled 178;
+input neo-reference-grid
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo-grid.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,27 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{graphicx}
+\usepackage{fontspec}\setmainfont[Scale=0.6]{Helvetica}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+draw btex \includegraphics[width=5in]{glenshiel.jpg} etex;
+% input neo-reference-grid
+vardef callout@#(expr t, p, o) =
+ save T; picture T; T = thelabel.@#(t, p+o);
+ draw T; drawarrow p+o -- p cutbefore bbox T;
+enddef;
+ahangle := 20; ahlength := 2;
+drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 blue);
+callout.top("Sgurr na Ciste Dubhe", (80, 96), (-10, 20));
+callout.top("Sgurr nan Spainteach", (100, 91), (6, 12));
+label.top("\tiny Cuillin Ridge, Isle of Skye", (140, 81));
+label.top("Sgurr na Carnach", (190, 90));
+label.top("Sgurr Fhuaran", (282, 94));
+label.bot("\textit{Looking west from the summit of Saileag} – 19 April 2005",
+ point 5/2 of bbox currentpicture shifted 4 down);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-marked-up-photo.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,21 @@
+\documentclass[border=0mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+label("\vbox{\hsize 4in It is a truth universally acknowledged,"
+ & " that a single man in possession of a good fortune,"
+ & " must be in want of a wife.\par}", origin);
+label(btex \vbox{\hsize 4in\noindent
+ \textsc{It is a truth} universally acknowledged,
+ that a single man in possession of a good fortune,
+ must be in want of a wife.\par} etex, 128 down);
+label(btex \begin{tabular}{c}
+ A way to get simple\\
+ two line labels
+ \end{tabular} etex, 270 down);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-multi-line-labels.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-reference-grid.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-reference-grid.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-reference-grid.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,15 @@
+% Adds a reference grid, sized to the contents of currentpicture
+% useful for marking up external images etc
+begingroup;
+ save llx, lly, urx, ury, u; u = 10;
+ (llx, lly) = llcorner currentpicture;
+ (urx, ury) = urcorner currentpicture;
+ drawoptions(withpen pencircle scaled 1/4);
+ for x = ceiling (llx / u) upto floor (urx / u):
+ draw (x*u, lly) -- (x*u, ury) withcolor if x mod u = 0: red else: 1/2 fi;
+ endfor
+ for y = ceiling (lly / u) upto floor (ury / u):
+ draw (llx, y*u) -- (urx, y*u) withcolor if y mod u = 0: red else: 1/2 fi;
+ endfor
+ drawoptions();
+endgroup;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-reference-grid.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,16 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path P; P = for i=0 upto 8: 50 dir 40i -- endfor cycle;
+draw P withcolor 2/3 red;
+for i=1 upto length P:
+ draw point i of P withpen pencircle scaled dotlabeldiam;
+ label("$p_{" & decimal i & "}$", point i of P scaled 1.2);
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-circle-labels.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,14 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+labeloffset := 5;
+draw (left--right) scaled 2in withcolor 2/3 red;
+for i=-4 upto 4:
+ dotlabel.bot("$" & decimal i & "$", (32i, 0));
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-simple-number-line.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,25 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\usepackage{fontspec} \newfontface\polytonic{GFS Porson}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+label("café noir £2.50", origin);
+label(btex \vbox{\hsize 4in
+ Nous étions à l'Étude, quand le Proviseur entra, suivi d'un
+ \textit{nouveau} habillé en bourgeois et d'un garçon de classe
+ qui portait un grand pupitre. Ceux qui dormaient se réveillèrent,
+ et chacun se leva comme surpris dans son travail.
+\par} etex, 60 down);
+label(btex \vbox{\polytonic\halign{#\hfil\cr
+μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος\cr
+οὐλομένην, ἣ μυρί᾽ Ἀχαιοῖς ἄλγε᾽ ἔθηκε,\cr
+πολλὰς δ᾽ ἰφθίμους ψυχὰς Ἄϊδι προΐαψεν\cr
+ἡρώων, αὐτοὺς δὲ ἑλώρια τεῦχε κύνεσσιν\cr
+οἰωνοῖσί τε πᾶσι, Διὸς δ᾽ ἐτελείετο βουλή,\cr
+ἐξ οὗ δὴ τὰ πρῶτα διαστήτην ἐρίσαντε\cr
+Ἀτρεΐδης τε ἄναξ ἀνδρῶν καὶ δῖος Ἀχιλλεύς.\cr}} etex, 220 down);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/neo-unicode.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,35 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{dwmpcode}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+def withalpha expr a =
+ withprescript "tr_alternative=2"
+ withprescript "tr_transparency=" & decimal a
+enddef;
+beginfig(1);
+path r, g, b; r = fullcircle scaled 48 shifted 12 up; g = r rotated 120; b = g rotated 120;
+picture P[];
+
+for i=0 upto 7:
+ numeric a; a = 1/8 + i/8;
+ P[i] = image(
+ fill r withcolor 1/2[white, red] withalpha a;
+ fill g withcolor 1/2[white, green] withalpha a;
+ fill b withcolor 1/2[white, blue] withalpha a;
+ draw r withcolor 1/2;
+ draw g withcolor 1/2;
+ draw b withcolor 1/2;
+ label.bot(TEX("\mpl{withalpha " & decimal a & "}") scaled 0.8, point 1/2 of bbox currentpicture);
+ );
+endfor
+
+for i=0 upto 7:
+ draw P[i] shifted 120(i div 4, -(i mod 4)) ;
+endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-transparency.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,46 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+def withalpha expr a =
+ withprescript "tr_alternative=2"
+ withprescript "tr_transparency=" & decimal a
+enddef;
+beginfig(1);
+ numeric u; u = 24; color shade[]; string name[];
+ shade0 = 1/256(166, 57, 65); name0 = "R"; % rouge
+ shade1 = 1/256(219, 170, 72); name1 = "J"; % jaune
+ shade2 = 1/256(36, 54, 84); name2 = "B"; % bleu
+ path edge[], arc[], ring[];
+ for r=1 upto 8:
+ edge[r] = fullcircle rotated 90 scaled (2r * u)
+ shifted (0, 7u / sqrt 3) rotated 120;
+ endfor
+ for i=2 upto 8:
+ edge[i] := edge[i] cutbefore edge8 rotated 120
+ cutafter edge8 rotated -120;
+ endfor
+ arc0 = point 0 of edge1 for i=2 upto 7: .. point 0 of edge[i] endfor;
+ arc1 = point 0 of edge1 for i=2 upto 7: .. point infinity of edge[i] endfor;
+ for i=1 upto 7:
+ ring[i] = edge[i] -- subpath (i-1, i) of arc1 --
+ reverse edge[i+1] -- subpath (i, i-1) of arc0 -- cycle;
+ endfor
+ for r=0, 1, 2: for i=1 upto 6: % fills first
+ fill ring[i] rotated 120r withcolor (i/6)[white, shade[r]] withalpha 0.9;
+ for k=0, 1:
+ label("$\textsf{" & name[r] & "}" if i<6: & "_" & decimal i fi & "$",
+ point i-1/2 of arc[k] shifted (-8,-2) rotated 120r);
+ endfor
+ endfor endfor
+ for r=0, 1, 2: % now lines on top
+ for i=1 upto 7:
+ draw edge[i] rotated 120r withpen pencircle scaled 1 withcolor 7/8;
+ endfor
+ draw arc0 rotated 120r; draw arc1 rotated 120r;
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/new-fangled-trilobe.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/nine-point-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/nine-point-circle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/nine-point-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,54 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- pair A, B, C, D, N, M, p, q, r;
- A = origin; B = 377 dir 10; C = 233 dir 70;
- % pedal points
- p = whatever[B, C]; A - p = whatever * (B-C) rotated 90;
- q = whatever[C, A]; B - q = whatever * (C-A) rotated 90;
- r = whatever[A, B]; C - r = whatever * (A-B) rotated 90;
-
- D = whatever[A, p] = whatever[B, q];
- N = 1/4(A + B + C + D);
- M = D rotatedabout(N, 180); % M is also the circumcentre
-
- path circumcircle, nine_point_circle;
- nine_point_circle = fullcircle scaled 2 abs(N - 1/2[A, B]) shifted N;
- circumcircle = fullcircle scaled 2 abs(M - A) shifted M;
-
- draw nine_point_circle withcolor 3/4 red;
- draw circumcircle withcolor 1/2[3/4 blue, white];
-
- drawoptions(dashed evenly scaled 1/4 withcolor 1/2);
- draw 1/2[A,B] -- M -- 1/2[B, C];
- draw 1/2[C,A] -- M -- D;
- draw A -- p;
- draw B -- q;
- draw C -- r;
-
- drawoptions(withpen pencircle scaled 1/4);
- draw fullcircle scaled 2 shifted 1/2[A, B];
- draw fullcircle scaled 2 shifted 1/2[A, C];
- draw fullcircle scaled 2 shifted 1/2[A, D];
- draw fullcircle scaled 2 shifted 1/2[B, C];
- draw fullcircle scaled 2 shifted 1/2[B, D];
- draw fullcircle scaled 2 shifted 1/2[C, D];
- draw fullcircle scaled 2 shifted p;
- draw fullcircle scaled 2 shifted q;
- draw fullcircle scaled 2 shifted r;
-
- drawoptions();
- draw A--B--C--cycle;
- dotlabel.llft("$A$", A);
- dotlabel.rt("$B$", B);
- dotlabel.ulft("$C$", C);
- dotlabel.urt("\ $D$", D);
- dotlabel.llft("$M$", M);
- dotlabel.llft("$N$", N);
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/nine-point-circle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/numbered-axes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/numbered-axes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/numbered-axes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,27 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- numeric u, v; u = 40; v = 29;
- path xx, yy;
- xx = (3/2 left -- 5 right) scaled u;
- yy = (3/2 down -- 4 up) scaled v;
- for x=-1, 1, 2, 3, 4:
- draw yy shifted (x * u, 0) withcolor 7/8; % grid
- draw (down--up) shifted (x * u, 0); % ticks
- label("$" & decimal x & "$", (x * u, -8));
- endfor
- for y=-1, 1, 2, 3:
- draw xx shifted (0, y * v) withcolor 7/8; % grid
- draw (left--right) shifted (0, y * v); % ticks
- label("$" & decimal y & "$", (-10, y * v));
- endfor
- drawarrow xx; label.rt("$x$", point 1 of xx);
- drawarrow yy; label.top("$y$", point 1 of yy);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/numbered-axes.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/open-triangle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/open-triangle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/open-triangle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,22 +0,0 @@
-\documentclass{standalone}
-\usepackage{dwmpcode}
-\usepackage{luamplib}
-\mplibtextextlabel{enable}
-\begin{document}
-\begin{mplibcode}
-beginfig(1);
-ahangle := 30;
-path xx, yy; xx = left scaled 8 -- right scaled 89; yy = down scaled 8 -- up scaled 55;
-path u; u = origin {right} .. (55,0) .. (55,34) .. {-2, -1} origin;
-drawarrow xx withcolor .67 white;
-drawarrow yy withcolor .67 white;
-drawarrow u cutafter fullcircle scaled 4;
-dotlabeldiam := 2;
-dotlabel.urt("$\scriptstyle (55,34)$", point 2 of u);
-dotlabel.lrt("$\scriptstyle (55,0)$", point 1 of u);
-dotlabel.llft("$\scriptstyle (0,0)$", point 0 of u);
-label.bot(TEX("\mpl{drawarrow u cutafter fullcircle scaled 4};") scaled 0.8,
-point 1/2 of bbox currentpicture shifted 13 down);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/open-triangle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-default-fillers.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-default-fillers.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-default-fillers.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,42 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(3);
- path A, B; picture p[];
- A = fullcircle scaled 2.5cm;
- B = fullcircle scaled 1.8cm shifted (1cm,0);
- p1 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p2 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- B := B rotatedabout(center B,180);
- p3 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p4 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- B := B rotatedabout(center B, 180);
- A := reverse A;
- p5 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p6 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- B := B rotatedabout(center B,180);
- p7 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p8 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
-
- for i=1 upto 4: draw p[i] scaled .75 shifted (80i, 0); label(decimal i, (5mm+80i,0)); endfor
- for i=1 upto 4: draw p[i+4] scaled .75 shifted (80i,-68); label(decimal (4+i), (5mm+80i,-68)); endfor
-
- picture L;
- L = image(
- for i=0 upto 3: fill unitsquare scaled 2 shifted (1/2,1/2) rotated (45+90i); endfor
- label.rt("\small To rotate a circular path, you can use: \mpl{p rotatedaround(center p, 180)}",
- 3 right);
- );
- label(L, point 1/2 of bbox currentpicture shifted 21 down);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-default-fillers.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-missing-filler.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-missing-filler.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-missing-filler.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,16 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(2);
- path A, B;
- A = fullcircle scaled 2.5cm;
- B = fullcircle scaled 1.8cm shifted (1cm,0);
- fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;
- label.rt(btex Where has the fill colour gone? etex, point 0 of B shifted (1cm,0));
- label.ulft(btex $A$ etex, point 3 of A);
- label.urt(btex $B$ etex, point 1 of B);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps-missing-filler.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,97 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-% is point "p" inside cyclic path "ring" ?
-vardef inside(expr p, ring) =
- save t, count, test_line;
- count := 0;
- path test_line;
- test_line = p -- (infinity, ypart p);
- for i = 1 upto length ring:
- t := xpart (subpath(i-1,i) of ring intersectiontimes test_line);
- if ((0 <= t) and (t<1)): count := count + 1; fi
- endfor
- odd(count)
- enddef;
-
-vardef front_half primary p = subpath(0, 1/2 length p) of p enddef;
-vardef back_half primary p = subpath(1/2 length p, length p) of p enddef;
-
-% a and b should be cyclic paths...
-vardef xoverlap(expr a, b) =
- boolean p, q;
- p = inside(point 0 of a, b);
- q = inside(point 0 of b, a);
- if ((not p) and (not q)):
- buildcycle(a,b)
- elseif (not p):
- buildcycle(front_half b, a, back_half b)
- elseif (not q):
- buildcycle(front_half a, b, back_half a)
- else:
- buildcycle(front_half a, back_half b, front_half b, back_half a)
- fi
- enddef;
-
-vardef xcombine(expr a, b) =
- boolean p, q;
- p = inside(point 0 of a, b);
- q = inside(point 0 of b, a);
- if (p and q):
- buildcycle(a,b)
- elseif p:
- buildcycle(front_half b, a, back_half b)
- elseif q:
- buildcycle(front_half a, b, back_half a)
- else:
- buildcycle(front_half a, back_half b, front_half b, back_half a)
- fi
- enddef;
-
-vardef overlap(expr a, b) =
- save p, q, A, B;
- boolean p, q;
- p = not inside(point 0 of a, b);
- q = not inside(point 0 of b, a);
- path A, B;
- A = counterclockwise a;
- B = counterclockwise b;
- if (p and q):
- buildcycle(A,B)
- elseif p:
- buildcycle(front_half B, A, back_half B)
- elseif q:
- buildcycle(front_half A, B, back_half A)
- else:
- buildcycle(front_half A, back_half B, front_half B, back_half A)
- fi
- enddef;
-
-beginfig(4);
- path A, B; picture p[];
- A = fullcircle scaled 2.5cm;
- B = fullcircle scaled 1.8cm shifted (1cm,0);
- p1 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p2 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- B := B rotatedabout(center B,180);
- p3 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p4 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- B := B rotatedabout(center B, 180);
- A := reverse A;
- p5 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p6 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- B := B rotatedabout(center B,180);
- p7 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
- A := A rotated 180;
- p8 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
-
- for i=1 upto 4: draw p[i] scaled .75 shifted (80i, 0); label(decimal i, (5mm+80i,0)); endfor
- for i=1 upto 4: draw p[i+4] scaled .75 shifted (80i,-68); label(decimal (4+i), (5mm+80i,-68)); endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/overlaps.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,47 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef zinverse(expr z) = 1/abs z * dir - angle z enddef;
+vardef zsqrt(expr z) =
+ if abs z > 0: sqrt(abs z) * dir 1/2 angle fi z
+enddef;
+
+z1 = 0.8 dir 148; z2 = 1.5 dir 60; z3 = 1.0 dir 42;
+
+input colorbrewer-rgb
+numeric u; u = 42; ahangle := 30;
+picture axes; axes = image(
+ path xx, yy; xx = (left--right) scaled 1.2 u; yy = xx rotated 90;
+ draw fullcircle scaled 2u;
+ drawarrow xx; label.rt("$\Re$", point 1 of xx);
+ drawarrow yy; label.top("$\Im$", point 1 of yy);
+);
+vardef connect(expr a, b, shade) =
+ save A, B; pair A, B; A = a scaled u; B = b scaled u;
+ drawarrow A -- origin -- B
+ cutafter fullcircle scaled 5 shifted B withcolor shade;
+ draw A withpen pencircle scaled dotlabeldiam;
+ draw B withpen pencircle scaled dotlabeldiam;
+ draw B withpen pencircle scaled 2/3 dotlabeldiam withcolor white;
+enddef;
+picture P[];
+P1 = image(draw axes withcolor 3/4;
+ label.lrt("\small\texttt{zinverse()}", ulcorner axes shifted 10 left);
+ connect(z1, zinverse(z1), SetTwo 7 3);
+ connect(z2, zinverse(z2), SetTwo 7 4);
+ connect(z3, zinverse(z3), SetTwo 7 5);
+);
+P2 = image(draw axes withcolor 3/4;
+ label.lrt("\small\texttt{zsqrt()}", ulcorner axes);
+ connect(z1, zsqrt(z1), SetTwo 7 3);
+ connect(z2, zsqrt(z2), SetTwo 7 4);
+ connect(z3, zsqrt(z3), SetTwo 7 5);
+);
+beginfig(1);
+ labeloffset := 12; label.lft(P1, origin); label.rt(P2, origin);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-inverse-and-sqrt.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,32 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ numeric u; u = 1cm;
+ z1 = 2 dir 15; z2 = 1.2 dir 60;
+ z3 = z1+z2; z4 = z1 zscaled z2; z5 = (x1,-y1);
+ drawoptions(withcolor 2/3 white);
+ draw (1/2 left -- 3 right) scaled u ;
+ draw (1/2 down -- 3 up ) scaled u ;
+ draw subpath (0,3) of fullcircle scaled 2u rotated -22.5;
+ drawoptions();
+ dotlabel.lrt (btex $\scriptstyle 1$ etex, (u,0));
+ dotlabel.ulft(btex $\scriptstyle i$ etex, (0,u));
+ interim ahangle := 30;
+ forsuffixes @=1,2,3,4,5:
+ x@ := x@ * u; y@ := y@ * u;
+ drawarrow origin -- z@
+ cutafter fullcircle scaled 5 shifted z@
+ withcolor 2/3 if @ < 3: blue else: red fi;
+ endfor
+ fill fullcircle scaled dotlabeldiam;
+ dotlabel.rt (btex $A$ etex, z1);
+ dotlabel.urt(btex $B$ etex, z2);
+ dotlabel.top(btex $A+B$ etex, z3);
+ dotlabel.top(btex $A \times B$ etex, z4);
+ dotlabel.rt (btex $\bar{A}$ etex, z5);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-complex-operators.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,44 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\mplibnumbersystem{double}
+\begin{mplibcode}
+vardef fizz(expr X) =
+ pair m, n; m = right; n = origin;
+ numeric x; x = X;
+ forever:
+ exitif x = 0;
+ m := m zscaled (-1/2, -1/2);
+ if odd x:
+ n := n + m;
+ fi
+ x := x div 2;
+ endfor
+ n
+enddef;
+beginfig(1);
+ numeric s, t; s = 256; t = 4;
+ for n=0 upto (s/t*s/t-1):
+ draw fizz(n) scaled s
+ withpen pencircle scaled t
+ withcolor ((7+n mod 8)/16)[1/2 blue, white];
+ endfor;
+ path xx, yy;
+ xx = (left--right) scaled (s+8);
+ yy = xx rotated 90;
+ for i=-1 upto 1:
+ draw xx shifted (0, s*i) withpen pencircle scaled 1/8;
+ draw yy shifted (s*i, 0) withpen pencircle scaled 1/8;
+ if i=0:
+ dotlabel.lrt("$-i$", (i, -1) scaled s);
+ dotlabel.lrt("$+i$", (i, +1) scaled s);
+ else:
+ dotlabel.lrt("$" & decimal i & "-i$", (i,-1) scaled s);
+ dotlabel.lrt("$" & decimal i & "$", (i, 0) scaled s);
+ dotlabel.lrt("$" & decimal i & "+i$", (i, 1) scaled s);
+ fi
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-double-dragon.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,33 @@
+\documentclass[border=2mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+beginfig(1);
+path xx, yy, ff;
+xx = origin -- 233 right;
+yy = origin -- 144 up;
+
+z1 = (72, 62);
+z2 = (180, 110);
+
+ff = (xpart point 0 of xx, ypart point 0 of yy) {dir 76}
+ .. z1 {dir 64} .. z2 {dir 64} .. (xpart point 1 of xx, ypart point 1 of yy) {dir 30};
+
+draw ff withcolor 0.54 red;
+drawarrow xx;
+drawarrow yy;
+forsuffixes $=1,2:
+ draw (0, y$) -- z$ -- (x$,0) dashed evenly withcolor 1/2;
+ dotlabel.lft("\texttt{(0,y" & decimal $ & ")}", (0, y$));
+ dotlabel.bot("\texttt{(x" & decimal $ & ",0)}", (x$, 0));
+ dotlabel.rt("$z_" & decimal $ & "$", z$);
+endfor
+
+
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-function.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,25 @@
+\documentclass[border=0mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ numeric u; u = 72;
+ for x = -2u step 1/8 until 2u:
+ drawdot (x, normaldeviate * 1/2u) withpen pencircle scaled 2;
+ endfor
+ path c;
+ c = fullcircle scaled u shifted (u, 1/2u);
+ picture P; P = currentpicture; clip P to c;
+ draw c withcolor .54 red;
+ draw P withcolor .84 red;
+
+ picture B; B = currentpicture;
+ path S;
+ S = unitsquare shifted (-1/2, -1/2) scaled 4u;
+ fill S withcolor (1,1,31/32); draw S; clip B to S; draw B;
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pairs-random-selection.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/parallel.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/parallel.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/parallel.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,48 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- z0 = origin;
- z1 = 333 dir -18;
- z2 = 104 dir 45;
- z3 = 233 dir 34;
- z4 = 166 dir 12;
-
- z5 = whatever[z0, z1];
- z6 = whatever[z0, z1];
- z7 = whatever[z0, z1];
-
- z5 - z4 = whatever * (z3 - z2);
- z6 - z4 = whatever * (z3 - z2) rotated 90;
- z7 - z4 = whatever * (z1 - z0) rotated 90;
-
- z9 = whatever [z2,z3] = whatever [z4,z6];
-
- numeric t, u, o;
- t = abs(z4-z5);
- u = abs(z6-z7);
- o = 12;
- drawoptions(withpen pencircle scaled 1/4 withcolor 1/2 white);
- draw unitsquare scaled 5 rotated angle (z6 - z4) shifted z9;
- draw unitsquare scaled 5 rotated angle (z4 - z6) shifted z4;
- draw (1+o/t)[z5,z4] -- (1+o/t)[z4,z5];
- draw (1+o/t)[z9,z6] -- (1+o/t)[z6,z9];
- drawoptions();
-
- draw z0--z1;
- draw z2--z3;
-
- interim labeloffset := 6;
- forsuffixes $=0,1,2,3,4,5,6,7:
- dotlabel.top("$\;\;" & char ($ + ASCII "A") & "$", z$)
- if $=5: withcolor 2/3 red fi
- if $=6: withcolor 2/3 blue fi
- if $=7: withcolor 1/2 green fi
- ;
- endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/parallel.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,24 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+\mplibtextextlabel{enable}
+vardef antireuleaux(expr n, r) =
+ save a; numeric a; a = 90/n;
+ for t = 0 step 4a until 359:
+ (0, r) rotated t {left rotated (3a + t)} .. {left rotated (a + t)}
+ endfor cycle
+enddef;
+vardef median(expr p) = origin for i=1 upto length p: + point i of p / length p endfor enddef;
+input colorbrewer-rgb
+beginfig(1);
+ for n = 3 upto 7:
+ path p; p = antireuleaux(n, 42) shifted (90n, 0);
+ pair m; m = point (n+1)/2 of p;
+ fill p withcolor if odd n: Oranges else: Blues fi 8 2;
+ draw p;
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-antireuleaux-set.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,38 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+ahangle := 30;
+beginfig(1);
+ numeric u;
+ u = 42;
+ path xx, yy, f;
+ xx = (1/4 left -- 17/4 right) scaled u;
+ yy = (1/4 down -- 9/4 up) scaled u;
+
+ f = ((15/32,32/15) for x = 1/2 step 1/8 until 33/8: .. (x,1/x) endfor) scaled u;
+
+ path A; A = % keep next on it's own line....
+ buildcycle(yy shifted (u,0), f, yy shifted (2.71828u,0), xx)
+ ;
+ fill A withcolor Blues 8 2;
+
+ drawoptions(withcolor 3/4);
+ for x=1 upto 4:
+ draw yy shifted (x*u,0) cutafter (xx shifted (0, ypart point 0 of f));
+ endfor
+ for y=1 upto 2:
+ draw xx shifted (0,y*u) cutafter (yy shifted (xpart point infinity of f,0));
+ endfor
+
+ drawoptions();
+ draw f withcolor Reds 8 7;
+ drawarrow xx;
+ drawarrow yy;
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-area-under-graph.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,19 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+vardef polygon_with_side(expr n, s) =
+ save a, b, r; numeric a, b, r;
+ a * n = 360; a + 2b = 180; r = s * sind(b) / sind(a);
+ for i = 0 upto n-1: (0, r) rotated (a * i) -- endfor cycle
+enddef;
+for n = 11 downto 3:
+ path p; p = polygon_with_side(n, 72);
+ fill p withcolor (n/32)[white, 3/4 if odd n: red else: blue fi];
+ draw p;
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-fixed-polygon.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,9 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ draw for i=0 upto 5: 20 dir 60i -- endfor cycle;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-little-hexagon.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,22 @@
+\documentclass{standalone}
+\usepackage{dwmpcode}
+\usepackage{luamplib}
+\mplibtextextlabel{enable}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ahangle := 30;
+path xx, yy; xx = left scaled 8 -- right scaled 89; yy = down scaled 8 -- up scaled 55;
+path u; u = origin {right} .. (55,0) .. (55,34) .. {-2, -1} origin;
+drawarrow xx withcolor .67 white;
+drawarrow yy withcolor .67 white;
+drawarrow u cutafter fullcircle scaled 4;
+dotlabeldiam := 2;
+dotlabel.urt("$\scriptstyle (55,34)$", point 2 of u);
+dotlabel.lrt("$\scriptstyle (55,0)$", point 1 of u);
+dotlabel.llft("$\scriptstyle (0,0)$", point 0 of u);
+label.bot(TEX("\mpl{drawarrow u cutafter fullcircle scaled 4};") scaled 0.8,
+point 1/2 of bbox currentpicture shifted 13 down);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-open-triangle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,42 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(3);
+ path A, B; picture p[];
+ A = fullcircle scaled 2.5cm;
+ B = fullcircle scaled 1.8cm shifted (1cm,0);
+ p1 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p2 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ B := B rotatedabout(center B,180);
+ p3 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p4 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ B := B rotatedabout(center B, 180);
+ A := reverse A;
+ p5 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p6 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ B := B rotatedabout(center B,180);
+ p7 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p8 = image(fill buildcycle(A,B) withcolor .8[blue,white]; drawarrow A; drawarrow B;);
+
+ for i=1 upto 4: draw p[i] scaled .75 shifted (80i, 0); label(decimal i, (5mm+80i,0)); endfor
+ for i=1 upto 4: draw p[i+4] scaled .75 shifted (80i,-68); label(decimal (4+i), (5mm+80i,-68)); endfor
+
+ picture L;
+ L = image(
+ for i=0 upto 3: fill unitsquare scaled 2 shifted (1/2,1/2) rotated (45+90i); endfor
+ label.rt("\small To rotate a circular path, you can use: \mpl{p rotatedaround(center p, 180)}",
+ 3 right);
+ );
+ label(L, point 1/2 of bbox currentpicture shifted 21 down);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-default-fillers.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,18 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path A, B;
+A = fullcircle scaled 2.5cm;
+B = fullcircle scaled 1.8cm shifted (1cm,0);
+fill buildcycle(A,B) withcolor .8[blue,white];
+drawarrow A;
+drawarrow B;
+label.ulft(btex $A$ etex, point 3 of A);
+label.urt(btex $B$ etex, point 1 of B);
+label.rt(btex Where has the fill colour gone? etex, point 0 of B shifted (1cm,0));
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps-missing-filler.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,97 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+% is point "p" inside cyclic path "ring" ?
+vardef inside(expr p, ring) =
+ save t, count, test_line;
+ count := 0;
+ path test_line;
+ test_line = p -- (infinity, ypart p);
+ for i = 1 upto length ring:
+ t := xpart (subpath(i-1,i) of ring intersectiontimes test_line);
+ if ((0 <= t) and (t<1)): count := count + 1; fi
+ endfor
+ odd(count)
+ enddef;
+
+vardef front_half primary p = subpath(0, 1/2 length p) of p enddef;
+vardef back_half primary p = subpath(1/2 length p, length p) of p enddef;
+
+% a and b should be cyclic paths...
+vardef xoverlap(expr a, b) =
+ boolean p, q;
+ p = inside(point 0 of a, b);
+ q = inside(point 0 of b, a);
+ if ((not p) and (not q)):
+ buildcycle(a,b)
+ elseif (not p):
+ buildcycle(front_half b, a, back_half b)
+ elseif (not q):
+ buildcycle(front_half a, b, back_half a)
+ else:
+ buildcycle(front_half a, back_half b, front_half b, back_half a)
+ fi
+ enddef;
+
+vardef xcombine(expr a, b) =
+ boolean p, q;
+ p = inside(point 0 of a, b);
+ q = inside(point 0 of b, a);
+ if (p and q):
+ buildcycle(a,b)
+ elseif p:
+ buildcycle(front_half b, a, back_half b)
+ elseif q:
+ buildcycle(front_half a, b, back_half a)
+ else:
+ buildcycle(front_half a, back_half b, front_half b, back_half a)
+ fi
+ enddef;
+
+vardef overlap(expr a, b) =
+ save p, q, A, B;
+ boolean p, q;
+ p = not inside(point 0 of a, b);
+ q = not inside(point 0 of b, a);
+ path A, B;
+ A = counterclockwise a;
+ B = counterclockwise b;
+ if (p and q):
+ buildcycle(A,B)
+ elseif p:
+ buildcycle(front_half B, A, back_half B)
+ elseif q:
+ buildcycle(front_half A, B, back_half A)
+ else:
+ buildcycle(front_half A, back_half B, front_half B, back_half A)
+ fi
+ enddef;
+
+beginfig(4);
+ path A, B; picture p[];
+ A = fullcircle scaled 2.5cm;
+ B = fullcircle scaled 1.8cm shifted (1cm,0);
+ p1 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p2 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ B := B rotatedabout(center B,180);
+ p3 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p4 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ B := B rotatedabout(center B, 180);
+ A := reverse A;
+ p5 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p6 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ B := B rotatedabout(center B,180);
+ p7 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+ A := A rotated 180;
+ p8 = image(fill overlap(A,B) withcolor .8[red,white]; drawarrow A; drawarrow B;);
+
+ for i=1 upto 4: draw p[i] scaled .75 shifted (80i, 0); label(decimal i, (5mm+80i,0)); endfor
+ for i=1 upto 4: draw p[i+4] scaled .75 shifted (80i,-68); label(decimal (4+i), (5mm+80i,-68)); endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-overlaps.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,66 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef median primary P =
+ (origin for i=1 upto length P: + point i of P endfor) / length P
+enddef;
+
+primarydef p enlarged s = p shifted -median p scaled s shifted median p enddef;
+
+path u, c, s;
+u = unitsquare shifted -(1/2, 1/2) scaled 72;
+c = fullcircle scaled 72 shifted 108 right;
+s = (superellipse(right, up, left, down, 0.8)) scaled 36 shifted 216 right;
+
+picture p[];
+p1 = image(
+draw origin--left scaled 50 withcolor background;
+ahangle := 30; numeric r, x; r = 9/16; x = -1;
+forsuffixes $=u, c, s:
+ drawarrow subpath(r, r + length $) of $;
+ draw fullcircle scaled 2 shifted median $ withcolor .67 red;
+ for i=0 upto length $-1:
+ fill fullcircle scaled 2 shifted point i of $ withcolor .67 red;
+ label(decimal i, point i of ($ enlarged 1.15));
+ endfor
+endfor);
+
+p2 = image(
+draw origin--left scaled 50 withcolor background;
+forsuffixes $=u,c,s:
+ fill median $ -- subpath (1,2) of $ -- cycle withcolor .8[blue,white];
+ draw median $ -- point 1 of $;
+ draw median $ -- point 2 of $;
+ draw $;
+endfor
+);
+
+p3 = image(
+draw origin--left scaled 50 withcolor background;
+forsuffixes $=u,c,s:
+ r := 1/5 length $;
+ fill median $ -- subpath (0,r) of $ -- cycle withcolor .8[red,white];
+ draw median $ -- point 0 of $;
+ draw median $ -- point r of $;
+ draw $;
+ endfor
+);
+
+p4 = image(
+draw origin--left scaled 50 withcolor background;
+forsuffixes $=u,c,s:
+ fill median $ -- subpath (-1,1) of $ -- cycle withcolor .8[black,white];
+ draw median $ -- point -1 of $;
+ draw median $ -- point 1 of $;
+ draw $;
+ endfor
+);
+
+beginfig(1);
+for i=1 upto 4: draw p[i] shifted (0,-108i); endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-points.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,24 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef poly expr n of p =
+ clearxy; z0 = point 0 of p; z1 = point 1 of p;
+ for i=2 upto n-1:
+ z[i] = z[i-2] rotatedabout(z[i-1], 360/n-180);
+ endfor
+ for i=0 upto n-1: z[i] -- endfor cycle
+enddef;
+beginfig(1);
+ path P[]; P3 = for i=0 upto 2: 6 up rotated 120i -- endfor cycle;
+ fill P3 withcolor 3/4 red; undraw P3;
+ for n = 4 upto 23:
+ numeric m; m = floor(n / 2);
+ P[n] = poly n of subpath (m, m-1) of P[n-1];
+ fill P[n] withcolor (n/48)[3/4 if odd n: red else: blue fi, white];
+ undraw P[n]; label(decimal n, center P[n]) withcolor white;
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-chain.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,35 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef median primary P =
+ (origin for i=1 upto length P: + point i of P endfor) / length P
+enddef;
+
+primarydef p enlarged s = p shifted -median p scaled s shifted median p enddef;
+
+vardef polygon(expr n, r) =
+ for i = 0 upto n - 1: (0, r) rotated (360 / n * i) -- endfor cycle
+enddef;
+
+path u, c, s;
+u = polygon(5, 36);
+c = polygon(6, 36) shifted 108 right;
+s = polygon(7, 36) shifted 216 right;
+
+beginfig(1);
+draw origin--left scaled 50 withcolor background;
+ahangle := 30; numeric r, x; r = 9/16; x = -1;
+forsuffixes $=u, c, s:
+ drawarrow subpath(r, r + length $) of $;
+ draw fullcircle scaled 2 shifted median $ withcolor .67 red;
+ for i=0 upto length $-1:
+ fill fullcircle scaled 2 shifted point i of $ withcolor .67 red;
+ label(decimal i, point i of ($ enlarged 1.15));
+ endfor
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygon-tops.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,70 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef median primary P =
+ (origin for i=1 upto length P: + point i of P endfor) / length P
+enddef;
+
+primarydef p enlarged s = p shifted -median p scaled s shifted median p enddef;
+
+vardef polygon(expr n, r) =
+ for i = 0 upto n - 1: (r, 0) rotated (360 / n * i) -- endfor cycle
+enddef;
+
+path u, c, s;
+u = polygon(5, 36);
+c = polygon(6, 36) shifted 108 right;
+s = polygon(7, 36) shifted 216 right;
+
+picture p[];
+p1 = image(
+draw origin--left scaled 50 withcolor background;
+ahangle := 30; numeric r, x; r = 9/16; x = -1;
+forsuffixes $=u, c, s:
+ drawarrow subpath(r, r + length $) of $;
+ draw fullcircle scaled 2 shifted median $ withcolor .67 red;
+ for i=0 upto length $-1:
+ fill fullcircle scaled 2 shifted point i of $ withcolor .67 red;
+ label(decimal i, point i of ($ enlarged 1.15));
+ endfor
+endfor);
+
+p2 = image(
+draw origin--left scaled 50 withcolor background;
+forsuffixes $=u,c,s:
+ fill median $ -- subpath (1,2) of $ -- cycle withcolor .8[blue,white];
+ draw median $ -- point 1 of $;
+ draw median $ -- point 2 of $;
+ draw $;
+endfor
+);
+
+p3 = image(
+draw origin--left scaled 50 withcolor background;
+forsuffixes $=u,c,s:
+ r := 1/5 length $;
+ fill median $ -- subpath (0,r) of $ -- cycle withcolor .8[red,white];
+ draw median $ -- point 0 of $;
+ draw median $ -- point r of $;
+ draw $;
+ endfor
+);
+
+p4 = image(
+draw origin--left scaled 50 withcolor background;
+forsuffixes $=u,c,s:
+ fill median $ -- subpath (-1,1) of $ -- cycle withcolor .8[black,white];
+ draw median $ -- point -1 of $;
+ draw median $ -- point 1 of $;
+ draw $;
+ endfor
+);
+
+beginfig(1);
+for i=1 upto 4: draw p[i] shifted (0,-108i); endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-polygons.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,66 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef urp(expr n) =
+ save a; numeric a; a = 90/n;
+ for i=0 upto n-1:
+ 1/2 up rotated (a * 4i) {left rotated (a + a * 4i)} .. {left rotated (3a + a * 4i)}
+ endfor cycle
+enddef;
+vardef through@#(expr a, b) = save d; numeric d; d = abs(a-b);
+ (1+@#/d)[b, a] -- (1+@#/d)[a, b] enddef;
+input colorbrewer-rgb
+beginfig(1);
+ path p, c; p = urp(5) scaled 320; c = fullcircle scaled 320;
+
+ pair A, B, C;
+ A = point 0 of p;
+ B = point 1 of p;
+ C = point 3 of p;
+
+ drawoptions(withcolor 7/8);
+ draw c;
+ draw through 42(origin, A);
+ draw through 42(origin, B);
+ draw through 42(C, A);
+ draw through 42(C, B);
+ draw through 42(B, B shifted 64 up);
+
+ forsuffixes $=origin, B:
+ draw (left--right) scaled 2 rotated 13 shifted $ shifted 42 up;
+ draw (left--right) scaled 2 rotated 13 shifted $ shifted 41 up;
+ endfor
+ ahangle := 30;
+ forsuffixes $=A, B:
+ drawarrow (reverse unitsquare scaled 5 -- 48 up) rotated angle ($ - C) shifted $;
+ endfor
+
+ drawoptions();
+ draw p withcolor Reds 8 7;
+ numeric a; a = 18;
+ label("$\alpha$", 32 dir 11/2 a shifted A);
+ label("$\alpha$", 32 dir 31/2 a shifted A);
+ label("$\alpha$", 32 dir 17/2 a shifted B);
+ label("$\alpha$", 32 dir 37/2 a shifted B);
+ label("$2\alpha$", 28 dir 14/2 a shifted C);
+ label("$3\alpha$", 24 dir 13/2 a shifted B);
+ label("$4\alpha$", 20 dir 7a);
+
+ dotlabel.urt("$A$", A);
+ dotlabel.lrt("$B$", B);
+ dotlabel.lrt("$C$", C);
+ dotlabel.urt("$O$", origin);
+
+ label.lft("$r$", 1/2 A);
+
+label.bot(btex \vbox{\hsize 4in \small\noindent
+This proof only works for Reuleaux polygons with an odd number of sides,
+because otherwise the point $C$ does not (quite) lie on the circle.\strut} etex,
+point 1/2 of bbox currentpicture shifted 21 down);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-geometry.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,31 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+\mplibtextextlabel{enable}
+vardef reuleaux(expr n, r) =
+ save a; numeric a; a = 90/n;
+ for t = 0 step 4a until 359:
+ (0, r) rotated t {left rotated (a + t)} .. {left rotated (3a + t)}
+ endfor cycle
+enddef;
+vardef median(expr p) = origin for i=1 upto length p: + point i of p / length p endfor enddef;
+input colorbrewer-rgb
+beginfig(1);
+ for n = 3 upto 7:
+ path p; p = reuleaux(n, 42) shifted (90n, 0);
+ pair m; m = point (n+1)/2 of p;
+ fill p withcolor if odd n: Oranges else: Blues fi 8 2;
+ fill subpath (0, 1) of p -- m -- cycle
+ withcolor if odd n: Oranges else: Blues fi 8 3;
+ %draw fullcircle scaled 2 abs(point 0 of p - m) shifted m
+ % withpen pencircle scaled 2 withcolor 3/4;
+ %draw tensepath(p) withcolor Blues 8 6;
+ %draw p rotatedabout(median(p), 180/n) withcolor Blues 8 6;
+ draw p;
+ endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-reuleaux-set.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,26 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path globe, gap, ring[], limb[];
+globe = fullcircle scaled 2cm;
+gap = fullcircle xscaled 3cm yscaled .8cm;
+ring1 = fullcircle xscaled 4cm yscaled 1.2cm;
+ring2 = ring1 scaled 0.93;
+ring3 = ring1 scaled 0.89;
+limb1 = buildcycle(subpath(5,7) of ring1, subpath(8,4) of globe);
+limb2 = buildcycle(subpath(5,7) of gap, subpath(-2,6) of globe);
+picture saturn; saturn = image(
+ fill ring1 withcolor .1 red + .1 green + .4 white;
+ fill ring2 withcolor .2 white;
+ fill ring3 withcolor .1 red + .1 green + .6 white;
+ unfill gap;
+ fill limb1 withcolor .2 red + .1 green + .7 white;
+ fill limb2 withcolor .2 red + .1 green + .7 white;
+);
+draw saturn rotated 30;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-saturn.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,28 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+
+vardef gcd(expr a, b) =
+ if b = 0: a else: gcd(b, a mod b) fi
+enddef;
+
+beginfig(1);
+ for n=2 upto 24:
+ for s=1 upto floor n/2:
+ pair p; p = (12n - 24s, -24n);
+ path gon; gon = for t=0 upto n/gcd(s,n) - 1:
+ 10 up rotated (360/n * s * t) --
+ endfor cycle;
+ if (n mod s = 0):
+ fill gon shifted p withcolor PuBuGn[9][1+floor (n/s/6)];
+ label("$" & decimal (n/s) & "$", p);
+ fi
+ draw gon shifted p withpen pencircle scaled 1/8;
+ endfor
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-schlafli-polygons.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,28 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\def \id#1{\mathord{\hbox{\it #1\/}}}
+\def \kw#1{{\hbox{\bf #1\thinspace}}}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+path unitse; unitse = superellipse(1/2 right, 1/2 up, 1/2 left, 1/2 down, 13/16);
+path xx, yy; xx = 72 left -- 144 right; yy = 42 down -- 89 up;
+path u, c, s;
+u = unitsquare scaled 72;
+c = fullcircle scaled 72;
+s = unitse scaled 72;
+
+beginfig(1);
+drawarrow xx withcolor .67 white;
+drawarrow yy withcolor .67 white;
+draw u; label.top("$\id{unitsquare}$", point 5/2 of u);
+drawoptions(withcolor .67 red);
+draw c; label("$\id{fullcircle}$", 3/4[point 2 of c, point 6 of c]);
+drawoptions(withcolor .67 blue);
+draw s; label.lrt("$\id{superellipse}()$", point 7 of s);
+drawoptions();
+dotlabel.bot("$\scriptstyle (1,0)$", point 1 of u);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-standards.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,26 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+def gcd(expr a, b) = if b = 0: a else: gcd(b, a mod b) fi enddef;
+
+beginfig(1);
+
+ for s = 20 upto 31:
+ pair z; z = (75s mod 300, if s < 20: 80 elseif s < 24: 0 elseif s < 28: -80 else: -160 fi);
+ path S; S = superellipse(36 right, 36 up, 36 left, 36 down, 1/32 s);
+ if (23 < s) and (s < 28):
+ fill S shifted z withcolor 15/16[blue, white];
+ fi
+ draw S shifted z;
+ numeric n, d, g; g = gcd(s, 32); n = s/g; d = 32/g;
+ label("$\frac{" & decimal n & "}{" & decimal d & "}$", z);
+ endfor
+
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-superellipses.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,29 @@
+\documentclass{standalone}
+\usepackage{dwmpcode}
+\usepackage{luamplib}
+\mplibtextextlabel{enable}
+\def \kw#1{\mathop{\hbox{\bf #1\thinspace}}}
+\def \id#1{\mathord{\hbox{\it #1\/}}}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+path xx, yy; xx = left scaled 8 -- right scaled 89; yy = down scaled 8 -- up scaled 55;
+path t; t = origin -- (55,0) -- (55,34) -- cycle;
+picture p[];
+p1 = image(
+ahangle := 30;
+drawarrow xx withcolor .67 white;
+drawarrow yy withcolor .67 white;
+fill t withcolor .8[blue,white]);
+
+p2 = image(
+draw p1;
+draw t;
+dotlabel.rt(btex $(55,34)$ etex scaled 0.8, point 2 of t);
+) shifted 144 right;
+draw p1; draw p2;
+label.bot(btex \mpl{fill t withcolor 0.8[blue,white];} etex scaled 0.8, point 1/2 of bbox p1);
+label.bot(btex \mpl{draw t;} etex scaled 0.8, point 1/2 of bbox p2);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/paths-triangles.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-P3.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-P3.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-P3.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,11 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input penrose
-beginfig(1);
- draw penrose(3);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-P3.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-stages.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-stages.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-stages.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,39 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input penrose
-beginfig(1);
- path s, t; phi = 1.61803398875;
- s = unitsquare shifted -(1/2, 1/2) rotated 45 xscaled phi yscaled 2 sind(36) scaled 20;
- t = unitsquare shifted -(1/2, 1/2) rotated 45 xscaled (1/phi) yscaled 2 sind(72) scaled 20;
- picture p[];
- p1 = image(
- draw (left--right) scaled 30 dashed evenly;
- draw s;
- );
- p3 = image(
- draw (left--right) scaled 13 dashed evenly;
- draw t;
- ) rotated 90 shifted 130 right;
- p2 = image(
- draw subpath (1, 3) of s -- cycle dashed withdots scaled 1/16 withpen pencircle scaled 1/8 withcolor 1/2;
- inflate_wide(3, 1, point 1 of s, point 2 of s, point 3 of s);
- ) shifted 64 right;
- p4 = image(
- draw subpath (1, 3) of t -- cycle dashed withdots scaled 1/16 withpen pencircle scaled 1/8 withcolor 1/2;
- inflate_tall(3, 1, point 1 of t, point 2 of t, point 3 of t);
- ) rotated 90 shifted 200 right;
- ahangle := 30;
- draw p1;
- draw p2;
- draw p3;
- draw p4;
- drawarrow (7 left -- 8 right) shifted point 7/4 of bbox p1 withcolor .67 red;
- drawarrow (1 left -- 14 right) shifted point 7/4 of bbox p3 withcolor .67 red;
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose-stages.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/penrose.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,84 +0,0 @@
-input colorbrewer-rgb
-numeric psi, size;
-psi = (sqrt 5 - 1) / 2;
-size = 800;
-vardef inflate_tall(expr mode, level, a, b, c) =
- save d, e; pair d, e;
- if level = 0:
- drawoptions(withpen pencircle scaled 1/8);
- filldraw a--b--c--cycle withcolor (abs(b)/size)[Reds 7 2, Blues 8 2];
- if mode = 2:
- draw c--a--b;
- else:
- % save arc; path arc;
- % arc = fullcircle rotated angle (c-a) scaled 1/2 abs(b-a) shifted a
- % if turningnumber (a--b--c--cycle) < 0: cutafter else: cutbefore fi (a--b);
- % cutdraw arc withpen pencircle scaled 3/2 withcolor Reds 7 4;
- % cutdraw arc reflectedabout(b, 1/2[a,c]) withpen pencircle scaled 3/2 withcolor Blues 8 8;
- % draw arc reflectedabout(b, 1/2[a,c]) withpen pencircle scaled 1/2 withcolor Blues 8 2;
- draw a--b--c;
- fi
- drawoptions();
- else:
- if mode = 3:
- d = psi[b,a];
- inflate_tall(mode, level - 1, d, c, a);
- inflate_wide(mode, level - 1, c, d, b);
- elseif mode = 2:
- d = psi[a, b];
- e = psi[b, c];
- inflate_tall(mode, level - 1, c, a, e);
- inflate_tall(mode, level - 1, d, a, e);
- inflate_wide(mode, level - 1, e, d, b);
- fi
- fi
-enddef;
-vardef inflate_wide(expr mode, level, a, b, c) =
- save d, e; pair d, e;
- if level = 0:
- drawoptions(withpen pencircle scaled 1/8);
- filldraw a--b--c--cycle withcolor (abs(b)/size)[Reds 7 3, white];
- if mode = 2:
- draw c--a--b;
- else:
- % save arc; path arc;
- % arc = fullcircle rotated angle (c-a) scaled 3/2 abs (b-a) shifted a
- % if turningnumber (a--b--c--cycle) < 0: cutafter else: cutbefore fi (a--b);
- % cutdraw arc withpen pencircle scaled 3/2 withcolor Reds 7 4;
- % path arc;
- % arc = fullcircle rotated angle (a-c) scaled 1/2 abs (b-a) shifted c
- % if turningnumber (a--b--c--cycle) > 0: cutafter else: cutbefore fi (c--b);
- % cutdraw arc withpen pencircle scaled 3/2 withcolor Blues 8 8;
- % draw arc withpen pencircle scaled 1/2 withcolor Blues 8 2;
- draw a--b--c;
-
- fi
- drawoptions();
- else:
- if mode = 3:
- d = psi[a,b]; e = psi[a,c];
- inflate_tall(mode, level - 1, d, e, b);
- inflate_wide(mode, level - 1, e, d, a);
- inflate_wide(mode, level - 1, c, e, b);
- elseif mode = 2:
- d = psi[c, a];
- inflate_tall(mode, level - 1, d, c, b);
- inflate_wide(mode, level - 1, b, d, a);
- fi
- fi
-enddef;
-
-vardef penrose(expr mode) =
- save a, b, c, P, R;
- pair a, b, c;
- b = origin;
- c = (sind(18), sind(72)) scaled size;
- a = (-xpart c, ypart c);
- picture P; P = image(inflate_tall(mode, 7, a, b, c));
- picture R; R = image(
- for t = 0 upto 9:
- draw P if odd t: reflectedabout(b, c) fi rotatedabout(b, 72t);
- endfor);
- clip R to (unitsquare shifted -(1/2, 1/2) xscaled 987 yscaled 610);
- R
-enddef;
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,59 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+
+path s, c;
+
+s = origin -- 80 right;
+c = quartercircle scaled 40;
+
+labeloffset := 20;
+
+vardef make_arrows(expr t) = image(
+ picture A, B;
+ A = image(drawarrow s; drawarrow c;);
+ B = image(drawdblarrow s; drawdblarrow c;);
+ label.lft(A, origin);
+ label.rt(B, origin);
+ picture T; T = thelabel("\texttt{" & t & "}", 8 down); bboxmargin := 4; path p; p = bbox T;
+ path S; S = superellipse(point 3/2 of p, point 5/2 of p, point 7/2 of p, point 1/2 of p, 0.78);
+ string x; x = substring (0, 1) of t;
+ fill S withcolor if x = "m": 7/8[red, white] elseif x = "c": 7/8[blue, white] else: white fi;
+ draw S; draw T;
+) enddef;
+
+beginfig(1);
+
+ label("\mpl{drawarrow}", (-60, 28));
+ label("\mpl{drawdblarrow}", (60, 28));
+
+ pair v; v = 40 down;
+
+ draw make_arrows("1");
+
+ ahangle := 20; ahlength := 6;
+ draw make_arrows("2") shifted v;
+
+ ahangle := 45; ahlength := 4;
+input mparrows
+setarrows(open); draw make_arrows("mp1") shifted 2.5v;
+setarrows(defaultunfilled); draw make_arrows("mp2") shifted 3.5v;
+setarrows(barbed); draw make_arrows("mp3") shifted 4.5v;
+
+
+input cmarrows
+setup_cmarrows(macro_name="drawarrow"; arrow_name="texarrow"; parameter_file="cmr10.mf");
+setup_cmarrows(macro_name="drawdblarrow"; arrow_name="twowayarrow"; parameter_file="cmr10.mf");
+ draw make_arrows("cm1") shifted 6v;
+setup_cmarrows(arrow_name="lefthalfarrow"; parameter_file="cmr10.mf"; macro_name="drawarrow");
+setup_cmarrows(arrow_name="paralleloppositelefthalfarrows"; parameter_file="cmr10.mf"; macro_name="drawdblarrow");
+ draw make_arrows("cm2") shifted 7v;
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-arrow-styles.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,63 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef extended(expr p) =
+ -42 unitvector(direction 0 of p) shifted point 0 of p .. p ..
+ +42 unitvector(direction 1 of p) shifted point 1 of p
+enddef;
+
+vardef chopper expr t of p =
+ (up--down) scaled 42
+ rotated 1/2(angle direction t-eps of p + angle direction t+eps of p)
+ shifted point t of p
+enddef;
+
+vardef beside(expr p, d) =
+ save n, a, b, aa, bb; numeric n; n = length p;
+ pair a, b, aa, bb; path _part[];
+ for i = 1 upto n:
+ aa := postcontrol i-1 of p - point i-1 of p;
+ bb := point i of p - precontrol i of p;
+ a := unitvector(aa) rotated -90 scaled d;
+ b := unitvector(bb) rotated -90 scaled d;
+ _part[i] = extended(
+ point i-1 of p shifted a {aa} .. point i of p shifted b {bb}
+ ) cutbefore chopper i-1 of p cutafter chopper i of p;
+ endfor
+ _part[1] for i=2 upto n: .. _part[i] endfor if cycle p: .. cycle fi
+enddef;
+beginfig(1);
+
+ path P[];
+
+ % P1 = origin -- (48,3) -- (96,-3) -- 144 right;
+ P2 = (22, 13) --- (92, 10) .. (120, 32) .. (138,50) .. (200, 69) ..
+ (280, 78) .. (300, 84) .. (315, 100) .. (322, 150) ..
+ (300, 186) --- (200, 187) --- (100, 188) --- (25, 188.75) -- cycle
+ ;
+
+ % % P1 := P1 shifted (center P2 - center P1) shifted 20 up;
+ % % P2 = fullcircle scaled 120;
+ % P3 = (reverse halfcircle -- origin -- down) scaled 64;
+ % P4 = for i=0 upto 4: 60 up rotated 72i -- endfor cycle;
+ % P5 = (left {dir 42} .. origin .. right {dir 42}) scaled 64;
+ % P6 = (left {dir 42} .. right {dir 42}) scaled 64;
+ % P7 = 40 left {right} .. 20 up .. 40 up {left} .. 20 up .. {right} 40 right;
+
+ for i=1 upto 10:
+ if known P[i]:
+ P[i] := P[i] shifted (150i, 0);
+ draw beside(P[i], 2) withcolor \mpcolor{textblue};
+ draw P[i];
+ draw beside(P[i], -2) withcolor \mpcolor{textred};
+ fi
+ endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-besides.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,57 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+
+vardef connect(expr a, b, r, want_erase) =
+ save p; path p; p = a {b-a rotated r} .. b;
+ if want_erase:
+ draw p withpen pencircle scaled 4 withcolor background;
+ fi
+ drawarrow p
+ cutbefore fullcircle scaled 20 shifted a
+ cutafter fullcircle scaled 20 shifted b;
+enddef;
+
+beginfig(1);
+ % how many points?
+ N = 7;
+ % define the points, from the top, counter-clockwise
+ for i=0 upto N-1:
+ z[i] = up scaled 100 rotated (360/N*i);
+ endfor
+ interim ahangle := 30; % with slim arrow heads
+
+ picture P[];
+ P1 = image(
+ for i=0 upto N-1:
+ connect(z[i], z[(i+1) mod N], -30, false);
+ connect(z[i], z[(i+2) mod N], -20, false);
+ connect(z[i], z[(i+4) mod N], 30, false);
+ endfor
+ % label all the points...
+ for i=0 upto N-1:
+ label(decimal (i+1), z[i]) withcolor .67 red;
+ endfor
+ );
+ P2 = image(
+ for i=0 upto N-1:
+ connect(z[i], z[(i+1) mod N], -30, true);
+ connect(z[i], z[(i+2) mod N], -20, true);
+ connect(z[i], z[(i+4) mod N], 30, true);
+ endfor
+ % label all the points...
+ for i=0 upto N-1:
+ label(decimal (i+1), z[i]) withcolor .67 red;
+ endfor
+ );
+
+ label.top(P1, 16 up);
+ label("Do you think it looks better with crossings?", origin);
+ label.bot(P2, 10 down);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-crossings.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,46 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+pair r; r = dir 30;
+path S; S = origin {r} .. 300 right {r};
+
+numeric head_length, tail_length, amplitude, lambda;
+head_length = tail_length = 13; amplitude = 1; lambda = 2;
+
+vardef zigzag expr p =
+ save a, b; numeric a, b; a = arctime head_length of p; b = arctime arclength p - tail_length of p;
+ subpath(0, a) of p
+ -- _ziggy(subpath(a, b) of p, false) --
+ subpath(b, infinity) of p
+enddef;
+vardef wavy expr p =
+ save a, b; numeric a, b; a = arctime head_length of p; b = arctime arclength p - tail_length of p;
+ subpath(0, a) of p
+ ... _ziggy(subpath(a, b) of p, true) ...
+ subpath(b, infinity) of p
+enddef;
+
+vardef _ziggy(expr p, soft) =
+ save t, k, A, s; numeric t, k, A, s; k = 0; A = arclength p; s = A / round(A/lambda);
+
+ point 0 of p
+ for i=s step s until A:
+ hide(t := arctime i of p;)
+ if soft: .. else: -- fi amplitude * if odd incr k: up else: down fi rotated angle direction t of p shifted point t of p
+ endfor
+ cutbefore fullcircle scaled 4 lambda shifted point 0 of p
+ cutafter fullcircle scaled 4 lambda shifted point infinity of p
+enddef;
+
+beginfig(1);
+ draw S;
+ drawarrow zigzag S shifted 30 down;
+ amplitude := 2/3; lambda := 3;
+ drawarrow wavy S shifted 60 down;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-curly.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,34 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\mplibshowlog{enable}
+\begin{mplibcode}
+input feynmp;
+beginfig(1);
+ path p[];
+ p1 = (left -- right) scaled 50 rotated 40;
+ p2 = (left {dir 45} .. right {dir 45}) scaled 50 rotated 40;
+ p3 = fullcircle scaled 72 yscaled 4/5;
+ p4 = unitsquare shifted -(1/2, 1/2) scaled 50;
+
+ labeloffset := 13;
+ ahangle := 30;
+ for i=1, 2, 3, 4:
+ numeric y; y = 0;
+ forsuffixes $=curly, zigzag, wiggly:
+ drawarrow p[i] shifted (96i, 96(incr y)) withcolor 3/4[if i=4: red else: blue fi, white];
+ draw $ p[i] shifted (96i, 96y);
+ if i=1: label.ulft("\mpl{" & str $ & "}", 96(i, y)) fi;
+ endfor
+ endfor
+
+ label.bot("The un-morphed paths are drawn faintly in colour behind the morphed paths.", point 1/2 of bbox currentpicture);
+ label.bot("The macros work on open or closed paths, \red{provided there are no sharp corners}.", point 1/2 of bbox currentpicture shifted 7 up);
+
+ label.ulft("\red{Hmmm...}", point 2 of p4 shifted (4*96, 104));
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-feynmp-styles.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,17 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ -z1 = z4 = 7 dir 8;
+ y2 - y1 = y4 - y3 = 3(y4 - y1);
+ z2 - z1 = z4 - z3 = whatever * dir 50;
+ draw z1 .. controls z2 and z3 .. z4 withpen pencircle xscaled 1.2 yscaled 0.2 rotated 50;
+ undraw z1 .. controls z2 and z3 .. z4 withpen pencircle xscaled 0.4 yscaled 0.03 rotated 50;
+ for i=1 upto 5:
+ draw currentpicture shifted ((2**(i-1))*z4);
+ endfor
+ currentpicture := currentpicture rotated - angle z4;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-fleuron.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,40 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef meander expr p =
+ save a, u, v, d, dy; numeric a, u, v, d; pair dy;
+ d = 4 xpart urcorner makepath currentpen;
+ a = arclength p; v = round(a/8d); u = a if v > 1: / v fi;
+ if not cycle p: point 0 of p -- fi for t = 0 step u until a-4eps:
+ hide(dy := d*unitvector(direction arctime t+1/2u of p of p rotated 90))
+ subpath(arctime t of p, arctime t+u-2d of p) of p shifted 3dy
+ --
+ subpath(arctime t+u-2d of p, arctime t+1/2 u of p) of p shifted -dy
+ --
+ subpath(arctime t+1/2u of p, arctime t+2d of p) of p shifted dy
+ --
+ subpath(arctime t+2d of p, arctime t+u of p) of p shifted -3dy
+ --
+ endfor if cycle p: cycle else: point infinity of p fi
+enddef;
+
+beginfig(1);
+ path r; r = (left {right} .. right rotated 10) scaled 100;
+ linejoin := mitered;
+ path p[];
+ p1 = (left -- right) scaled 50 rotated 40;
+ p2 = (left {dir 45} .. right {dir 45}) scaled 50 rotated 40;
+ p3 = fullcircle scaled 72 yscaled 4/5;
+ p4 = unitsquare shifted -(1/2, 1/2) scaled 50;
+ interim labeloffset := 13;
+ interim ahangle := 30;
+ for i=1, 2, 3, 4:
+ drawarrow p[i] shifted (96i, 0) withcolor 3/4[if i=4: red else: blue fi, white];
+ draw meander p[i] shifted (96i, 0);
+ endfor
+ label.ulft("\texttt{meander}", (96, 0));
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-greek-meander.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,15 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+path S; S = origin .. 100 right {down} .. origin .. 100 left {down} .. cycle;
+beginfig(1);
+draw S withpen pencircle scaled 6;
+draw S withpen pencircle scaled 5 withcolor 1/2[red, green] * 2;
+draw S withpen pencircle scaled 4.5;
+draw S dashed evenly scaled 1/2 withcolor white;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-highway.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,57 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\mplibtextextlabel{enable}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+numeric u; u = 56;
+z1 = right scaled u;
+z2 = z1 rotated 90;
+z3 = z2 rotated 90;
+z4 = z3 rotated 90;
+z5 = 1/2[z1,z2];
+z6 = 1/2[z2,z3];
+z7 = 1/2[z3,z4];
+z8 = 1/2[z4,z1];
+
+
+string capnames[], joinnames[];
+capnames[butt] = "\mpl{butt}";
+capnames[rounded] = "\mpl{rounded}";
+capnames[squared] = "\mpl{squared}";
+joinnames[mitered] = "\mpl{mitered}";
+joinnames[rounded] = "\mpl{rounded}";
+joinnames[beveled] = "\mpl{beveled}";
+
+picture p; numeric r; r = 2; interim labeloffset := 1;
+for i=butt, rounded, squared:
+ for j = mitered, rounded, beveled:
+ linecap := i;
+ linejoin := j;
+ p := image(
+ draw fullcircle scaled 8 shifted z5 withpen pencircle scaled 1/8 withcolor \mpcolor{textred};
+ drawoptions (withpen pencircle scaled 3);
+ draw unitsquare shifted -(1/2,1/2) scaled 2u withcolor 7/8;
+ label.top("\mpl{linecap}", z6);
+ label.bot(capnames[i], z6);
+ label.top("\mpl{linejoin}", z8);
+ label.bot(joinnames[j], z8);
+ drawarrow z4 -- -(r, r) -- z3;
+ draw z2-- (r, r) -- z1;
+ drawdot(z5);
+ drawarrow halfcircle scaled u rotated 180 shifted z4;
+ drawoptions();
+ ) shifted (5/2u*i, -11/4u*j);
+ draw p;
+ if (i=rounded) and (j=rounded):
+ draw bbox p dashed withdots scaled 1/4
+ withcolor \mpcolor{textgreen};
+ label.urt("\small \textsf{\textit{default}}", point 3 of bbox p) withcolor \mpcolor{textgreen};
+ fi
+ endfor
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-line-caps-and-joins.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,71 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\def\t#1{\vbox{\let\\\cr\halign{\texttt{##}\hss\cr#1\cr}}}
+\def\ts#1{\vbox{\let\\\cr\openup-4pt\halign{\small\hss\mpl{##}\hss\cr#1\cr}}}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ numeric u; u = 16;
+ pen P[];
+ P1 = makepen(for i=1 upto 90: 1/2 dir 4i -- endfor cycle) scaled u;
+ P10 = pencircle scaled u;
+ P100 = pencircle scaled 1/2;
+ P2 = pensquare scaled u;
+ P20 = pensquare scaled u;
+ P200 = pensquare;
+ P3 = pensquare scaled 0.7071 u rotated 45;
+ P30 = pensquare scaled 0.7071 u rotated 45;
+ P300 = pensquare scaled 0.35355 rotated 45;
+ P4 = penrazor scaled u;
+ P40 = penrazor scaled u;
+ P400 = penrazor;
+ path crook; crook = origin -- (5u, 0) -- 7u * dir 30;
+
+ string cap_name[], join_name[], pen_name[];
+ cap_name[butt] = "butt";
+ cap_name[rounded] = "rounded";
+ cap_name[squared] = "squared";
+ join_name[beveled] = "beveled";
+ join_name[rounded] = "rounded";
+ join_name[mitered] = "mitered";
+ pen_name1 = "pencircle";
+ pen_name2 = "pensquare";
+ pen_name3 = "pensquare\\\quad rotated 45";
+ pen_name4 = "penrazor";
+
+ for i=1, 2:
+ draw (origin -- 360 right) shifted ((0, 2.25-2.8i) scaled 8u);
+ label.rt("\t{" & pen_name[i] & "}", (0, 2.15-2.8i) scaled 8u);
+ for cap = rounded, butt, squared:
+ interim linecap := cap;
+ for join = rounded, beveled, mitered:
+ boolean default; default = (cap=rounded) and (join=rounded);
+ interim linejoin := join;
+ pair s; s = (cap, 0.8 join) shifted (0, -2.8i) scaled 8u;
+ draw crook shifted s withpen P[i]
+ withcolor
+ (15/16 if default: - 1/8 fi)
+ if i=1: [blue, white] fi;
+ draw (2.5u, 3u) shifted s withpen P[10i] withcolor 3/4;
+ draw fullcircle scaled 20 shifted (2.5u, 3u) shifted s withcolor 3/4 red;
+ for k=0, 1, 2:
+ draw makepath(P[i]) shifted point k of crook shifted s withcolor 1/2[blue, white];
+ endfor
+ draw envelope P[i] of crook shifted s;
+ draw crook shifted s withpen P[100i] withcolor red;
+ if default:
+ label("\ts{linecap\\" & cap_name[cap] & "}", s + (0, 5/4u));
+ label("\ts{" & join_name[join] & "\\linejoin}", point 1 of crook shifted s shifted (0, -5/4u));
+ else:
+ label("\ts{" & cap_name[cap] & "}", s + (0, u));
+ label("\ts{" & join_name[join] & "}", point 1 of crook shifted s shifted (0, -u));
+ fi
+ endfor
+ endfor
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-pen-oddity.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,109 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+path S; S = origin .. (48, 10) .. (116, -10) .. (165, 10);
+
+labeloffset := 14;
+
+beginfig(1);
+picture P[];
+numeric n; n = -1;
+P[incr n] = image(
+ draw S;
+ label.rt("plain", point 3 of S);
+);
+show incr n;
+
+P[incr n] = image(
+ draw S dashed dashpattern(on 4 off 2 on 1 off 2 on 1 off 2);
+ label.rt("with a dash pattern", point 3 of S);
+);
+
+P[incr n] = image(
+ cutdraw S dashed dashpattern(on 4 off 1 on 1 off 1 on 1 off 1);
+ label.rt("with a sharp dash pattern", point 3 of S);
+);
+
+P[incr n] = image(
+ cutdraw S withpen pencircle scaled 2;
+ undraw S withpen pencircle scaled 5/4;
+ cutdraw S dashed evenly scaled 2 shifted right withpen pencircle scaled 5/4;
+ label.rt("as a railway line", point 3 of S);
+);
+
+show incr n;
+
+P[incr n] = image(
+ draw S;
+ for a = 2 step 6 until arclength S:
+ numeric t; t = arctime a of S;
+ draw (down--up) rotated angle direction t of S shifted point t of S;
+ endfor
+ label.rt("as a plainer railway line", point 3 of S);
+);
+
+P[incr n] = image(
+ numeric A; A = arclength S;
+ for a = 0 step 1/8 until A:
+ draw point arctime a of S of S withcolor (a / A);
+ endfor
+ label.rt("fading away", point 3 of S);
+);
+
+P[incr n] = image(
+ for i=0 step 1/512 until length S:
+ draw point i of S withpen pencircle scaled (4 * (1 - i / length S))
+ withcolor (i / length S)[1/2 blue, white];
+ endfor
+ label.rt("fading and diminishing", point 3 of S);
+);
+
+path star; star = for i=0 upto 4: 6 up rotated (144i) -- endfor cycle;
+P[incr n] = image(
+ numeric t, i, a; t = i = a = 0;
+ for k=0 upto 100:
+ % show (t, arclength S);
+ exitif t >= arclength S;
+ a := arctime t of S;
+ fill star rotated angle direction a of S shifted point a of S
+ withcolor if odd incr i: blue else: red fi;
+ t := t + arclength subpath (2, 3) of star;
+ star := star scaled 0.94;
+ endfor
+ label.rt("with a fancy pattern", point 3 of S);
+);
+
+P[incr n] = image(
+ numeric u, v; u = 2; v = 1;
+ picture e; e = image(
+ draw (-u, v) {right} .. {right} (u, -v) withcolor blue;
+ cutdraw (-u, -v) {right} .. {right} (u, +v) withpen pencircle scaled 1 withcolor background;
+ draw (-u, -v) {right} .. {right} (u, +v) withcolor red;
+ );
+ picture f; f = image(
+ draw (-u, v) {right} .. {right} (u, -v) withcolor red;
+ cutdraw (-u, -v) {right} .. {right} (u, +v) withpen pencircle scaled 1 withcolor background;
+ draw (-u, -v) {right} .. {right} (u, +v) withcolor blue;
+ );
+ numeric t, a, T, wd, A; t = a = 0; A = arclength S; wd = xpart (lrcorner e - llcorner e);
+ for k=0 upto 100:
+ exitif a > A;
+ t := arctime a of S;
+ draw if odd k: f else: e fi rotated angle direction t of S shifted point t of S;
+ a := a + .8 wd;
+ endfor
+ label.rt("as a twisted pair", point 3 of S);
+);
+
+for i=0 upto 28:
+ if known P[i]:
+ draw P[i] shifted (0, -34i);
+ fi
+endfor
+input show_name
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-strokes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,32 @@
+\documentclass[border=1mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef tubular@#(expr p) = image(
+ draw p withpen pencircle scaled 8;
+ for w = 7.5 step -.5 until 1:
+ draw p withpen pencircle scaled w withcolor (sqrt(w/8))[white, 1/2 @#];
+ endfor
+) enddef;
+vardef ctubular@#(expr p) = image(
+ cutdraw p withpen pencircle scaled 8;
+ for w = 7.5 step -.5 until 1:
+ cutdraw p withpen pencircle scaled w withcolor (sqrt(w/8))[white, 1/2 @#];
+ endfor
+) enddef;
+beginfig(1);
+path half_reef;
+d = 1/4;
+half_reef = (-7, -d) --- (-2, -d) ... (0, -1) .. (2, 0) .. (0, 1) ... (-2, d) --- (-5, d);
+half_reef := half_reef scaled 20;
+draw tubular.red(half_reef);
+draw tubular.blue(half_reef reflectedabout (up, down));
+draw ctubular.red(subpath(3/2, 5/2) of half_reef);
+draw ctubular.red(subpath(7/2, 9/2) of half_reef);
+% for i=0 step 1/2 until length half_reef: dotlabel.top(decimal i, point i of half_reef); endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pens-tubes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-common.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-common.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-common.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,30 @@
+input colorbrewer-rgb
+picture orthogonals;
+orthogonals = image(
+ interim ahangle := 30;
+ z0 = 42 left rotated normaldeviate;
+ z1 = 30 up rotated normaldeviate;
+ z2 = 31 right rotated normaldeviate;
+ z3 = 34 down rotated normaldeviate;
+ path s[];
+ for i=0 upto 3:
+ s[i] = unitsquare zscaled (z[(i+1) mod 4] - z[i]) shifted z[i];
+ z[i+4] = 1/2[point 0 of s[i], point 2 of s[i]];
+ endfor
+ z8 = whatever[z4, z6] = whatever[z5, z7];
+
+ for i=0 upto 3:
+ fill s[i] withcolor if odd i: Blues else: Oranges fi 8 1;
+ draw point 3 of s[i] -- subpath (1,4) of s[i] -- point 2 of s[i] withcolor 3/4;
+ drawarrow subpath (0, 1) of s[i];
+ endfor
+ draw unitsquare scaled 5 rotated angle (z4-z6) shifted z8 withcolor 3/4;
+ drawarrow z4--z6;
+ drawarrow z5--z7;
+);
+
+vardef with_rounded_corners expr p =
+ for i=1 upto length p:
+ subpath (i-15/16, i-1/16) of p ..
+ endfor cycle
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-common.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,23 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\begin{mplibcode}
+input pics-border-common
+beginfig(1);
+draw orthogonals;
+
+bboxmargin := 16;
+draw with_rounded_corners bbox currentpicture
+ dashed evenly scaled 1/2;
+
+path b; b = bbox currentpicture;
+label.urt(btex
+\smallmpexternal[firstline=26,lastline=30]{pics-border-common.mp}
+etex, point 3/2 of b shifted 10 left);
+label.lrt(btex
+\smallmpexternal[firstline=10,lastline=12]{pics-border-dashed.mp}
+etex, point 3/2 of b shifted 10 left);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-dashed.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,13 @@
+\documentclass[border=2mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+input pics-border-common
+input rope
+beginfig(1);
+draw orthogonals; % from the common code...
+bboxmargin := 16;
+draw rope with_rounded_corners bbox currentpicture;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-rope.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,18 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\begin{mplibcode}
+input pics-border-common
+beginfig(1);
+draw orthogonals;
+bboxmargin := 16;
+picture P; P = currentpicture;
+fill bbox P shifted (3,-3) withcolor 3/4;
+unfill bbox P; draw bbox P; draw P;
+label.rt(btex
+\smallmpexternal[firstline=9, lastline=12]{pics-border-shadow.mp}
+etex, point 3/2 of bbox currentpicture shifted 10 left);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-border-shadow.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,36 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\usepackage{fontspec}
+\setmainfont{TeX Gyre Pagella}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ picture p, q;
+ p = thelabel.rt("\fontsize{48}{48}\selectfont plain", origin);
+ q = thelabel.rt("\fontsize{48}{48}\selectfont rotated", origin) rotated 30;
+
+ picture P[];
+ numeric i; i = 0;
+ forsuffixes @=p,q:
+ P[incr i] = image(
+ fill bbox @ withcolor 15/16[red, white];
+ draw llcorner @ -- lrcorner @ -- urcorner @ -- ulcorner @ -- cycle
+ withcolor 7/8[red, white];
+ draw llcorner @ -- urcorner @ withcolor 7/8[red, white];
+ draw ulcorner @ -- lrcorner @ withcolor 7/8[red, white];
+ draw @ withcolor 3/4;
+ dotlabel.lft("\texttt{llcorner}", llcorner @);
+ dotlabel.rt ("\texttt{lrcorner}", lrcorner @);
+ dotlabel.rt ("\texttt{urcorner}", urcorner @);
+ dotlabel.lft("\texttt{ulcorner}", ulcorner @);
+ draw fullcircle scaled 3 shifted center @;
+ );
+ endfor
+ labeloffset := 20;
+ label.top(P1, origin);
+ label.bot(P2, origin);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-corners.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,69 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+ahangle := 30;
+beginfig(1);
+
+path h; pair A, B, C, D, O; numeric theta;
+
+h = halfcircle scaled 320;
+
+O = origin;
+A = point 4 of h;
+B = point 0 of h;
+C = point 5/4 of h;
+D = (xpart C, ypart A);
+
+2theta = angle C;
+
+draw unitsquare scaled 8 rotated angle (C-D) shifted D withcolor 3/4;
+draw unitsquare scaled 8 rotated angle (A-C) shifted C withcolor 3/4;
+
+draw A--C--B withcolor Reds 7 7;
+draw O--C--D withcolor Reds 7 7;
+
+drawoptions(withcolor Blues 7 6);
+draw h;
+label.ulft("$x^2 + y^2 = 1$", point 3 of h);
+drawoptions();
+
+primarydef o through p = (1+o/arclength(p))[point 1 of p, point 0 of p] -- (1+o/arclength(p))[point 0 of p, point 1 of p] enddef;
+drawarrow 16 through (A--B);
+drawarrow 16 through (O--point 2 of h);
+
+dotlabel.bot("$A$", A);
+dotlabel.bot("$B$", B);
+dotlabel.urt("$C \smash{\;\bigl(\cos2\theta, \sin2\theta\bigr)}$", C);
+dotlabel.bot("$D$", D);
+dotlabel.llft("$O$", O);
+
+label("$\theta$", 28 dir 1/2 theta shifted A);
+label("$2\theta$", 20 dir theta);
+
+label("$x$", B shifted 24 right);
+label("$y$", point 2 of h shifted 24 up);
+
+draw thelabel.top("$2\cos\theta$", origin) rotated theta shifted 1/2[A, C];
+draw thelabel.top("$2\sin\theta$", origin) rotated (theta-90) shifted 1/2[B, C];
+
+label.bot("$\triangle ACD \sim \triangle ABC$", point 1/2 of bbox currentpicture shifted 24 down);
+
+path bb; bb = bbox currentpicture shifted 12 down;
+
+label.bot(btex \vbox{\openup 4pt\halign{\hfil $#$\hfil\cr
+CD \Big/ AC = BC \Big/ AB\cr
+\sin 2\theta \big/ 2 \cos\theta = 2 \sin\theta \big/ 2\cr
+\sin 2\theta = 2\sin\theta \cos\theta\cr}} etex, point 1/4 of bb);
+
+label.bot(btex \vbox{\openup 4pt\halign{\hfil $#$\hfil\cr
+AD \Big/ AC = AC \Big/ AB\cr
+\bigl(1 + \cos 2\theta \bigr) \big/ 2 \cos\theta = 2 \cos\theta \big/ 2\cr
+\cos 2\theta = 2\cos^2\theta - 1\cr}} etex, point 3/4 of bb);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-double-angle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,74 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+numeric s; s = 21;
+path alpha;
+alpha = ((-2s, s) {right}
+.. halfcircle rotated -90 scaled 2s shifted (2s, 0)
+.. {left} (-2s, -s)) shifted (s*left);
+
+vardef overdraw(expr a, b, r, P, shade) =
+ linecap := butt;
+ undraw subpath (a+r, b-r) of P withpen pencircle scaled 2;
+ draw subpath (a, b) of P withcolor shade;
+enddef;
+
+picture cb; cb = image(
+ draw alpha withcolor 2/3 red;
+ undraw alpha rotated 180 withpen pencircle scaled 2;
+ draw alpha rotated 180 withcolor 2/3 blue;
+ overdraw(0.21, 0.36, 0.02, alpha, 2/3 red);
+ overdraw(0.67, 0.86, 0.02, alpha, 2/3 red);
+ overdraw(3.4, 4.3, 0.1, alpha, 2/3 red);
+ overdraw(5.4, 5.6, 0.02, alpha, 2/3 red);
+ overdraw(5.4, 5.6, 0.02, alpha rotated 180, 2/3 blue);
+);
+
+ picture P[];
+
+ P1 = image(draw cb; label.rt("\mpl{draw cb;}", point 3/2 of bbox currentpicture));
+ P2 = image(draw cb withpen pencircle scaled 4; label.rt("\mpl{draw cb withpen pencircle scaled 4;}", point 3/2 of bbox currentpicture));
+ P3 = image(draw cb withcolor 1/2; label.rt("\mpl{draw cb withcolor 1/2;}", point 3/2 of bbox currentpicture));
+ P4 = image(draw cb withpen pencircle scaled 4 withcolor 1/2; label.rt("\mpl{draw cb withpen pencircle scaled 4 withcolor 1/2;}", point 3/2 of bbox currentpicture));
+ P5 = image(
+ color pretzel; pretzel = 1/256(187, 146, 79);
+ for i=8 step -1/2 until 1/2:
+ draw cb withpen pencircle scaled i
+ withcolor (i/8)[white, pretzel];
+ endfor
+ label.rt(btex \vbox{\halign{#\cr
+ \mpl{for i=8 step -1/2 until 1/2:}\cr
+ \quad\mpl{draw cb withpen pencircle scaled i}\cr
+ \qquad\mpl{withcolor sqrt(i/8)[white, pretzel];}\cr
+ \mpl{endfor}\cr}} etex, point 3/2 of bbox currentpicture);
+ );
+
+ P6 = image(
+ for e within cb:
+ draw pathpart e withpen penpart e scaled 4
+ withcolor 7/8[colorpart e, background];
+ endfor
+ label.rt(btex \vbox{\halign{#\cr
+ \mpl{for e within cb:}\cr
+ \quad\mpl{draw pathpart e withpen penpart e scaled 4}\cr
+ \qquad\mpl{withcolor 7/8[colorpart e, background];}\cr
+ \mpl{endfor}\cr}} etex, point 3/2 of bbox currentpicture);
+ );
+
+ for i=1 upto 6:
+ if known P[i]:
+ pair p; p = 60i * down;
+ label.rt(P[i], p);
+ fill superellipse(right, up, left, down, 0.8) scaled 6 shifted p
+ withcolor 2/3;
+ label("\textsf{" & decimal i & "}", p) withcolor white;
+ fi;
+ endfor
+
+ endfig;
+ \end{mplibcode}
+ \end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-draw-picture.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,51 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+% parameters
+u = 1cm;
+ymax = xmax = 2.75;
+xmin = ymin = -1.75;
+
+% make a plain grid
+path xx, yy;
+xx = ((xmin,0) -- (xmax,0)) scaled u;
+yy = ((0,ymin) -- (0,ymax)) scaled u;
+
+drawoptions(dashed withdots scaled 1/4 withcolor 3/4 white);
+for i = ceiling ymin upto floor ymax: draw xx shifted (0,i*u); endfor
+for i = ceiling xmin upto floor xmax: draw yy shifted (i*u,0); endfor
+
+drawoptions(withpen pencircle scaled .7);
+xx := xx scaled 1.05;
+yy := yy scaled 1.05;
+drawarrow xx;
+drawarrow yy;
+drawoptions();
+
+% Large A
+label.urt("A" infont defaultfont scaled 8, origin) withcolor 1/4 green;
+% the "transparent" box
+path shape; shape = (superellipse(right, up, left, down, 0.81))
+ shifted 1/2 right scaled 30 rotated 30;
+alpha = 5/8; % alpha: 0=invisible, 1=opaque
+color filler; filler = .95[red,white];
+picture bg; bg = currentpicture; % capture the current drawing
+picture fg; fg = image(
+ for e within bg: % redraw everything with blended color
+ draw e withcolor alpha[colorpart e, filler];
+ endfor
+ draw shape withpen pencircle scaled 2 withcolor 3/4;
+ draw subpath (2.718, 3.1415) of shape % add decoration
+ shifted - center shape scaled 7/8 shifted + center shape
+ withpen pencircle scaled 2 withcolor white;
+);
+clip fg to shape; % finally clip the fg drawing
+fill shape withcolor filler; % fill the shape
+draw fg; % and put the fg back on top
+draw shape withcolor 3/4 blue;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-fake-transparency.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-5mm.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-5mm.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-5mm.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,5 @@
+input automatic-grid
+begingroup; save P; picture P; P = currentpicture; clearit;
+draw grid(P, 5mm) withpen pencircle scaled 1/4 withcolor (3/4, 3/4, 7/8);
+draw grid(P, 10cm) withpen pencircle scaled 1/4 withcolor (1/2, 1/2, 3/4);
+draw P; endgroup;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-5mm.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-cm.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-cm.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-cm.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,5 @@
+input automatic-grid
+begingroup; save P; picture P; P = currentpicture; clearit;
+draw grid(P, 1mm) withpen pencircle scaled 1/4 withcolor (3/4, 3/4, 7/8);
+draw grid(P, 1cm) withpen pencircle scaled 3/8 withcolor (1/2, 1/2, 3/4);
+draw P; endgroup;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-cm.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,23 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{dwmpcode}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+path C; C = fullcircle scaled 125 shifted 20 up rotated 16;
+for t=0, 1, 4: draw center C -- point t of C withcolor 2/3 blue; endfor
+draw C withcolor 3/4 red; dotlabel.urt("Start", point 0 of C);
+input pics-graph-paper-inch
+
+label.ulft(btex \vbox{\hsize 134pt\raggedright
+Here is an example that adds graph paper behind a drawing.
+
+The first three lines make the example drawing, the
+final \mpl{input} adds the graph paper.
+\par} etex, llcorner currentpicture shifted 10 left);
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-example.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-inch.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-inch.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-inch.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,6 @@
+input automatic-grid
+begingroup; save P; picture P; P = currentpicture; clearit;
+draw grid(P, 9) withpen pencircle scaled 4/16 withcolor 1/16(12,12,14);
+draw grid(P,36) withpen pencircle scaled 5/16 withcolor 1/16(10,10,13);
+draw grid(P,72) withpen pencircle scaled 6/16 withcolor 1/16( 8, 8,12);
+draw P; endgroup;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper-inch.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,16 @@
+vardef grid(expr p, grid_unit) =
+ save llx, lly, urx, ury;
+ (llx, lly) = llcorner p - (bboxmargin, bboxmargin);
+ (urx, ury) = urcorner p + (bboxmargin, bboxmargin);
+ image(
+ for x = 1 + floor(llx / grid_unit) upto floor(urx / grid_unit):
+ draw (x * grid_unit, lly) -- (x * grid_unit, ury);
+ endfor
+ for y = 1 + floor(lly / grid_unit) upto floor(ury / grid_unit):
+ draw (llx, y * grid_unit) -- (urx, y * grid_unit);
+ endfor
+ if (llx < 0) and (lly < 0) and (urx > 0) and (ury > 0):
+ draw fullcircle scaled 3; % show origin if in range
+ fi
+ )
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-graph-paper.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,53 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+vardef thatch(expr a, b, c, penw, gap) =
+ picture H;
+ pair v;
+ v = gap * unitvector(c - 1/2[a, b]);
+ H = image(
+ for i=1 upto 120:
+ draw (a--b)
+ shifted (i * v)
+ withpen pencircle scaled penw;
+ endfor
+ );
+ clip H to a--b--c--cycle; draw H;
+enddef;
+
+beginfig(1);
+
+ path h, t;
+
+ h = for i=0 upto 5: 84 right rotated 60i -- endfor cycle;
+ t = (origin -- subpath (0, 1) of h -- cycle)
+ shifted -1/3(point 0 of h + point 1 of h)
+ scaled 1.08
+ rotated 90;
+
+ thatch(point 2 of t, point 0 of t, point 1 of t, 1/4, 3/2);
+ thatch(point 4 of h, point 0 of t, point 2 of t, 1/4, 5/4);
+ thatch(point 0 of t, point 0 of h, point 1 of t, 1/4, 3/4);
+ thatch(point 1 of h, point 1 of t, point 0 of h, 1/4, 1);
+ thatch(point 4 of h, point 2 of t, point 3 of h, 1/4, 2);
+ thatch(point 4 of h, point 0 of t, point 5 of h, 1/4, 1);
+ thatch(point 5 of h, point 0 of t, point 6 of h, 1/4, 3/4);
+
+ draw h;
+ draw t;
+
+ for i=0 upto 2:
+ draw point 2i of h -- point i of t;
+ draw point 2i of h -- point i+1 of t;
+ draw point 2i+1 of h -- point i+1 of t;
+ endfor
+
+ input ruler-cm
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-icosahedron.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,29 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ numeric r; r = 42; z1 = 5/4 r * left; z2 = 2r * right;
+ path c[];
+ c1 = fullcircle scaled 2 abs z1 shifted z1;
+ c2 = fullcircle scaled 2 abs z2 shifted z2;
+ c3 = fullcircle scaled abs(z2-z1) shifted 1/2[z1,z2];
+ numeric t, u;
+ (t, whatever) = c2 intersectiontimes c3;
+ (u, whatever) = c1 intersectiontimes (point t of c2 -- z1);
+
+ path s;
+ s = subpath (0, u) of c1 -- subpath (t, 4) of c2 -- cycle;
+ numeric gap; gap = 2;
+ for i=0 upto 2r / gap:
+ draw (origin--right) scaled 2r rotated 45t shifted (gap*i,0)
+ withpen pencircle scaled 1/4 withcolor 2/3 blue;
+ endfor
+ clip currentpicture to s;
+
+ draw c1; draw c2;
+ draw z1 -- z2 -- point t of c2 -- cycle;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-shady-circles.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,53 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+vardef compass_rose(expr shade, highlight) = image(
+ drawoptions(withcolor shade);
+ draw thelabel("NW" infont defaultfont scaled 3/4, 64 up) rotated +45;
+ draw thelabel("NE" infont defaultfont scaled 3/4, 64 up) rotated -45;
+ draw thelabel("SE" infont defaultfont scaled 3/4, 64 down) rotated +45;
+ draw thelabel("SW" infont defaultfont scaled 3/4, 64 down) rotated -45;
+ draw fullcircle scaled 144 withpen pencircle scaled 2;
+ for r = 53, 54, 59, 60, 69: draw fullcircle scaled 2r; endfor
+ for t=0 step 15 until 350: draw ((53,0) -- (60,0)) rotated t; endfor
+ for t=0 step 45 until 350: draw ((69,0) -- (80,0)) rotated t; endfor
+ save s; path s; s = 8 right -- 60 up -- 8 left -- cycle;
+ for t=0 upto 3: filldraw s rotated (45 + 90t); endfor
+ s := s scaled 1.414;
+ for t=0 upto 3:
+ s := s rotated 90t;
+ fill s withcolor background;
+ fill subpath (-1/2, 1) of s -- cycle if t=0: withcolor highlight fi;
+ draw s;
+ endfor
+ unfill fullcircle scaled 28; draw fullcircle scaled 28;
+ draw origin withpen pencircle scaled dotlabeldiam;
+ label("N" infont "cmbx12", 92 up);
+ label("S" infont "cmbx12", 92 down);
+ label("E" infont "cmbx12", 92 right);
+ label("W" infont "cmbx12", 92 left);
+ drawoptions();
+) enddef;
+input colorbrewer-rgb
+beginfig(1);
+ picture O; O = compass_rose(Blues 8 8, Reds 8 7) scaled 1/2;
+
+ numeric s; pair p; s = 108; p = origin;
+ draw O shifted p;
+ draw bbox O withcolor 3/4[red, white];
+ label.urt(TEX("\small\texttt{bbox P}"), point -1 of bbox O) withcolor 3/4[red, white];
+
+ p := (1s, 0); draw O rotated 30 shifted p; label(TEX("\small\texttt{rotated 30}"), p shifted 54 down);
+ p := (2s,+15); draw O shifted p; label(TEX("\small\texttt{shifted 15 up}"), p shifted 54 down);
+
+ p := ( 0, -1s); draw O scaled 3/4 shifted p; label(TEX("\small\texttt{scaled 3/4}"), p shifted 54 down);
+ p := (1s, -1s); draw O xscaled 3/4 shifted p; label(TEX("\small\texttt{xscaled 3/4}"), p shifted 54 down);
+ p := (2s, -1s); draw O yscaled 3/4 shifted p; label(TEX("\small\texttt{yscaled 3/4}"), p shifted 54 down);
+
+ p := ( 0, -2s); draw O slanted 3/4 shifted p; label(TEX("\small\texttt{slanted 3/4}"), p shifted 54 down);
+ p := (1s, -2s); draw O zscaled 3/4 dir 21 shifted p; label(TEX("\small\texttt{zscaled 3/4 dir 21}"), p shifted 54 down);
+ p := (2s, -2s); draw O reflectedabout(up, down) shifted p; label(TEX("\small\texttt{reflectedabout(up, down)}"), p shifted 54 down);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-twister.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,13 @@
+\documentclass{standalone}
+\usepackage{graphicx}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+input picture_frame
+beginfig(1);
+ picture F;
+ F = thelabel(TEX("\includegraphics[width=200pt]{youth.jpg}"), origin);
+ draw F; draw frame F;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pics-youth.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/picture_frame.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/picture_frame.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/picture_frame.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,5 +1,5 @@
% Toby Thurston -- 16 Apr 2021
-% Draw a kitsch picture frame round a rectangular path
+% Draw a kitsch picture frame round a path or picture
color gold, dark, grey;
gold = 1/256(243, 197, 127);
@@ -8,8 +8,8 @@
picture ball; ball = image(for i=0 upto 16:
fill interpath(i/16,
- fullcircle scaled 10,
- fullcircle scaled 3 shifted (-2, 2)
+ fullcircle scaled 10,
+ fullcircle scaled 3 shifted (-2, 2)
) withcolor (i/16)[gold, 15/16 white];
endfor) scaled 1/4;
@@ -16,56 +16,49 @@
newinternal pf_width; pf_width := 21;
vardef frame expr P =
- save base, side, f, t, u, xx;
- picture base, side; path f; numeric t, u, xx;
-
- t = arclength subpath (0,1) of bbox P;
- u = arclength subpath (1,2) of bbox P;
- xx = max(t, u) + 2 pf_width;
- f = unitsquare xscaled xx yscaled pf_width;
-
- % convenience / nonce function
- vardef paint_strip(expr y, wd, shade) =
- draw subpath (0, 1) of f
- shifted (0, if y < 0: pf_width + fi y)
- withpen pencircle scaled wd
- withcolor shade
- enddef;
-
- base = image(
- % background colour
- fill f withcolor gold;
- % grey strips
- paint_strip(2, 3, 5/4 grey);
- paint_strip(3.5, 1/4, grey);
- paint_strip(5, 1/4, 1/2[gold, dark]);
- paint_strip(-6.5, 1/4, 1/2[gold, dark]);
- paint_strip(-6, 1/4, 1/2[gold, dark]);
- paint_strip(-2, 2, 5/4 grey);
- % spatter with random spots
- for i=0 upto 4 * arclength(subpath (0,1) of f):
- fill fullcircle scaled uniformdeviate 3/4
- shifted (uniformdeviate xx, uniformdeviate pf_width)
- withcolor dark;
- endfor
- % decorative balls
- for x = 2 step 3 until xx:
- draw ball shifted (x, 2);
- endfor
- );
-
- % make two trapezium shapes
- side = base;
- clip side to (pf_width, 0) -- (pf_width + u, 0)
- -- (2 pf_width + u, pf_width) -- (0, pf_width) -- cycle;
- clip base to (pf_width, 0) -- (pf_width + t, 0)
- -- (2 pf_width + t, pf_width) -- (0, pf_width) -- cycle;
-
- % arrange the pieces into a square
- image(
- draw base rotated 180 shifted point 1 of bbox P shifted (+pf_width, 0);
- draw base rotated 0 shifted point 3 of bbox P shifted (-pf_width, 0);
- draw side rotated 90 shifted point 0 of bbox P shifted (0, -pf_width);
- draw side rotated 270 shifted point 2 of bbox P shifted (0, +pf_width);
- )
+ save base, side, f, t, u, xx;
+ picture base, side; path f; numeric t, u, xx;
+ t = arclength subpath (0,1) of bbox P;
+ u = arclength subpath (1,2) of bbox P;
+ xx = max(t, u) + 2 pf_width;
+ f = unitsquare xscaled xx yscaled pf_width;
+ % convenience / nonce function
+ vardef paint_strip(expr y, wd, shade) =
+ draw subpath (0, 1) of f
+ shifted (0, if y < 0: pf_width + fi y)
+ withpen pencircle scaled wd
+ withcolor shade
+ enddef;
+ base = image(
+ fill f withcolor gold; % background colour
+ paint_strip(2, 3, 5/4 grey); % grey strips
+ paint_strip(3.5, 1/4, grey);
+ paint_strip(5, 1/4, 1/2[gold, dark]);
+ paint_strip(-6.5, 1/4, 1/2[gold, dark]);
+ paint_strip(-6, 1/4, 1/2[gold, dark]);
+ paint_strip(-2, 2, 5/4 grey);
+ % spatter with random spots
+ for i=0 upto 4 * arclength(subpath (0,1) of f):
+ fill fullcircle scaled uniformdeviate 3/4
+ shifted (uniformdeviate xx, uniformdeviate pf_width)
+ withcolor dark;
+ endfor
+ % decorative balls
+ for x = 2 step 3 until xx:
+ draw ball shifted (x, 2);
+ endfor
+ );
+ % make two trapezium shapes
+ side = base;
+ clip side to (pf_width, 0) -- (pf_width + u, 0)
+ -- (2 pf_width + u, pf_width) -- (0, pf_width) -- cycle;
+ clip base to (pf_width, 0) -- (pf_width + t, 0)
+ -- (2 pf_width + t, pf_width) -- (0, pf_width) -- cycle;
+ % arrange the pieces into a square
+ image(
+ draw base rotated 180 shifted point 1 of bbox P shifted (+pf_width, 0);
+ draw base rotated 0 shifted point 3 of bbox P shifted (-pf_width, 0);
+ draw side rotated 90 shifted point 0 of bbox P shifted (0, -pf_width);
+ draw side rotated 270 shifted point 2 of bbox P shifted (0, +pf_width);
+ )
enddef;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pinwheel.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pinwheel.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pinwheel.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,36 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-vardef pinwheel(expr level, a, b, c, s) =
- if level = 0:
- fill a--b--c--cycle withcolor s;
- draw a--b--c--cycle withpen pencircle scaled 1/16 withcolor Blues 9 1;
- % path t; t = a--b--9/10[b,c]--cycle;
- % fill t withcolor s;
- % draw t withpen pencircle scaled 1/16 withcolor Greens 9 1;
- % draw point 5/2 of t withpen pencircle scaled 2 withcolor (1/4 + greenpart s, redpart s, bluepart s);
- else:
- save d, e, f, g;
- pair d, e, f, g;
- d = 2/5[b, c]; e = 4/5[b,c]; f = 1/2[e, a]; g = 1/2[a, b];
- pinwheel(level - 1, e, a, c, Blues 9 4);
- pinwheel(level - 1, f, g, a, Blues 9 3);
- pinwheel(level - 1, f, g, e, Blues 9 2);
- pinwheel(level - 1, d, e, g, Blues 9 5);
- pinwheel(level - 1, d, b, g, Blues 9 6);
- fi
-enddef;
-beginfig(1);
- numeric a, b; b = 6.4in; 2a = b;
- pinwheel(5, (0, 0), (b, 0), (0, a), "");
- pinwheel(5, (b, a), (0, a), (b, 0), "");
- currentpicture := currentpicture rotated 90;
- % for i=1 upto 1:
- % draw currentpicture shifted (lrcorner currentpicture - llcorner currentpicture);
- % endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pinwheel.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/plain-axes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/plain-axes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/plain-axes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,17 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- path xx, yy;
- xx = (left -- right) scaled 130;
- yy = (down -- up) scaled 80;
- drawarrow xx;
- drawarrow yy;
- label.rt("$x$", point 1 of xx);
- label.top("$y$", point 1 of yy);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/plain-axes.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pole-and-polar.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pole-and-polar.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pole-and-polar.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,59 +0,0 @@
-\documentclass[border=3mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- path C, L;
- numeric r;
- r = 89;
- C = fullcircle scaled 2r;
- L = (up--down) scaled 138 shifted 180 right rotated 34;
- pair a, b, o;
- a = point 0 of L; b = point 1 of L;
- o = center C;
-
- pair P, Q, R, P', m;
- P = whatever[a, b]; o - P = whatever * (a - b) rotated 90;
- Q = C intersectionpoint halfcircle zscaled (P-o) shifted 1/2[P, o];
- R = Q reflectedabout(P, o);
- P' = whatever[o, P] = whatever [Q, R];
-
- draw fullcircle scaled abs(P' - o) shifted 1/2[o, P']
- dashed withdots scaled 1/4
- withpen pencircle scaled 1/4
- withcolor 1/3 blue;
-
- draw unitsquare scaled 5 rotated (270 + angle (P-Q)) shifted Q withcolor 3/4 white;
- draw unitsquare scaled 5 rotated (90 + angle (P-o)) shifted P withcolor 3/4 white;
- draw unitsquare scaled 5 rotated (90 + angle (P-o)) shifted P' withcolor 3/4 white;
-
- draw P -- Q -- o -- R -- cycle withcolor 1/2 white;
- draw Q--R; draw o -- P;
- draw L withcolor 2/3 blue;
-
- draw C dashed evenly scaled 1/2 withcolor 1/2[2/3 blue, white];
-
- dotlabel.top("$Q$", Q);
- dotlabel.lrt("$R$", R);
- dotlabel.urt("$P$", P);
- dotlabel.llft("$O$", o); fill fullcircle scaled 3/4 dotlabeldiam shifted o withcolor white;
- label.lft("$r$", 1/2[o, Q]);
-
- drawdot P' withpen pencircle scaled dotlabeldiam;
- label("$P'$", P' shifted 10 dir 68) withcolor 2/3 blue;
-
- drawoptions(withcolor 2/3 blue);
- label.bot("\textit{circle of inversion}", point 6 of C);
- label.urt("\textit{polar}", point 1/4 of L);
- z0 = P' + 20 dir -20; draw z0 -- P' cutafter fullcircle scaled 8 shifted P'
- withpen pencircle scaled 1/4;
- label.rt("\textit{pole}", z0);
- drawoptions();
-
- label("$\displaystyle {r\over OP} = {OP' \over r}$", 1/2[point 0 of C, point 1 of L] + 12 down);
- label("$\displaystyle r^2 = OP \times OP'$", 1/2[point 0 of C, point 1 of L] + 36 down);
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/pole-and-polar.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/porson.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/porson.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/porson.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,22 +0,0 @@
-%prologues := 3;
-%outputtemplate := "%j%c.%{outputformat}";
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-interim bboxmargin := 0;
-vardef boxed(expr p) = save P; picture P; P = image(draw bbox p withcolor 7/8[red, white]; draw p); P enddef;
-beginfig(1);
- for i=2 upto 15:
- numeric y; y = -14i - 4 floor(i/4);
- label.lft(decimal 16i infont "phvr8r" scaled 0.6, (-6, y+2)) withcolor 0.54 red;
- for j = 0 upto 15:
- draw boxed(char (16i+j) infont "gporsonrg6r") shifted (12j + 2 floor(j/4), y);
- endfor
- endfor
- for x = 0 upto 4:
- draw (50x-4, -18) -- (50x-4, -224) withcolor 0.54 red;
- endfor
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/porson.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections-code.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections-code.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections-code.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,34 +0,0 @@
-% define the end points of the three rays
-z1 = right scaled 200 rotated 10;
-z2 = right scaled 100 rotated 135;
-z3 = right scaled 225 rotated -17.5;
-% define the other points, relative to Q
-pair A, B, P, Q, R;
-Q = 0.8125 z3;
-A = whatever[origin, z1]; A-Q = whatever * z1 rotated 90;
-P = whatever[origin, z2]; P-Q = whatever * z2 rotated 90;
-B = whatever[origin, z1]; B-P = whatever * z1 rotated 90;
-R = whatever[A,Q]; R-P = whatever * (B-P) rotated 90;
-% mark the angles
-drawoptions(withcolor .67 blue);
-path c; c = fullcircle scaled 30;
-draw c rotated angle (Q-P) shifted P cutafter (P--B);
-draw c rotated angle (P-Q) shifted Q cutafter (Q--R);
-draw c rotated angle P cutafter (origin--z1);
-drawoptions();
-% draw the rays and A--Q
-drawarrow origin -- z1; label(btex $r_1$ etex, z1 scaled 1.05);
-drawarrow origin -- z2; label(btex $r_2$ etex, z2 scaled 1.08);
-drawarrow origin -- z3; label(btex $r_3$ etex, z3 scaled 1.05);
-draw A--Q;
-% draw the dashed lines
-drawoptions(dashed evenly);
-draw B--P--R--Q--P; drawarrow origin -- P scaled 4/3;
-drawoptions();
-% label the points
-dotlabel.urt(btex $Q$ etex, Q);
-dotlabel.top(btex $A$ etex, A);
-dotlabel.lrt(btex $R$ etex, R) withcolor .67 blue;
-label.top (btex $B$ etex, B);
-label.llft(btex $P$ etex, P);
-label.llft(btex $O$ etex, origin);
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,10 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-input projections-code
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/projections.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/qed.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/qed.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/qed.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,42 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-def perpendicular expr t of p =
- direction t of p rotated 90 shifted point t of p
- enddef;
-
-vardef block(expr r) =
- save u, n, s, theta, base, ray;
- numeric u, n, s, theta;
- u = 5mm; n = 32; s = 8u; theta = -45;
-
- path base, ray[];
- base = origin for i=1 upto n-1: -- (i/n*s,r*normaldeviate) endfor
- -- (s,0) -- (s,-u) -- (0,-u) -- cycle;
-
- image(
- fill base withcolor .8[blue,white];
- draw base withcolor .67 blue;
-
- for i=2 upto 6:
- ray[i] = (left--right) scaled 2/3 s rotated theta shifted (i*u,0);
- b := ypart(ray[i] intersectiontimes base);
- ray[i] := point 0 of ray[i]
- -- point b of base
- -- point 0 of ray[i] reflectedabout(point b of base, perpendicular b of base);
- drawarrow ray[i];
- endfor
-
- label("r=" & decimal r, center base);
- ) enddef;
-
-beginfig(0);
-
- draw block(0); draw block(0.42) shifted 180 right;
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/qed.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/radical-axis.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/radical-axis.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/radical-axis.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,72 +0,0 @@
-\documentclass[border=1mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-vardef radical_axis(expr ca, cb) =
- numeric t, d, ra, rb;
- ra = abs(center ca - point 0 of ca);
- rb = abs(center cb - point 0 of cb);
- d = abs(center cb - center ca);
- 2t = 1 + (ra+rb) / d * (ra-rb) / d;
- (up -- down) scaled 89
- rotated angle (center cb - center ca)
- shifted t[center ca, center cb]
-enddef;
-
-vardef tangent_times(expr C, p) =
- save m, a, b, G, H;
- pair m; numeric a, b; path G, H;
- m = 1/2[p, center C];
- H = halfcircle scaled abs (p - center C)
- rotated angle (p - center C) shifted m;
- G = H rotatedabout(m, 180);
- (a, whatever) = C intersectiontimes H;
- (b, whatever) = C intersectiontimes G;
- (a, b if b < a: + 8 fi)
-enddef;
-
-beginfig(1);
- path c[], a[];
- z1 = origin; z2 = 233 right rotated 4; z3 = 209 right rotated -42;
- c1 = fullcircle scaled 202 shifted z1;
- c2 = fullcircle scaled 106 shifted z2;
- c3 = fullcircle scaled 62 shifted z3;
- a1 = radical_axis(c1, c2);
- a2 = radical_axis(c2, c3);
- a3 = radical_axis(c3, c1);
-
- z0 = whatever [point 0 of a1, point 1 of a1]
- = whatever [point 0 of a2, point 1 of a2];
-
- numeric t;
- (t, whatever) = tangent_times(c1, z0);
-
- drawoptions(withpen pencircle scaled 1 withcolor 3/4[blue, white]);
- draw c1; draw c2; draw c3;
-
- drawoptions(withcolor 3/4[blue, white]);
- draw z1 -- point t of c1 dashed evenly;
-
- drawoptions(withpen pencircle scaled 1/4);
- draw z1 -- z2 -- z3 -- cycle;
- drawoptions();
- draw a1; draw a2; draw a3;
-
- drawoptions(withcolor 2/3 red);
- draw fullcircle scaled 2 abs (point t of c1 - z0) shifted z0;
- draw z0 -- point t of c1 dashed evenly;
- drawdot z0 withpen pencircle scaled dotlabeldiam;
-
- drawoptions(withcolor 1/4[blue, white]);
- drawdot z1 withpen pencircle scaled dotlabeldiam;
- drawdot z2 withpen pencircle scaled dotlabeldiam;
- drawdot z3 withpen pencircle scaled dotlabeldiam;
- label.urt(btex $C_1$ etex, point 1 of c1);
- label.urt(btex $C_2$ etex, point 1 of c2);
- label.rt (btex $C_3$ etex, point 0 of c3);
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/radical-axis.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,40 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+vardef dice(expr pip_count, pip_color) =
+ save d,r,p, ul, ur, lr, ll; r = 1/8;
+ path d; d = for i=0 upto 3:
+ quartercircle scaled 3 shifted (15,15) rotated 90i --
+ endfor cycle;
+ picture p; p = image(
+ fill fullcircle scaled 6 withcolor pip_color;
+ draw fullcircle scaled 6;
+ );
+ pair ul, ur, ll, lr;
+ ul = 1/5[ulcorner d, lrcorner d]; ur = 1/5[urcorner d, llcorner d];
+ ll = 4/5[urcorner d, llcorner d]; lr = 4/5[ulcorner d, lrcorner d];
+ image(
+ fill d withcolor (1, 0.96, 0.8); draw d;
+ if odd(pip_count):
+ draw p shifted center d;
+ fi;
+ if pip_count > 1:
+ draw p shifted ul; draw p shifted lr;
+ fi;
+ if pip_count > 3:
+ draw p shifted ur; draw p shifted ll;
+ fi;
+ if pip_count = 6:
+ draw p shifted 1/2[ul,ll]; draw p shifted 1/2[ur,lr];
+ fi
+ )
+enddef;
+beginfig(1);
+for i=0 upto 4:
+ draw dice(1+floor uniformdeviate 6, if odd i: red else: blue fi)
+ rotated (2 normaldeviate) shifted (36i,0);
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-dice.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,32 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\usepackage{fontspec}
+\setmainfont{PlayfairDisplay-Black}[Scale=2.8]
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+randomseed:=2128.5073;
+beginfig(1);
+ n = 40; r = 12 ; s = 72;
+ path explosion; explosion = for i=1 upto n:
+ (if odd i: - fi r + s + uniformdeviate r) * dir (360/n*i) --
+ endfor cycle;
+ path splash; splash = for i=1 upto n:
+ (if odd i: - fi r + s + uniformdeviate r) * dir (360/n*i) ..
+ endfor cycle;
+ picture P[];
+ P1 = image(
+ fill explosion withcolor Oranges 7 4;
+ draw explosion withpen pencircle scaled 2 withcolor Reds 7 7;
+ label("BOOM!", center explosion) withcolor Reds 7 7;
+ );
+ P2 = image(
+ fill splash withcolor Blues 7 2;
+ draw splash withpen pencircle scaled 2 withcolor Blues 7 7;
+ label("SPLAT!", center splash) withcolor Blues 7 7;
+ );
+ label.lft(P1, 10 left); label.rt(P2, 10 right);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-explosions.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,89 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+input random-other-distributions
+
+beginfig(1);
+
+ numeric bucket[]; for i = 1 upto 5: bucket[i] = 0; endfor
+ numeric scale; scale = 50;
+ numeric N; N = 80;
+ numeric stack_height[];
+ numeric mu, r, k; mu = 0;
+ pair w;
+
+ for i=1 upto N: for j=1 upto N:
+ r := exponentialdeviate scale;
+ k := floor r;
+ mu := mu + (r - mu) / (i * N + j);
+
+ if known stack_height[k]:
+ stack_height[k] := stack_height[k] + 1;
+ else:
+ stack_height[k] := 1;
+ fi
+
+ w := (r, uniformdeviate 1/8 + stack_height[k]);
+
+
+ color shade;
+ if r < scale: bucket[1] := bucket[1] + 1; shade := Greens 8 8;
+ elseif r < 2 scale: bucket[2] := bucket[2] + 1; shade := Blues 8 8;
+ elseif r < 3 scale: bucket[3] := bucket[3] + 1; shade := Oranges 8 6;
+ elseif r < 4 scale: bucket[4] := bucket[4] + 1; shade := Reds 8 6;
+ else: bucket[5] := bucket[5] + 1; shade := black;
+ fi
+
+ if r < 7 scale: % trim very high ...
+ draw w withcolor shade;
+ fi
+ endfor endfor
+
+ draw (origin -- 1.44 scale * up) shifted (mu, 0) withcolor 2/3 blue;
+ label.top("$\mu$", (mu, 1.44 scale));
+
+ path xx, yy;
+ xx = origin -- 6 scale * right shifted 12 right;
+ yy = origin -- 2 N * up;
+
+ ahangle := 30;
+ for x=1 upto 6:
+ draw (origin -- 3 down) shifted (scale * x, 0);
+ label.bot(decimal x, (scale * x, -3));
+ endfor
+ drawarrow xx;
+ draw yy;
+
+ vardef exponential_pdf(expr x, lambda) =
+ if x < 0: 0 else: lambda * mexp(-256x * lambda) fi
+ enddef;
+
+ path E;
+ E = ((0, exponential_pdf(0, 1)) for x=1 upto 6: .. (x, exponential_pdf(x, 1)) endfor)
+ xscaled scale yscaled 1.8N;
+
+ draw E withcolor 1/2 red;
+
+ string p;
+ for i=1 upto 5:
+ p := decimal (bucket[i] / N / N);
+ label.bot("\tiny " & p, ((i-1/2) * scale, -10));
+ endfor
+
+ pair a, b;
+ a = point 1/4 of E shifted (2,3);
+ b = point 1/4 of E shifted (20, 30);
+ draw a -- b withpen pencircle scaled 1/4;
+ label.urt("$\lambda e^{-\lambda x}$", b);
+
+ label.llft("\large\textsf{Histogram of exponential deviates}", urcorner currentpicture);
+
+ input show_name
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-exponential-test.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-circumcircle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-circumcircle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-circumcircle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -18,26 +18,27 @@
picture marker; marker = image(for s=-1/2, 1/2:
draw (left--right) scaled 2 rotated 60 shifted (s,0);
endfor);
-def moved_along expr x of p = rotated angle direction x of p
- shifted point x of p enddef;
-
+def moved_along expr x of p =
+ rotated angle direction x of p
+ shifted point x of p
+enddef;
beginfig(1);
-pair A, B, C, D;
-A = (0,-30); B = (180,0); C = (120,90); D = (1/2 + 1/40 normaldeviate)[A, B];
-path triangle, circumcircle, bisector;
-triangle = freehand_path(A--D--B--C--cycle);
-bisector = freehand_segment(C--D);
-circumcircle = freehand_path(A..B..C..cycle);
-draw triangle;
-draw bisector;
-draw circumcircle withcolor .67 red;
-draw marker moved_along 1/2 of triangle withcolor .67 red;
-draw marker moved_along 3/2 of triangle withcolor .67 red;
-label.lft("A", A);
-label.rt ("B", B);
-label.top("C", C);
-label.bot("D", D);
+ pair A, B, C, D;
+ A = (0,-30); B = (180,0); C = (120,90);
+ D = (1/2 + 1/40 normaldeviate)[A, B];
+ path triangle, circumcircle, bisector;
+ triangle = freehand_path(A--D--B--C--cycle);
+ bisector = freehand_segment(C--D);
+ circumcircle = freehand_path(A..B..C..cycle);
+ draw triangle;
+ draw bisector;
+ draw circumcircle withcolor .67 red;
+ draw marker moved_along 1/2 of triangle withcolor .67 red;
+ draw marker moved_along 3/2 of triangle withcolor .67 red;
+ label.lft("A", A);
+ label.rt ("B", B);
+ label.top("C", C);
+ label.bot("D", D);
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-circumcircle.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-through.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-through.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-through.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,40 +3,41 @@
\begin{document}
\begin{mplibcode}
vardef freehand_through@#(expr a, b) =
- save t; pair t; t = @# * unitvector(b - a) rotated (4 + normaldeviate);
- a - t .. a {t} .. b {t} .. b + t
+ save t; pair t;
+ t = @# * unitvector(b - a) rotated (4 + normaldeviate);
+ a - t .. a {t} .. b {t} .. b + t
enddef;
vardef mid_arc@#(expr p, a, b) =
- save c; path c; c = fullcircle scaled (2*@#) shifted p cutbefore a cutafter b;
- point arctime 1/2 arclength c of c of c
+ save c; path c;
+ c = fullcircle scaled (2*@#) shifted p cutbefore a cutafter b;
+ point arctime 1/2 arclength c of c of c
enddef;
beginfig(1);
-defaultfont := "eurm10"; color sepia; sepia = (0.44, 0.26, 0.08);
-pair A, B, C;
-A = (0,-30); B = (180,0); C = (120,90);
+ defaultfont := "eurm10"; color sepia; sepia = (0.44, 0.26, 0.08);
+ pair A, B, C;
+ A = (0,-30); B = (180,0); C = (120,90);
-path a, b, c;
-a = freehand_through 7 (A, B);
-b = freehand_through 8 (B, C);
-c = freehand_through 6 (C, A);
+ path a, b, c;
+ a = freehand_through 7 (A, B);
+ b = freehand_through 8 (B, C);
+ c = freehand_through 6 (C, A);
-drawoptions(withcolor sepia);
-draw a; draw b; draw c;
+ drawoptions(withcolor sepia);
+ draw a; draw b; draw c;
-drawoptions(withcolor .67 blue);
-label.bot ("a", point 3/2 of a);
-label.rt ("b", point 3/2 of b);
-label.ulft("c", point 3/2 of c);
+ drawoptions(withcolor .67 blue);
+ label.bot ("a", point 3/2 of a);
+ label.rt ("b", point 3/2 of b);
+ label.ulft("c", point 3/2 of c);
-drawoptions(withcolor .5 red);
-label(char 11, mid_arc 16 (A, a, c));
-label(char 12, mid_arc 14 (B, b, a));
-label(char 13, mid_arc 14 (C, c, b));
+ drawoptions(withcolor .5 red);
+ label(char 11, mid_arc 16 (A, a, c));
+ label(char 12, mid_arc 14 (B, b, a));
+ label(char 13, mid_arc 14 (C, c, b));
-drawoptions();
+ drawoptions();
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-freehand-through.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-function.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-function.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-function.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,33 +0,0 @@
-\documentclass[border=2mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-
-beginfig(1);
-path xx, yy, ff;
-xx = origin -- 233 right;
-yy = origin -- 144 up;
-
-z1 = (72, 62);
-z2 = (180, 110);
-
-ff = (xpart point 0 of xx, ypart point 0 of yy) {dir 76}
- .. z1 {dir 64} .. z2 {dir 64} .. (xpart point 1 of xx, ypart point 1 of yy) {dir 30};
-
-draw ff withcolor 0.54 red;
-drawarrow xx;
-drawarrow yy;
-forsuffixes $=1,2:
- draw (0, y$) -- z$ -- (x$,0) dashed evenly withcolor 1/2;
- dotlabel.lft("\texttt{(0,y" & decimal $ & ")}", (0, y$));
- dotlabel.bot("\texttt{(x" & decimal $ & ",0)}", (x$, 0));
- dotlabel.rt("$z_" & decimal $ & "$", z$);
-endfor
-
-
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-function.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,69 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+numeric _sqrtpp;
+_sqrtpp = 2.50662827463;
+
+vardef gauss(expr mu, sigma, x) =
+ if abs(x - mu) < 4 sigma:
+ mexp(-128 * (((x - mu) / sigma) ** 2)) / _sqrtpp / sigma
+ else:
+ 0
+ fi
+ enddef;
+
+vardef gauss_curve(expr mu, sigma, a, b, s) =
+ (a, gauss(mu, sigma, a)) for x = a + s step s until b: .. (x, gauss(mu, sigma, x)) endfor
+ enddef;
+
+vardef percent(expr n, N) =
+ save p, s;
+ numeric p;
+ string s;
+ p = 1 - n / N / N;
+ s = decimal floor(1000 p);
+ substring (0, length(s) - 1) of s & "." & substring (length(s)-1, infinity) of s & "\thinspace\%"
+enddef;
+
+path Z; Z = gauss_curve(0, 1, -4, 4, 1/8) xscaled 50 yscaled 220;
+path A, B;
+A = subpath (16,48) of Z -- (xpart point 48 of Z, 0) -- (xpart point 16 of Z, 0) -- cycle;
+B = subpath (24,40) of Z -- (xpart point 40 of Z, 0) -- (xpart point 24 of Z, 0) -- cycle;
+beginfig(1);
+ draw Z withcolor Reds 8 5;
+ numeric N, stack_height[]; N = 100;
+ numeric plump, fat, gross; gross = plump = fat = 0;
+ for i=1 upto N: for j = 1 upto N:
+ numeric r, k;
+ r = 50 normaldeviate;
+ k = round(r);
+ if known stack_height[k]:
+ stack_height[k] := stack_height[k] + 1;
+ else:
+ stack_height[k] := 1;
+ fi
+ pair z; z = (r, uniformdeviate 1/4 + stack_height[k]);
+ color shade; shade = Greens 8 8;
+ if abs(r) > 50: plump := plump + 1; shade := Blues 8 8; fi
+ if abs(r) > 100: fat := fat + 1; shade := Oranges 8 6 ; fi
+ if abs(r) > 150: gross := gross + 1; shade := Reds 8 8; fi
+ draw z withpen pencircle scaled 1/2 withcolor shade;
+ undraw z withpen pencircle scaled 1/4;
+ endfor endfor
+ label("\textsc{Observed values}", (-180, 96));
+ label("$abs(r) \le 1$: " & percent(plump, N), (-180, 80));
+ label("$abs(r) \le 2$: " & percent(fat, N), (-180, 68));
+ label("$abs(r) \le 3$: " & percent(gross, N), (-180, 56));
+ draw (left--right) scaled 220;
+ for i = -4 upto 4:
+ draw (50i, 0) -- (50i, -5);
+ label.bot("\hbox to 5pt{\hss$" & decimal i & "$}", (50i, -5));
+ endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-gaussian.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-other-distributions.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-other-distributions.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-other-distributions.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,48 @@
+
+
+vardef normaldeviate =
+ save u, v, xa;
+ forever:
+ u := 1 - uniformdeviate 63/64;
+ v := sqrt(8/mexp(256)) * (-1/2 + uniformdeviate 1);
+ xa := v / u;
+ exitif (xa * xa <= -mlog(u)/64);
+ endfor
+ xa
+enddef;
+
+vardef exponentialdeviate expr mu =
+ save u;
+ u = 1 - uniformdeviate 1; % hence 0 < u <= 1 and so you avoid
+ -mu * 1/256 mlog(u) % the danger of calling mlog(0)
+enddef;
+
+vardef tand(expr theta) =
+ save x, y;
+ (x, y) = dir theta;
+ if abs(x) < eps: infinity else: y/x fi
+enddef;
+vardef exp(expr x) = mexp(256x) enddef;
+vardef log(expr x) = 1/256 mlog(x) enddef;
+
+% this is defined only for a > 1
+vardef gammadeviate(expr a, b) =
+ save y, x, v, s, accept; boolean accept;
+ s = sqrt(2a - 1);
+ forever:
+ forever:
+ y := tand(uniformdeviate 180);
+ exitif abs(y) < 16;
+ endfor
+ x := s * y + a - 1;
+ accept := false;
+ if x > 0:
+ v := uniformdeviate 1;
+ if v <= (1 + y * y) * exp((a - 1) * log(x / (a - 1)) - s * y):
+ accept := true;
+ fi
+ fi
+ exitif accept;
+ endfor
+ x/b
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-other-distributions.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,39 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+def perpendicular expr t of p =
+ direction t of p rotated 90 shifted point t of p
+enddef;
+
+vardef block(expr wd, dp, theta, r) =
+ save base, ray, b;
+ path base, ray[]; numeric b;
+
+ base = origin for i=1 upto 31:
+ -- (i/32 * wd, r * normaldeviate)
+ endfor -- (wd,0) -- (wd,-dp) -- (0,-dp) -- cycle;
+
+ image(
+ fill base withcolor .8[blue,white];
+ draw base withcolor .67 blue;
+
+ for i = 2 upto 6:
+ ray[i] = (left--right) scaled 2/3 wd rotated -theta
+ shifted (i/8 * wd,0);
+ b := ypart (ray[i] intersectiontimes base);
+ ray[i] := point 0 of ray[i] -- point b of base -- point 0 of ray[i]
+ reflectedabout(point b of base, perpendicular b of base);
+ drawarrow ray[i];
+ endfor
+
+ label("$r=" & decimal r & "$", center base);
+ )
+enddef;
+beginfig(0);
+ draw block(108, 16, 45, 0);
+ draw block(108, 16, 45, 0.42) shifted 180 right;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-qed.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-selection.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-selection.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-selection.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,25 +0,0 @@
-\documentclass[border=0mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- numeric u; u = 72;
- for x = -2u step 1/8 until 2u:
- drawdot (x, normaldeviate * 1/2u) withpen pencircle scaled 2;
- endfor
- path c;
- c = fullcircle scaled u shifted (u, 1/2u);
- picture P; P = currentpicture; clip P to c;
- draw c withcolor .54 red;
- draw P withcolor .84 red;
-
- picture B; B = currentpicture;
- path S;
- S = unitsquare shifted (-1/2, -1/2) scaled 4u;
- fill S withcolor (1,1,31/32); draw S; clip B to S; draw B;
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-selection.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-shapes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-shapes.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-shapes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,21 +4,20 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
-numeric desired_length, n, s;
-desired_length = 180; n = 30; s = 80;
-for r=0 upto 8:
- path shape;
- shape = for i=1 upto n:
- (s + r * normaldeviate, 0) rotated (360/n*i) ..
- endfor cycle;
+ numeric desired_length, n, s;
+ desired_length = 180; n = 30; s = 80;
+ for r=0 upto 8:
+ path shape;
+ shape = for i=1 upto n:
+ (s + r * normaldeviate, 0) rotated (360/n*i) ..
+ endfor cycle;
- shape := shape scaled (desired_length/arclength shape);
-
- draw shape shifted (r*s, 0) withcolor (r/8)[black,red];
- label(decimal r, (r*s, 0));
+ shape := shape scaled (desired_length/arclength shape);
-endfor
+ draw shape shifted (r*s, 0) withcolor (r/8)[black,red];
+ label(decimal r, (r*s, 0));
+
+ endfor
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-shapes.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,18 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+input random-torn-edge
+beginfig(1);
+ path c; c = fullcircle scaled 200;
+ draw c withcolor .8 white;
+ y=0; n = 600;
+ path t; t = for i=0 upto n-1:
+ point i/n*length(c) of c
+ + (0, walkr y) rotated angle direction i/n*length(c) of c
+ --
+ endfor cycle;
+ draw t withcolor .67 red;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge-circle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,8 @@
+vardef walkr suffix $ =
+ save t; boolean t;
+ t = uniformdeviate 1 < (2 ** - abs($));
+ $ := $ if t: + else: - fi signr $; $
+enddef;
+vardef signr suffix $ =
+ if $ < 0: - else: + fi uniformdeviate 1
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-edge.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,14 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+input random-torn-edge
+beginfig(1);
+ path t; numeric x, y;
+ x = 0; y=0;
+ t = (x, -20) -- (x, y) for i=1 upto 288:
+ -- (incr x, walkr y) endfor -- (x, -20) -- cycle;
+ fill t withcolor (1, 1, 31/32); draw t withcolor .67 blue;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-torn-straight-edge.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,22 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\mplibshowlog{enable}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+% randomseed := uniformdeviate infinity;
+randomseed := 2141.34242;
+numeric u, v; u = 5; v = 4;
+for n=1 upto 4:
+ numeric x, y; x = y = 0;
+ path w; w = (x, y) for i=1 upto 2048:
+ hide(x := x + normaldeviate * u ; y := y + normaldeviate * v)
+ .. (x, y)
+ endfor;
+ draw w withcolor (2n/10)[white, 2/3 blue];
+ draw (x, y) withpen pencircle scaled 3 withcolor 2/3 red;
+endfor
+draw origin withpen pencircle scaled 3 withcolor 3/4 green;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-two-dimensional-brownian.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,25 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\mplibshowlog{enable}
+\begin{mplibcode}
+beginfig(1);
+ randomseed := 3612.11746;
+ numeric w, h, n; w = 377; h = 80; n = 500;
+ draw (origin--right) scaled w;
+ draw (origin--right) scaled w shifted (0,+h/2) withcolor 3/4;
+ draw (origin--right) scaled w shifted (0,-h/2) withcolor 3/4;
+ numeric y; y = 0;
+ path walk; walk = (0, y) for x=w/n step w/n until w:
+ hide(y := y + 4 normaldeviate)
+ -- (x, y)
+ endfor;
+ path bridge; bridge = point 0 of walk for i=1 upto n:
+ -- point i of walk + (0, i/n * -y) endfor;
+ draw walk withcolor 7/8; % so you can see how it works
+ undraw bridge withpen pencircle scaled 3/4;
+ draw bridge withcolor 3/4 blue;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal-bridge.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,27 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\mplibshowlog{enable}
+\begin{mplibcode}
+beginfig(1);
+ randomseed := 3612.11746;
+ numeric w, h, n; w = 377; h = 80; n = 500;
+ draw (origin--right) scaled w;
+ draw (origin--right) scaled w shifted (0,+h/2) withcolor 3/4;
+ draw (origin--right) scaled w shifted (0,-h/2) withcolor 3/4;
+ for i=1 upto 4:
+ numeric y; y = 0;
+ path walk; walk = (0, y) for x=w/n step w/n until w:
+ hide(y := y + 2 normaldeviate)
+ -- (x, y)
+ endfor;
+ undraw walk withpen pencircle scaled 3/4;
+ draw walk withcolor (1/2+y/h)[red, blue];
+ label.rt("$\scriptstyle" & decimal i & "$",
+ point infinity of walk);
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-normal.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-red-blue.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-red-blue.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-red-blue.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,45 +1,33 @@
\documentclass{standalone}
\usepackage{luamplib}
\begin{document}
-\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
- randomseed := 3.1415;
- color tr, tb; tr = 0.84 red; tb = 1.2(.2,.2,.7);
- numeric w, h, n; w = 377; h = 80; n = 500;
- pair zenith, nadir; zenith = nadir = origin;
- path walk[];
+ numeric w, h, n; w = 377; h = 80; n = 500;
- draw (origin--right) scaled w;
- draw (origin--right) scaled w shifted (0,+h/2) withcolor 3/4;
- draw (origin--right) scaled w shifted (0,-h/2) withcolor 3/4;
+ draw (origin--right) scaled w;
+ draw (origin--right) scaled w shifted (0,+h/2) withcolor 3/4;
+ draw (origin--right) scaled w shifted (0,-h/2) withcolor 3/4;
- for i=1 upto 8:
- numeric y; y = 0;
- walk[i] = origin for x=w/n step w/n until w:
- hide(
- y := y if uniformdeviate 1 < 1/2: + else: - fi 1;
- if y > ypart zenith: zenith := (x,y) ; fi
- if y < ypart nadir: nadir := (x,y) ; fi
- )
- -- (x,y)
- endfor;
- undraw walk[i] withpen pencircle scaled 3/4;
- draw walk[i] withcolor (1/2+y/h)[tr, tb];
- label.rt("$\scriptstyle" & decimal i & "$",
- point infinity of walk[i]
- if i=1: shifted (-3, 3)
- elseif i=3: shifted (1,3)
- elseif i=5: shifted (-3, 3)
- elseif i=7: shifted (-1, -4) fi);
- endfor
-
- drawarrow (12 up -- 2 up ) shifted zenith withcolor tb;
- drawarrow (12 down -- 2 down) shifted nadir withcolor tr;
-
- fill fullcircle scaled 2;
-
+ pair zenith, nadir; zenith = nadir = origin;
+ color gain, lose; gain = .67 blue; lose = .85 red;
+ for i=1 upto 8:
+ path walk;
+ numeric y; y = 0;
+ walk = origin for x=w/n step w/n until w:
+ hide(
+ y := y if uniformdeviate 1 < 1/2: + else: - fi 1;
+ if y > ypart zenith: zenith := (x,y) ; fi
+ if y < ypart nadir: nadir := (x,y) ; fi
+ )
+ -- (x,y)
+ endfor;
+ undraw walk withpen pencircle scaled 3/4;
+ draw walk withcolor (1/2+y/h)[lose, gain];
+ endfor
+ draw origin withpen pencircle scaled 2;
+ drawarrow (12 up -- 2 up) shifted zenith withcolor gain;
+ drawarrow (12 down -- 2 down) shifted nadir withcolor lose;
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/random-walks-red-blue.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-bush.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-bush.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-bush.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -2,25 +2,19 @@
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
+\mplibshowlog{enable}
\begin{mplibcode}
+randomseed:=2321.57867;
input colorbrewer-rgb
vardef bush(expr start, aim, level, limit) =
- save s, target;
- numeric s; s = level / limit;
- for a = -32, -8, 8, 16:
- pair target;
- target = aim scaled ((32 + 16 normaldeviate) * s) rotated a shifted start;
- draw start -- target
- withpen pencircle scaled s
- withcolor BrBG[limit][limit-level];
- if level > 1:
- bush(target, aim rotated a, level - 1, limit);
- fi
- endfor
+ save s, target; pair target; numeric s; s = level / limit;
+ for a = -32, -8, 8, 16:
+ target := aim scaled ((64 + 32 normaldeviate) * s) rotated a shifted start;
+ draw start -- target withpen pencircle scaled s withcolor BrBG[limit][limit-level];
+ if level > 1: bush(target, aim rotated a, level - 1, limit); fi
+ endfor
enddef;
-beginfig(1);
-bush(origin, dir 80, 6, 8);
-endfig;
+beginfig(1); bush(origin, dir 80, 6, 8); endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-bush.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon-golden.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon-golden.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon-golden.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -4,19 +4,18 @@
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
-vardef acosd(expr a) = angle (a, 1 +-+ a) enddef;
numeric r, phi, theta;
-phi = 0.61803398875;
-r = phi**phi;
-theta = acosd(1/2(1/r + r - r * r * r));
+phi = 0.61803398875;
+r = phi ** phi;
+theta = angle (fullcircle scaled 2r intersectionpoint fullcircle scaled (2r*r) shifted right);
vardef dragon(expr a, b) =
- if abs(a-b) > 1:
+ if abs(a-b) > 1.618:
save p; pair p;
p = r[a, b] rotatedabout(a, theta);
dragon(a, p) & reverse dragon(b, p)
else:
- a -- b
+ a .. b
fi
enddef;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon-golden.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,35 +5,35 @@
\begin{mplibcode}
numeric r, theta; r = sqrt 1/2; theta = 45;
vardef dragon(expr level, a, b) =
- if level > 0:
- save p; pair p;
- p = r[a, b] rotatedabout(a, theta);
- dragon(level - 1, a, p) & reverse dragon(level - 1, b, p)
- else:
- a .. b
- fi
+ if level > 0:
+ save p; pair p;
+ p = r[a, b] rotatedabout(a, theta);
+ dragon(level - 1, a, p) & reverse dragon(level - 1, b, p)
+ else:
+ a .. b
+ fi
enddef;
vardef rounded_corners expr p =
- save r, n; numeric r, n; r = 1/3; n = length p;
- subpath (0, 1-r) of p
- for t=1 upto n-1:
- .. subpath (t+r, t+1-r) of p
- endfor .. subpath (n-r, n) of p
+ save r, n; numeric r, n; r = 1/3; n = length p;
+ subpath (0, 1-r) of p
+ for t=1 upto n-1:
+ .. subpath (t+r, t+1-r) of p
+ endfor .. subpath (n-r, n) of p
enddef;
beginfig(1);
- path d; d = dragon(15, origin, 240 right);
- draw d withpen pencircle scaled 1/4 withcolor (.2, .2, .7);
- label.top("The dragon curve at level 15", point 1/3 of bbox currentpicture);
+ path d; d = dragon(15, origin, 240 right);
+ draw d withpen pencircle scaled 1/4 withcolor (.2, .2, .7);
+ label.top("The dragon curve at level 15", point 1/3 of bbox currentpicture);
- draw rounded_corners dragon(10, origin, 240 right)
- shifted 280 down
- withcolor .54 red;
+ draw rounded_corners dragon(10, origin, 240 right)
+ shifted 280 down
+ withcolor .54 red;
- label.top("\dots\ and at level 10 with rounded corners", point 1/3 of bbox currentpicture);
-
+ label.top("\dots\ and at level 10 with rounded corners", point 1/3 of bbox currentpicture);
+
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-dragon.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake-construction.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake-construction.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake-construction.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,48 +5,27 @@
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
-path h[], snake;
-h0 = (for i = 1 upto 6: 40 dir 60i -- endfor cycle) rotated angle (9, -sqrt(3));
-for i = 1 upto 6:
- h[i] = h0 shifted (point 0 of h0 - point 2 of h0) rotated 60i;
-endfor
-snake = point 0 of h3 -- point 1 of h2 -- point 2 of h1
- -- point 1 of h6 -- point 2 of h5 -- point 3 of h0
- -- point 1 of h4 -- point 0 of h5;
-
-for i=1 upto 6:
- draw subpath (4, 9) of h[i] withcolor 3/4;
-endfor
-
-% path usnake;
-% usnake = snake
-% shifted - point 0 of h3
-% scaled (1/abs(point 0 of h3 - point 0 of h5));
-
-% def zx(expr a, b) = zscaled (point b of snake - point a of snake)
-% shifted point a of snake enddef;
-
-% draw usnake zx(1, 0) dashed withdots scaled 1/2 withcolor 2/3 red;
-% draw usnake zx(1, 2) dashed withdots scaled 1/2 withcolor 2/3 red;
-% draw usnake zx(2, 3) dashed withdots scaled 1/2 withcolor 2/3 red;
-% draw usnake zx(3, 4) dashed withdots scaled 1/2 withcolor 2/3 red;
-% draw usnake zx(5, 4) dashed withdots scaled 1/2 withcolor 2/3 red;
-% draw usnake zx(6, 5) dashed withdots scaled 1/2 withcolor 2/3 red;
-% draw usnake zx(6, 7) dashed withdots scaled 1/2 withcolor 2/3 red;
-
-
-draw 2/3[point 0 of h3, point 0 of h5] -- point 0 of h5 withcolor 1/2;
-drawarrow point 0 of h3 -- 2/3[point 0 of h3, point 0 of h5] withcolor 1/2;
-draw snake withcolor 2/3 red;
-for t=1, 5, 6:
- drawarrow subpath (t, t-2/3) of snake withcolor \mpcolor{textred};
-endfor
-for t=1, 2, 3, 6:
- drawarrow subpath (t, t+2/3) of snake withcolor \mpcolor{textred};
-endfor
-
-dotlabel.llft("$(0, 0)$", point 0 of h3);
-dotlabel.lrt ("$(1, 0)$", point 0 of h5);
+ path h[], snake;
+ h0 = for i = 1 upto 6: 40 dir 60i -- endfor cycle;
+ h0 := h0 rotated - angle (9, sqrt(3));
+ for i = 1 upto 6:
+ h[i] = h0 shifted (point 0 of h0 - point 2 of h0) rotated -(120+60i);
+ draw h[i] withcolor 3/4;
+ endfor
+ snake = point 0 of h1 -- point 1 of h2 -- point 2 of h3
+ -- point 1 of h4 -- point 2 of h5 -- point 3 of h6
+ -- point 4 of h5 -- point 0 of h5;
+ ahangle := 30;
+ z0 = point 0 of snake; z1 = point 8 of snake; z23 = 2/3[z0, z1];
+ drawoptions(withcolor 1/2);
+ drawarrow z0 -- z23; draw z23 -- z1;
+ drawoptions(withcolor \mpcolor{textred});
+ draw snake;
+ for t=1, 5, 6: drawarrow subpath (t, t-2/3) of snake; endfor
+ for t=1, 2, 3, 6: drawarrow subpath (t, t+2/3) of snake; endfor
+ drawoptions();
+ dotlabel.llft("$(0, 0)$", z0);
+ dotlabel.lrt ("$(1, 0)$", z1);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake-construction.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -15,37 +15,6 @@
snake := snake rotated - angle (point 0 of h5 - point 0 of h3);
snake := snake scaled (1 / length (point 0 of h5 - point 0 of h3));
-vardef hexon(expr a, b) =
- pair c, m;
- c = b rotatedaround(a, 60);
- m = 2/3[c, 1/2[a, b]];
- a -- a rotatedaround(m, 60) --
- b -- b rotatedaround(m, 60) --
- c -- c rotatedaround(m, 60) -- cycle
-enddef;
-
-path w;
-w = origin -- right;
-w := w -- point 0 of w rotatedabout(point 1 of w, 120);
-w := w -- point 1 of w rotatedabout(point 2 of w, -120);
-w := w rotated - angle (point 3 of w - point 0 of w);
-w := w scaled (1/abs (point 3 of w - point 0 of w));
-
-pair a, b;
-a = 144 down rotated -60;
-b = 144 down rotated +60;
-numeric n; n = 4;
-
-path boundary;
-boundary = hexon(a, b);
-for i = 1 upto n:
- boundary := for t = 1 upto length boundary:
- subpath (0, 2) of w
- zscaled (point t of boundary - point t-1 of boundary)
- shifted point t-1 of boundary -- endfor cycle;
-endfor
-
-
vardef rattle(expr level, a, b) =
if level > 0:
save s; path s; s = snake zscaled (b-a) shifted a;
@@ -61,9 +30,11 @@
fi
enddef;
beginfig(1);
- path s; s = rattle(n, a, b);
- fill a + (-40, 0) -- s -- b + (40, 0) --
- b + (40, 224) -- a + (-40, 224) -- cycle withcolor 3/4[1/4 blue, white];
+ pair a, b; path s;
+ a = 124 left; b = 124 right; s = rattle(4, a, b);
+ fill s -- b + (40, 0) -- b + (40, 224)
+ -- a - (40, -224) -- a - (40,0) -- cycle
+ withcolor 3/4[1/4 blue, white];
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-flowsnake.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-gcd-comparison.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-gcd-comparison.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-gcd-comparison.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,34 @@
+vardef gcd(expr a, b) = if b = 0: a else: gcd(b, a mod b) fi enddef;
+
+show
+ (gcd(560,257) = 1) and
+ (gcd(12,3384) = 12) and
+ (gcd(2454,541) = 1) and
+ (gcd(2824,494) = 2) and
+ (gcd(3633,2930) = 1) and
+ (gcd(3555,3738) = 3) and
+ (gcd(2743,3484) = 13) and
+ (gcd(1267,1330) = 7) and
+ (gcd(2718,1672) = 2) and
+ (gcd(2515,3980) = 5);
+
+vardef gcd(expr A, B) = save r, a, b; numeric a, b, r; a := A; b := B;
+ forever:
+ r := a mod b; exitif r = 0;
+ a := b; b := r;
+ endfor b
+enddef;
+
+show
+ (gcd(560,257) = 1) and
+ (gcd(12,3384) = 12) and
+ (gcd(2454,541) = 1) and
+ (gcd(2824,494) = 2) and
+ (gcd(3633,2930) = 1) and
+ (gcd(3555,3738) = 3) and
+ (gcd(2743,3484) = 13) and
+ (gcd(1267,1330) = 7) and
+ (gcd(2718,1672) = 2) and
+ (gcd(2515,3980) = 5);
+
+end.
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-gcd-comparison.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree-deviate.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree-deviate.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree-deviate.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -2,32 +2,33 @@
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
+\mplibshowlog{enable}
\begin{mplibcode}
-input colorbrewer-rgb
+% randomseed := uniformdeviate infinity;
+randomseed := 134.7384;
r = 0.75; theta = 17;
vardef make_tree(expr bar) =
- save a; numeric a; a = abs(point 1 of bar - point 0 of bar);
- cutdraw bar withpen pencircle scaled (a/8);
- if a > 5:
- save s; pair s; s = 1/32 a * r * unitvector(direction 1 of bar) rotated 90;
- make_tree(
- bar shifted - point 0 of bar shifted s
- scaled (r + 1/16 normaldeviate)
- rotated (theta + 8 normaldeviate)
- shifted point 1 of bar
- );
- make_tree(
- bar shifted - point 0 of bar shifted -s
- scaled (r + 1/16 normaldeviate)
- rotated -(theta + 8 normaldeviate)
- shifted point 1 of bar
- );
- fi
+ save a; numeric a; a = abs(point 1 of bar - point 0 of bar);
+ cutdraw bar withpen pencircle scaled (a/8);
+ if a > 5:
+ save s; pair s; s = 1/32 a * r * unitvector(direction 1 of bar) rotated 90;
+ make_tree(
+ bar shifted - point 0 of bar shifted s
+ scaled (r + 1/16 normaldeviate) rotated (theta + 8 normaldeviate)
+ shifted point 1 of bar
+ );
+ make_tree(
+ bar shifted - point 0 of bar shifted -s
+ scaled (r + 1/16 normaldeviate) rotated -(theta + 8 normaldeviate)
+ shifted point 1 of bar
+ );
+ fi
enddef;
beginfig(1);
-for i=1 upto 4:
+ for i=1 upto 4:
picture T; T = image(make_tree(origin -- 40 up)); draw T shifted (170i, 0);
-endfor
+ endfor
+ input show_name;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree-deviate.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,9 +6,10 @@
vardef make_tree(expr bar) =
save a; numeric a; a = abs(point 1 of bar - point 0 of bar);
cutdraw bar withpen pencircle scaled 1.2(1/8 a) withcolor background;
- cutdraw bar withpen pencircle scaled (1/8 a) withcolor 1/256(57, 35, 32);
+ cutdraw bar withpen pencircle scaled (1/8 a) withcolor 1/256(148,98,58);
if a > leaf:
- save s; pair s; s = 1/32 a * r * unitvector(direction 1 of bar) rotated 90;
+ save s; pair s;
+ s = 1/32 a * r * unitvector(direction 1 of bar) rotated 90;
make_tree(
bar shifted - point 0 of bar
shifted s scaled r rotated theta
@@ -20,14 +21,13 @@
shifted point 1 of bar
);
else:
- draw point 1 of bar withpen pencircle scaled 1 withcolor 2/3 green;
+ draw point 1 of bar withpen pencircle scaled 2 withcolor 2/3 green;
fi
enddef;
beginfig(1);
-numeric stem, leaf, r, theta;
-r = 0.75; theta = 14;
-stem = 100; leaf = 3; % max(1, round(stem * (r ** 12)));
-make_tree(origin -- stem * up);
+ numeric leaf, r, theta;
+ leaf = 3; r = 0.71; theta = 14;
+ make_tree(origin -- 100 up);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-general-tree.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-h-tree.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-h-tree.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-h-tree.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,25 +5,41 @@
\begin{mplibcode}
input colorbrewer-rgb
r = 0;
-vardef make_H(expr level, bar, thickness) =
+
+vardef decorate(expr a, b, s, z) =
+ save F, w; picture F; pair w; w = (mlog(a/b), 400 + normaldeviate);
+ F = thelabel(TEX("$\frac{" & decimal a & "}{" & decimal b & "}$") scaled s, z);
+
+
+ fill bbox F withcolor 1/4[white, if a/b < 1: red else: blue fi]; draw F;
+
+ draw w withpen pencircle scaled 1;
+enddef;
+
+vardef make_H(expr level, scale, bar, thickness, n, d) =
cutdraw bar withpen pencircle scaled thickness
- withcolor Blues[9][9 - floor(level/2)];
+ withcolor Blues[8][level];
+ decorate(n, d, scale, point 1/2 of bar);
+
% save spike, m; path spike; pair m; m = unitvector(direction 1/2 of bar rotated 90);
% spike = point 0 of bar .. m scaled +thickness shifted point 1/2 of bar .. point 1 of bar &
% point 1 of bar .. m scaled -thickness shifted point 1/2 of bar .. point 0 of bar & cycle;
% fill spike withcolor Reds 9 7;
- if level > 0:
+ if level > 1:
save foo, fo;
path foo, fo;
foo = bar shifted - point 1/2 of bar scaled 0.7071067811865475;
- make_H(level - 1, foo rotated 90 shifted point r of bar, thickness);
- make_H(level - 1, foo rotated 90 shifted point 1-r of bar, thickness);
+ make_H(level - 1, scale * .8, foo rotated (90+1/4normaldeviate) shifted point r of bar, thickness, n, n+d);
+ make_H(level - 1, scale * .8, foo rotated (90+1/4normaldeviate) shifted point 1-r of bar, thickness, n+d, d);
+ else:
+ decorate(n, n+d, scale, point 0 of bar);
+ decorate(n+d, d, scale, point 1 of bar);
fi
enddef;
beginfig(1);
-make_H(8, (left -- right) scaled 200, 1/2);
+make_H(9, 1.4, (left -- right) scaled 256, 1/2, 1, 1);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-h-tree.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-koch-steps.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-koch-steps.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-koch-steps.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,27 +5,27 @@
\begin{mplibcode}
vardef koch(expr level, a, b) =
- if level = 0:
- a -- b
- else:
- save p, q, r; pair p, q, r;
- p = 1/3[a,b]; r = 2/3[a,b]; q = r rotatedabout(p, 60);
- koch(level-1, a, p) &
- koch(level-1, p, q) &
- koch(level-1, q, r) &
- koch(level-1, r, b)
- fi
+ if level = 0:
+ a -- b
+ else:
+ save p, q, r; pair p, q, r;
+ p = 1/3[a,b]; r = 2/3[a,b]; q = r rotatedabout(p, 60);
+ koch(level-1, a, p) &
+ koch(level-1, p, q) &
+ koch(level-1, q, r) &
+ koch(level-1, r, b)
+ fi
enddef;
beginfig(1);
- wd = 300;
- for n=0 upto 4:
- numeric y; y = -1/3 wd * n;
- path k; k = koch(n, origin, (wd, 0)) shifted (0, y);
- draw k withcolor 2/3 blue;
- label.urt("\small\textsf{Level " & decimal n & "}", point infinity of k);
- label.top("$\scriptstyle " & decimal length k & "/" & decimal arclength k & "$", (wd/2, y));
- endfor
-
+ wd = 300;
+ for n=0 upto 4:
+ numeric y; y = -1/3 wd * n;
+ path k; k = koch(n, origin, (wd, 0)) shifted (0, y);
+ draw k withcolor 2/3 blue;
+ label.urt("\small\textsf{Level " & decimal n & "}", point infinity of k);
+ label.top("$\scriptstyle " & decimal length k & "/" & decimal arclength k & "$", (wd/2, y));
+ endfor
+ input show_name
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-koch-steps.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,36 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+
+vardef garland(expr level, shape) =
+ if level = 0:
+ fill shape withcolor filler; draw shape withpen pencircle scaled 1/8;
+ else:
+ save little_shape; path little_shape;
+ little_shape = shape scaled factor;
+ for i=1 upto length shape:
+ garland(level - 1, little_shape shifted (point i of shape - point i of little_shape));
+ endfor
+ fi
+enddef;
+vardef sf(expr n) =
+ numeric s; s = 0;
+ for k=1 upto floor (n/4):
+ s := s + cosd(360 / n * k);
+ endfor
+ 1 / (2 * (1 + s))
+enddef;
+beginfig(1);
+ color filler; numeric factor; path poly;
+ for n=5 upto 9:
+ filler := Reds[7][n-3]; factor := sf(n);
+ poly := for i=1 upto n: 64 up rotated (360/n*i) -- endfor cycle;
+ draw image(garland(3, poly)) shifted (144n, 0);
+ endfor
+ input show_name
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-garlands.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-pentagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-pentagon.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-pentagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,33 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-vardef make_gasket(expr t, s, level, c) =
- if level = 0:
- fill t withcolor Reds[7][7-c];
- draw t;
- else:
- save little_t; path little_t; little_t = t scaled s;
- for i=1 upto length t:
- make_gasket(little_t shifted (point i of t - point i of little_t), s, level-1, c);
- endfor
- fi
-enddef;
-vardef sf(expr n) =
- numeric s; s = 0;
- for k=1 upto floor (n/4):
- s := s + cosd(360 / n * k);
- endfor
- 1 / (2 * (1 + s))
-enddef;
-beginfig(1);
- for n=5 upto 9:
- draw image(make_gasket(for i=1 upto n: 64 up rotated (360/n*i) -- endfor cycle, sf(n), 3, n-4))
- shifted (144n, 0);
- endfor
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-pentagon.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-triangle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-triangle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-triangle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,19 +3,19 @@
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
-vardef make_gasket(expr t, s, limit) =
- if length (point 1 of t - point 0 of t) < limit:
- fill t;
- else:
- save little_t; path little_t; little_t = t scaled s;
- for i=1 upto length t:
- make_gasket(little_t shifted (point i of t - point i of little_t), s, limit);
- endfor
- fi
+vardef gasket(expr t, s, limit) =
+ if length (point 1 of t - point 0 of t) < limit:
+ fill t;
+ else:
+ save little_t; path little_t; little_t = t scaled s;
+ for i=1 upto length t:
+ gasket(little_t shifted (point i of t - point i of little_t), s, limit);
+ endfor
+ fi
enddef;
beginfig(1);
- path T; T = for i = 1 upto 3: 220 up rotated (120i) -- endfor cycle;
- make_gasket(T, 1/2, 20);
+ path T; T = for i = 1 upto 3: 220 up rotated (120i) -- endfor cycle;
+ gasket(T, 1/2, 20);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-sierpinski-triangle.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-simple-tree.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-simple-tree.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-simple-tree.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -15,18 +15,22 @@
fi
enddef;
beginfig(1);
-picture T[];
-numeric r, theta;
-r = 0.58; theta = 60; T1 = image(
- make_tree(3, origin -- 100 up);
- label.urt("\ $r=" & decimal r & "$, $\theta=" & decimal theta & "$", origin) withcolor \mpcolor{textred};
+picture T[]; numeric r, theta;
+r := 0.58; theta := 60; T1 = image(
+ make_tree(3, origin -- 100 up);
);
r := 0.75; theta := 14; T2 = image(
- make_tree(10, origin -- 100 up);
- label.urt("\ $r=" & decimal r & "$, $\theta=" & decimal theta & "$", origin) withcolor \mpcolor{textred};
+ make_tree(10, origin -- 100 up);
);
draw T1 shifted 32 up;
draw T2 shifted 128 right;
+
+drawoptions(withcolor \mpcolor{textred});
+r := 0.58; theta := 60;
+label.urt("\ $r=" & decimal r & "$, $\theta=" & decimal theta & "$", 32 up);
+
+r := 0.75; theta := 14;
+label.urt("\ $r=" & decimal r & "$, $\theta=" & decimal theta & "$", 128 right);
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rec-simple-tree.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rope.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rope.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/rope.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,21 +1,20 @@
+def twisted expr t of p =
+ rotated angle direction arctime t of p of p
+ shifted point arctime t of p of p
+enddef;
vardef rope expr c =
- save s, w, hemp, n, a, b, A;
- color hemp; hemp = 1/256 (192, 149, 82);
- numeric s, w, n, A;
- w = -1; n = -1; A = arclength c; s = A/floor(A/2);
- path a[];
- for t=0 step s until A + 1:
- a[incr n] = (0,+w) rotated angle direction arctime t-3/2s of c of c shifted point arctime t-3/2s of c of c
- .. (0,+w) rotated angle direction arctime t-1/2s of c of c shifted point arctime t-1/2s of c of c
- .. (0,-w) rotated angle direction arctime t+1/2s of c of c shifted point arctime t+1/2s of c of c
- .. (0,-w) rotated angle direction arctime t+3/2s of c of c shifted point arctime t+3/2s of c of c;
- endfor
- image(
- for i=1 upto n:
- path b; b = buildcycle(a[i-1], reverse a[i]);
- fill b withcolor 1/2[white, hemp];
- draw b withpen pencircle scaled 1/8;
- endfor
- )
- enddef;
+ save s, w, hemp, n, a, b, A;
+ color hemp; hemp = 1/256 (192, 149, 82);
+ w = -1; n = -1; A = arclength c; s = A/floor(A/2);
+ path a[];
+ for t=0 step s until A + 1: a[incr n] =
+ (0,+w) twisted t-3/2s of c .. (0,+w) twisted t-1/2s of c ..
+ (0,-w) twisted t+1/2s of c .. (0,-w) twisted t+3/2s of c;
+ endfor
+ image(for i=1 upto n:
+ path b; b = buildcycle(a[i-1], reverse a[i]);
+ fill b withcolor 1/2[white, hemp];
+ draw b withpen pencircle scaled 1/8;
+ endfor)
+enddef;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-cm.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-cm.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-cm.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,6 +1,3 @@
-numeric u[];
-u0 = 1 cm;
-u1 = 1 mm;
+numeric u[]; u0 = 1 cm; u1 = 5 mm; u2 = 1 mm;
drawoptions(withcolor 0.54 red);
input ruler
-drawoptions();
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-inch.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-inch.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-inch.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,6 +1,3 @@
-numeric u[];
-u0 = 1 in;
-u1 = 6 bp;
-drawoptions(withcolor 0.54 red);
+numeric u[]; u0 = 72; u1 = 18; u2 = 6;
+drawoptions(withcolor 0.67 blue);
input ruler
-drawoptions();
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-pt.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-pt.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler-pt.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,6 +0,0 @@
-numeric u[];
-u0 = 12 bp;
-u1 = 1 bp;
-drawoptions(withcolor 0.54 red);
-input ruler
-drawoptions();
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/ruler.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,19 +1,17 @@
% add a ruler along the left hand and lower edges
% of the bounding box of the currentpicture
-% ** meant to be embedded by something that sets u[] appropriately **
-path B; B = bbox currentpicture;
-for s=0, 1:
- path p; numeric a; pair o;
- p = subpath (0, 1) of if s=0: reverse fi B;
- a = arclength p;
- o = if s=0: left else: down fi;
- for i=0 upto 3:
- exitif not known u[i];
- for j=0 upto floor(a/u[i]):
- pair t; t = point arctime j*u[i] of p of p;
- draw (origin -- (6 - 2i) * o) shifted t;
- if i=0: label(decimal j, t shifted 12 o); fi
- endfor
+path B, p; pair o; B = bbox currentpicture;
+for s=-1, 1:
+ p := subpath (0, s) of B;
+ a := arclength p;
+ o := if s < 0: left else: down fi;
+ for i=0 upto 3:
+ exitif not known u[i];
+ for j=0 upto floor(a/u[i]):
+ pair t; t = point arctime j*u[i] of p of p;
+ draw (origin -- (7 - 2i) * o) shifted t;
+ if i=0: label(decimal j, t shifted 12 o); fi
endfor
- draw p;
-endfor
+ endfor
+ draw p;
+endfor
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn-code.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn-code.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn-code.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,17 +0,0 @@
-path globe, gap, ring[], limb[];
-globe = fullcircle scaled 2cm;
-gap = fullcircle xscaled 3cm yscaled .8cm;
-ring1 = fullcircle xscaled 4cm yscaled 1.2cm;
-ring2 = ring1 scaled 0.93;
-ring3 = ring1 scaled 0.89;
-limb1 = buildcycle(subpath(5,7) of ring1, subpath(8,4) of globe);
-limb2 = buildcycle(subpath(5,7) of gap, subpath(-2,6) of globe);
-picture saturn; saturn = image(
- fill ring1 withcolor .1 red + .1 green + .4 white;
- fill ring2 withcolor .2 white;
- fill ring3 withcolor .1 red + .1 green + .6 white;
- unfill gap;
- fill limb1 withcolor .2 red + .1 green + .7 white;
- fill limb2 withcolor .2 red + .1 green + .7 white;
-);
-draw saturn rotated 30;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,10 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-input saturn-code
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/saturn.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shadows.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shadows.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shadows.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,37 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-
-path b, w;
-b = ((-3,-4)--(3,-2)--(3,+2)--(-3,4)--cycle) scaled 5;
-w = b reflectedabout(up, down);
-
-numeric n;
-n = 128;
-
-picture B, W;
-B = image(for i=0 step 1/n until 1:
- draw point 4-i of b -- point 1+i**2 of b
- withcolor 1-i**8;
- endfor);
-
- W = image(for i=0 step 1/n until 1:
- draw point 4-i of w -- point 1+i**2 of w
- withcolor 3/4-i**8;
- endfor);
-
-for i=-9 upto 9:
- for j=-4 upto 4:
- draw if odd (i+j): W else: B fi shifted (i*30,j*30);
- endfor
-endfor
-
-clip currentpicture to bbox currentpicture yscaled 7/8;
-
-
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shadows.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shady-circles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shady-circles.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shady-circles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,24 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path c, C; numeric r; r = 60;
-c = fullcircle scaled 2r shifted (-r, 0);
-C = fullcircle scaled 4r shifted (2r, 0);
-numeric t, u;
-(t, whatever) = C intersectiontimes C shifted (center c - center C);
-(u, whatever) = c intersectiontimes (point t of C -- center c);
-path s;
-s = subpath (0, u) of c -- subpath (t, 4) of C -- cycle;
-for i=0 upto r:
- draw (left--right) scaled 2r rotated -42 shifted (3i, 0)
- withpen pencircle scaled 1/4 withcolor 2/3 blue;
-endfor
-clip currentpicture to s;
-draw c; draw C;
-draw center c -- center C -- point t of C -- cycle;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/shady-circles.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/show_name.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/show_name.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/show_name.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1 @@
+label.llft("\tiny\texttt{" & jobname & ".mp}", lrcorner bbox currentpicture);
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/show_name.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-circle-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-circle-labels.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-circle-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,15 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path C; C = fullcircle scaled 100; draw C withcolor 2/3 red;
-for i=0 upto 11:
- drawdot point 2/3 i of C withpen pencircle scaled dotlabeldiam;
- label("$p_{" & decimal i & "}$", point 2/3 i of C scaled 1.2);
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-circle-labels.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-number-line.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-number-line.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-number-line.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,14 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- draw (left--right) scaled 2in withcolor 2/3 red;
- for i=-4 upto 4:
- dotlabel.top("$" & decimal i & "$", (32i, 0));
- endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/simple-number-line.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/split-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/split-labels.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/split-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,25 +0,0 @@
-\documentclass[border=0mm]{standalone}
-\usepackage{luamplib}
-\def\s#1{\let\\\cr\vbox{\halign{\hfil\strut ##\hfil\cr#1\crcr}}}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input colorbrewer-rgb
-beginfig(1);
-z0 = origin; z1 = 100 down; z2 = 144 down;
-picture L[];
-L0 = thelabel(btex \vbox{\hsize 2in\parindent 0pt\raggedright
- An extended caption or label that will be set as a
- small paragraph with automatic hyphenation and
- line-wrapping.
-} etex, z0);
-L1 = thelabel(btex \s{Single line} etex, z1);
-L2 = thelabel(btex \s{Longer text split\\onto a new line} etex, z2);
-forsuffixes $=0,1,2:
- draw L$; draw bbox L$ withcolor Blues 8 2;
- draw fullcircle scaled 2 shifted z$ withcolor Reds 8 7;
-endfor
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/split-labels.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times-on-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times-on-circle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times-on-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,24 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input tangent-times
-
-beginfig(1);
-path C; pair p; numeric a, b;
-C = fullcircle scaled 100;
-p = 189 right rotated 30;
-(a, b) = tangent_times(C, p);
-
-draw C withpen pencircle scaled 2 withcolor 3/4[(.2, .2, .7), white];
-draw p -- subpath (a, b) of C -- cycle dashed evenly;
-label.llft("$C$", point 5 of C);
-dotlabel.urt("$p$", p);
-dotlabel.ulft("point $a$ of $C$", point a of C);
-dotlabel.lrt("point $b$ of $C$", point b of C);
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times-on-circle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangent-times.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,11 +0,0 @@
-vardef tangent_times(expr C, p) =
- save m, a, b, G, H;
- pair m; numeric a, b; path G, H;
- m = 1/2[p, center C];
- H = halfcircle scaled abs (p - center C)
- rotated angle (p - center C) shifted m;
- G = H rotatedabout(m, 180);
- (a, whatever) = C intersectiontimes H;
- (b, whatever) = C intersectiontimes G;
- (a, b if b < a: + 8 fi)
-enddef;
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-on-path.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-on-path.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-on-path.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,60 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\usepackage{dwmpcode}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path p; numeric s; s = 144;
-p := (origin {1, 3} .. (1, 0) .. {1, 2} (2, 0)) scaled s;
-
-ahangle := 20;
-ahlength := 6;
-picture P[];
-P1 = image(
- draw p withcolor 0.54 red;
- for t=0 upto length p: draw fullcircle scaled dotlabeldiam shifted point t of p; endfor
- label.bot(TEX("\mpl{point 0 of p}") scaled 0.8, point 0 of p shifted 16 right);
- label.urt(TEX("\mpl{point 1 of p}") scaled 0.8, point 1 of p);
- label.top(TEX("\mpl{point 2 of p}") scaled 0.8, point 2 of p shifted 16 left);
-);
-P2 = image(
- draw p withcolor 0.54 red;
- drawoptions(withcolor 1/2);
- for t=0 upto length p:
- drawarrow precontrol t of p -- postcontrol t of p;
- fill fullcircle scaled 2 shifted precontrol t of p;
- draw fullcircle scaled 4 shifted point t of p;
- endfor
- label.bot(TEX("\mpl{precontrol 0 of p}") scaled 0.8, precontrol 0 of p shifted (24, -2));
- label.top(TEX("\mpl{postcontrol 0 of p}") scaled 0.8, postcontrol 0 of p shifted (24, 4));
- label.top(TEX("\mpl{precontrol 1 of p}") scaled 0.8, precontrol 1 of p);
- label.bot(TEX("\mpl{postcontrol 1 of p}") scaled 0.8, postcontrol 1 of p);
- label.bot(TEX("\mpl{precontrol 2 of p}") scaled 0.8, precontrol 2 of p);
- label.top(TEX("\mpl{postcontrol 2 of p}") scaled 0.8, postcontrol 2 of p shifted (-24, 2));
- drawoptions();
-);
-P3 = image(
- draw p withcolor 0.54 red;
- drawoptions(withcolor 1/2);
- for t=0 step 1/4 until length p:
- pair s; s = 16 unitvector(direction t of p);
- drawarrow (-s -- s) shifted point t of p;
- draw point t of p withpen pencircle scaled 2;
- endfor
- drawoptions();
- numeric x, y; x = 8; y = -12;
- label.rt(TEX("\mpl{pair s;}") scaled 0.7, (x, y+10));
- label.rt(TEX("\mpl{for t=0 step 1/4 until length p:}") scaled 0.7, (x, y));
- label.rt(TEX("\quad\mpl{s := 16 unitvector(direction t of p);}") scaled 0.7, (x, y-10));
- label.rt(TEX("\quad\mpl{drawarrow (-s -- s) shifted point t of p);}") scaled 0.7, (x, y-20));
- label.rt(TEX("\quad\mpl{draw point t of p withpen pencircle scaled 2;}") scaled 0.7, (x, y-30));
- label.rt(TEX("\mpl{endfor}") scaled 0.7, (x, y-40));
-);
-draw P1;
-draw P2 shifted 144 down;
-draw P3 shifted 248 down;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-on-path.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-point-to-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-point-to-circle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-point-to-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,38 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-path C, C'; pair p, t, t';
-C = fullcircle scaled 100;
-p = 189 right rotated 30;
-
-C' = fullcircle zscaled p shifted 1/2 p;
-% t = C intersectionpoint C';
-% t' = reverse C intersectionpoint C';
-t = C intersectionpoint halfcircle zscaled p shifted 1/2 p;
-t' = C intersectionpoint halfcircle zscaled -p shifted 1/2 p;
-
-drawoptions(dashed withdots scaled 1/4 withcolor (.2, .2, .7));
-draw C'; draw t -- center C -- p;
-
-drawoptions(withcolor (.2, .2, .7));
-dotlabel.lrt("$m$", 1/2 p);
-dotlabel.llft("$o$", center C);
-
-drawoptions(dashed evenly);
-draw t -- p -- t';
-
-drawoptions();
-draw C;
-label.llft("$C$", point 5 of C);
-
-dotlabel.urt("$p$", p);
-dotlabel.ulft("$t$", t);
-dotlabel.bot("\strut $t'$", t');
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-point-to-circle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-exterior.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-exterior.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-exterior.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,55 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input tangent-times
-color tb; tb = (0.2, 0.2, 0.7);
-beginfig(1);
-path A, B;
-A = fullcircle scaled 144;
-B = fullcircle scaled 60 shifted (200, 140);
-
-numeric R, r;
-R = abs (point 0 of A - center A);
-r = abs (point 0 of B - center B);
-
-path C; numeric t, u;
-C = fullcircle scaled (2R-2r) shifted center A;
-(t, u) = tangent_times(C, center B);
-
-draw A withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw B withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw C withpen pencircle scaled 1 withcolor 7/8[blue, white];
-
-draw subpath (t, u) of C -- center B -- cycle dashed evenly withcolor 1/2;
-draw subpath (t, u) of A -- subpath (u-8, t) of B -- cycle;
-
-drawoptions(dashed withdots scaled 1/2 withcolor 1/4);
-forsuffixes $=t, u:
- draw point $ of C -- point $ of A;
- draw center B -- point $ of B;
-endfor
-
-drawoptions(withcolor tb);
-label.urt("$A$", point 1 of A);
-label.ulft("$B$", point 4 of B);
-label.urt("$C$", point 1/2 of C);
-drawdot center B withpen pencircle scaled dotlabeldiam;
-
-drawoptions();
-dotlabel.lrt("$t$", point t of C);
-dotlabel.ulft("$t'$", point t of A);
-dotlabel.ulft("$t''$", point t of B);
-dotlabel.ulft("$u$", point u of C);
-dotlabel.lrt("$u'$", point u of A);
-dotlabel.lrt("$u''$", point u of B);
-
-label.rt("$r$", 1/2[center B, point t of B]);
-label.rt("$r$", 1/2[point t of C, point t of A]);
-
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-exterior.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-interior.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-interior.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-interior.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,59 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-input tangent-times
-vardef adjust_time(expr tt, AA, BB) =
- tt + 1/45 angle (point 0 of AA - center AA)
- - 1/45 angle (point 0 of BB - center BB)
-enddef;
-beginfig(1);
-path A, B;
-A = fullcircle scaled 144 rotated uniformdeviate 360;
-B = fullcircle scaled 60 shifted 240 right rotated 36;
-
-numeric R, r;
-R = abs (point 0 of A - center A);
-r = abs (point 0 of B - center B);
-
-path C;
-C = fullcircle scaled (2R+2r) shifted center A; % NB +ve
-
-numeric t, t', t'', u, u', u'';
-(t, u) = tangent_times(C, center B);
-t' = adjust_time(t, C, A);
-u' = adjust_time(u, C, A);
-t'' = adjust_time(t + 4, C, B); % Note the plus fours
-u'' = adjust_time(u + 4, C, B);
-
-draw A withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw B withpen pencircle scaled 2 withcolor 3/4[blue, white];
-draw C withpen pencircle scaled 1 withcolor 3/4[blue, white];
-
-draw subpath (t', u') of A -- subpath (u'', t'') of B -- cycle;
-draw center B -- subpath (t, u) of C -- cycle dashed evenly;
-
-draw center B -- point t'' of B dashed withdots scaled 1/2;
-draw center B -- point u'' of B dashed withdots scaled 1/2;
-draw point t of C -- point t' of A dashed withdots scaled 1/2;
-draw point u of C -- point u' of A dashed withdots scaled 1/2;
-
-dotlabel.ulft(btex $t$ etex, point t of C);
-dotlabel.lrt (btex $t'$ etex, point t' of A);
-dotlabel.lrt (btex $t''$ etex, point t'' of B);
-dotlabel.lrt (btex $u$ etex, point u of C);
-dotlabel.ulft(btex $u'$ etex, point u' of A);
-dotlabel.ulft(btex $u''$ etex, point u'' of B);
-drawdot center B withpen pencircle scaled dotlabeldiam;
-
-drawoptions(withcolor 1/2[blue, white]);
- label.urt(btex $A$ etex, point 1/2(t'+u'- 7.6) of A);
- label.rt (btex $B$ etex, point 1/2(t''+u''- 2) of B);
- label.urt(btex $C$ etex, point 1/2(t+u-8) of C);
-drawoptions();
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tangents-two-circles-interior.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tikzcd-example.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tikzcd-example.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tikzcd-example.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,58 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-vardef sbox primary P =
- superellipse(1/2[point 1 of bbox P, point 2 of bbox P],
- 1/2[point 2 of bbox P, point 3 of bbox P],
- 1/2[point 3 of bbox P, point 0 of bbox P],
- 1/2[point 0 of bbox P, point 1 of bbox P], 0.75)
- enddef;
-
-beginfig(1);
- r = 0.9;
- z0 = (0, 0);
- z1 = r*(89, -55);
- z2 = r*(42, 30);
- z3 = z1 + z2;
-
- picture FE, FEV, E, EV, M, N, U, V;
- FE = thelabel("$f^*E$", (x0, y0));
- M = thelabel("$M$", (x0, y1));
- E = thelabel("$E$", (x1, y0));
- N = thelabel("$N$", (x1, y1));
- FEV = thelabel("$f^*E_V$", (x2, y2));
- U = thelabel("$U$", (x2, y3));
- EV = thelabel("$E_V$", (x3, y2));
- V = thelabel("$V$", (x3, y3));
-
- forsuffixes @=E, M, N, U, V, EV, FE, FEV: draw @; endfor
-
- ahangle := 20;
- vardef connect(expr a, b) =
- save line; path line;
- interim bboxmargin := 3;
- line = center a .. center b
- cutbefore sbox a cutafter sbox b;
- cutdraw line withpen pencircle scaled 4 withcolor background;
- drawarrow line
- enddef;
-
- connect(FEV, EV);
- connect(FEV, U);
- connect(EV, V);
- connect(U, V);
-
- connect(FEV, FE);
- connect(EV, E);
- connect(U, M);
- connect(V, N);
-
- connect(FE, E);
- connect(FE, M);
- connect(E, N);
- connect(M, N);
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tikzcd-example.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,20 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input tiling-ammann-procedures
+
+beginfig(1);
+
+ pickup pencircle scaled 1/8;
+ path shape; shape = r scaled 360;
+
+ bounded_rhomb(4, point 0 of shape, point 2 of shape);
+ draw shape withpen pencircle scaled 1/2;
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-bounded.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-procedures.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-procedures.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-procedures.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,81 @@
+% procedures for tiling-ammann-* drawings
+
+input colorbrewer-rgb
+
+def withalpha expr a =
+ withprescript "tr_alternative=2"
+ withprescript "tr_transparency=" & decimal a
+enddef;
+
+path r, s;
+r = origin -- (1/2, 1/2-sqrt(1/2)) -- right -- (1/2, sqrt(1/2)-1/2) -- cycle;
+s = origin -- (1/2, -1/2) -- right -- (1/2, 1/2) -- cycle;
+numeric p, q;
+p = sqrt(2) - 1; q = 1 - sqrt(1/2);
+vardef rhomb(expr level, a, b) =
+ save R; path R; R = r zscaled (b-a) shifted a;
+ if level = 0:
+ fill subpath (0, 2) of R -- cycle withalpha 0.9 withcolor Blues 9 3;
+ fill subpath (2, 4) of R -- cycle withalpha 0.9 withcolor Blues 9 4;
+ draw R withcolor 1/2;
+ else:
+ rhomb(level-1, a, p[a,b]);
+ rhomb(level-1, b, p[b,a]);
+ rhomb(level-1, point 1 of R, point 3 of R);
+ square(level-1, point 1 of R, point +p of R);
+ square(level-1, point 3 of R, point -p of R);
+ square(level-1, point 1 of R, point 2-p of R);
+ square(level-1, point 3 of R, point 2+p of R);
+ fi
+enddef;
+vardef square(expr level, a, b) =
+ save S; path S; S = s zscaled (b-a) shifted a;
+ if level = 0:
+ fill subpath (0, 2) of S -- cycle withalpha 0.9 withcolor Oranges 8 3;
+ fill subpath (2, 4) of S -- cycle withalpha 0.9 withcolor Oranges 8 2;
+ draw S withcolor 1/2;
+ else:
+ rhomb(level-1, a, q[point 1 of S, point 3 of S]);
+ rhomb(level-1, a, q[point 3 of S, point 1 of S]);
+ rhomb(level-1, point 1 of S, q[b,a]);
+ rhomb(level-1, point 3 of S, q[b,a]);
+ square(level-1, q[b,a], q[a,b]);
+ square(level-1, point 1 of S, point +p of S);
+ square(level-1, point 3 of S, point -p of S);
+ square(level-1, b, point +1+p of S);
+ square(level-1, b, point -1-p of S);
+ fi
+enddef;
+
+path t[];
+t0 = origin -- right -- point 3 of s -- cycle;
+t1 = origin -- right -- point 1 of s -- cycle;
+vardef bounded_rhomb(expr level, a, b) =
+ save R; path R; R = r zscaled (b-a) shifted a;
+ if level = 0:
+ fill subpath (0, 2) of R -- cycle withcolor Blues 9 4;
+ fill subpath (2, 4) of R -- cycle withcolor Blues 9 5;
+ draw R withcolor 1/2;
+ else:
+ bounded_rhomb(level-1, a, p[a,b]);
+ bounded_rhomb(level-1, b, p[b,a]);
+ bounded_rhomb(level-1, point 1 of R, point 3 of R);
+ half_square(level-1, point 1 of R, point +p of R, 1);
+ half_square(level-1, point 3 of R, point -p of R, 0);
+ half_square(level-1, point 3 of R, point 2+p of R, 1);
+ half_square(level-1, point 1 of R, point 2-p of R, 0);
+ fi
+enddef;
+vardef half_square(expr level, a, b, side) =
+ save T; path T; T = t[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withalpha 0.9 withcolor Oranges[8][3+side];
+ draw subpath (1, 3) of T withcolor 1/2;
+ else:
+ bounded_rhomb(level-1, point 0 of T, p[point 1/2 of T, point 2 of T]);
+ bounded_rhomb(level-1, point 2 of T, point sqrt(1/2) of T);
+ half_square(level-1, point 1 of T, point 2-p of T, side);
+ half_square(level-1, point 2 of T, point 3-p of T, side);
+ half_square(level-1, point 1-q of T, point q of T, 1-side);
+ fi
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-procedures.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,65 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input tiling-ammann-procedures
+
+path rr, ss, tt;
+rr = r scaled 48;
+ss = t0 scaled 36;
+tt = t1 scaled 36;
+
+dotlabeldiam := 2;
+
+picture P[];
+P1 = image(
+ bounded_rhomb(0, point 0 of rr, point 2 of rr);
+ dotlabel.ulft("$a$", point 0 of rr);
+ dotlabel.urt("$b$", point 2 of rr);
+);
+P2 = image(
+ draw rr dashed withdots scaled 1/4;
+ bounded_rhomb(1, point 0 of rr, point 2 of rr);
+);
+P3 = image(
+ drawarrow 16 left -- 20 right;
+ label(P1, 50 left);
+ label(P2, 50 right);
+);
+
+P4 = image(
+ half_square(0, point 0 of ss, point 1 of ss, 0);
+ dotlabel.ulft("$a$", point 0 of ss);
+ dotlabel.urt ("$b$", point 1 of ss);
+);
+P5 = image(
+ half_square(0, point 0 of tt, point 1 of tt, 1);
+);
+P6 = image(
+ half_square(1, point 0 of ss, point 1 of ss, 0);
+ draw ss dashed withdots scaled 1/4;
+);
+P7 = image(
+ half_square(1, point 0 of tt, point 1 of tt, 1);
+ draw tt dashed withdots scaled 1/4;
+);
+
+P8 = image(
+ label.top(P4, 50 left);
+ label.bot(P5, 50 left);
+ label.top(P6, 50 right + 8 up);
+ label.bot(P7, 50 right + 8 down);
+ path a; a = 18 left -- 24 right;
+ drawarrow a rotated 4 shifted 12 up;
+ drawarrow a rotated -4 shifted 12 down;
+);
+
+beginfig(1);
+ label.lft(P3, 13 left);
+ label.rt (P8, 13 right);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-bounded.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,59 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input tiling-ammann-procedures
+
+picture P[];
+
+path ss, rr;
+
+ss = s scaled 36;
+rr = r scaled 48;
+
+dotlabeldiam := 2;
+
+P1 = image(
+ square(0, point 0 of ss, point 2 of ss);
+ dotlabel.ulft("$a$", point 0 of ss);
+ dotlabel.urt ("$b$", point 2 of ss);
+);
+P2 = image(
+ draw ss dashed withdots scaled 1/4;
+ square(1, point 0 of ss, point 2 of ss);
+);
+
+P3 = image(
+ drawarrow 20 left -- 20 right;
+ label(P1, 50 left);
+ label(P2, 50 right);
+);
+
+P4 = image(
+ rhomb(0, point 0 of rr, point 2 of rr);
+ dotlabel.ulft("$a$", point 0 of rr);
+ dotlabel.urt("$b$", point 2 of rr);
+);
+
+P5 = image(
+ draw rr dashed withdots scaled 1/4;
+ rhomb(1, point 0 of rr, point 2 of rr);
+
+);
+
+P6 = image(
+ drawarrow 16 left -- 20 right;
+ label(P4, 50 left);
+ label(P5, 50 right);
+
+);
+
+beginfig(1);
+ label.lft(P6, 13 left);
+ label.rt(P3, 13 right);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann-substitutions-overlapping.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,20 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input tiling-ammann-procedures
+
+beginfig(1);
+
+ pickup pencircle scaled 1/8;
+ path shape; shape = r scaled 360;
+
+ rhomb(4, point 0 of shape, point 2 of shape);
+ draw shape withpen pencircle scaled 1/2;
+
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-ammann.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,51 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+ input colorbrewer-rgb
+ path s[], t[];
+ s1 = unitsquare scaled 21 rotated 15; s2 = s1 rotated 150;
+ t1 = subpath (4, 3) of s1 -- point 1 of s2 -- cycle;
+ t2 = t1 reflectedabout(point 1 of t1, point 2 of t1);
+ t3 = t1 rotated 150; t4 = t1 rotated 210;
+ picture color_unit, grid_unit;
+ color_unit = image(
+ fill s1 withcolor Oranges 8 1;
+ fill s2 withcolor Oranges 8 2;
+ fill t1 withcolor Blues 8 1;
+ fill t2 withcolor Blues 8 2;
+ fill t3 withcolor Blues 8 3;
+ fill t4 withcolor Blues 8 4;
+ );
+ grid_unit = image(
+ draw s1; draw s2;
+ draw t2; draw t3; draw t4;
+ );
+ pair u, v;
+ u = point 1 of s1 - point 1 of s2;
+ v = u rotated 90;
+ numeric n; n = 3;
+ forsuffixes $=color_unit, grid_unit:
+ for i=-n upto n:
+ for j=-n upto n:
+ draw $ shifted (i * u + j * v);
+ endfor
+ endfor
+ endfor
+
+ label.bot("The arrangement of polygons in the units was carefully",
+ point 1/2 of bbox currentpicture shifted 21 down);
+ label.bot("chosen to give the tiling neat edges.",
+ point 1/2 of bbox currentpicture);
+ path b; b = bbox currentpicture shifted 34 down;
+ draw color_unit shifted point 1/4 of b;
+ draw grid_unit shifted point 3/4 of b;
+ path b; b = bbox currentpicture shifted 13 down;
+ label("\texttt{color\_unit}", point 1/4 of b);
+ label("\texttt{grid\_unit}", point 3/4 of b);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-3-4.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,50 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+def withalpha expr a = % <-- this requires "luamplib"
+ withprescript "tr_alternative=2"
+ withprescript "tr_transparency=" & decimal a
+enddef;
+input colorbrewer-rgb
+path d; d = for i=1 upto 12: 18 dir (15+30i) -- endfor cycle;
+
+color shade[];
+shade0 = Oranges 8 4; shade1 = Blues 8 4;
+shade2 = Greens 8 4; shade3 = Reds 8 4;
+
+vardef unit(expr n) = image(
+ fill d withalpha 0.9 withcolor shade[n mod 4];
+ draw d;
+) enddef;
+pair u, v;
+u = point 0 of d - point 3 of d;
+v = u rotated 60;
+numeric n; n = 6;
+for i=-n upto n:
+ for j=-n upto n:
+ draw unit(3i-7j) shifted ((i-floor(j/2)) * u + j * v);
+ endfor
+endfor
+clip currentpicture to unitsquare shifted -(1/2, 1/2) scaled 42n;
+
+picture p; p = image(
+ draw d; draw point 0 of d withpen pencircle scaled 2;
+ drawoptions(withcolor 3/4[red, white]);
+ draw d shifted u; draw point 0 of d shifted u withpen pencircle scaled 2;
+ drawoptions(withcolor 3/4[blue, white]);
+ draw d shifted v; draw point 0 of d shifted v withpen pencircle scaled 2;
+ drawoptions();
+ drawarrow origin -- u withcolor red;
+ drawarrow origin -- v withcolor blue;
+);
+label.bot(p, point 1/2 of bbox currentpicture shifted 13 down);
+label.bot(btex \vbox{\hsize 3.4in\noindent
+The vectors are chosen so that the dodecagons overlap to make
+the required triangles, squares, and hexagons.} etex,
+point 1/2 of bbox currentpicture shifted 13 down);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-3-4-6-4.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,63 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+
+path unithex;
+unithex = for i = 0 upto 5: dir 60i -- endfor cycle;
+unithex := unithex shifted - point 4 of unithex;
+
+def fixed_at_point expr n of p =
+ zscaled (point n of p - point n+1 of p) shifted point n+1 of p
+enddef;
+
+beginfig(1);
+ path dodo, h[], s[];
+ dodo = for i = 1 upto 12: 21 dir (15 + 30i) -- endfor cycle;
+ h1 = unithex fixed_at_point 1 of dodo;
+ h2 = unithex fixed_at_point 3 of dodo;
+ s1 = unitsquare fixed_at_point 0 of dodo;
+ s2 = unitsquare fixed_at_point 2 of dodo;
+ s3 = unitsquare fixed_at_point 4 of dodo;
+
+ picture colour_unit, line_unit;
+ colour_unit = image(
+ fill dodo withcolor Greens 9 2;
+ fill h1 withcolor Greens 9 3;
+ fill h2 withcolor Greens 9 3;
+ fill s1 withcolor Greens 9 4;
+ fill s2 withcolor Greens 9 4;
+ fill s3 withcolor Greens 9 4;
+ );
+ line_unit = image(
+ forsuffixes $=dodo, s1, s2, s3, h1, h2:
+ draw $ withpen pencircle scaled 1/4;
+ pair m; m = center $; % all shapes have even number of sides
+ for i=1 upto length $:
+ cutdraw m -- point i - 1/2 of $
+ if odd i: cutbefore fullcircle scaled (length $ / 4) shifted m fi
+ withpen pencircle scaled 1/4
+ withcolor Reds 4 3;
+ endfor
+ endfor
+ );
+
+ pair u, v;
+ u = point 3 of s2 - point 8 of dodo;
+ v = u rotated 60;
+
+ numeric n; n = 4;
+ forsuffixes @ = colour_unit, line_unit:
+ for i=-n upto n:
+ for j=-n upto n:
+ draw @ shifted (i*u + j*v - floor(i/2) * v);
+ endfor
+ endfor
+ endfor
+
+ clip currentpicture to bbox dodo scaled 2n yscaled sqrt(3/4);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-6-12.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,34 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(1);
+input colorbrewer-rgb
+path o, r[];
+o = (for i=0 upto 7: 21 dir 45i -- endfor cycle) rotated -90/4;
+pair t; t = whatever[point 0 of o, point 1 of o]
+ = whatever[point 2 of o, point 3 of o];
+r1 = subpath (1,2) of o -- t -- cycle;
+r2 = r1 rotated 90;
+r3 = r2 rotated 90;
+r4 = r3 rotated 90;
+
+picture filler;
+filler = image(
+ filldraw r1 withcolor Reds 8 3;
+ filldraw r2 withcolor Blues 8 3;
+ filldraw r3 withcolor Reds 8 3;
+ filldraw r4 withcolor Blues 8 3;
+ filldraw o withcolor Purples 8 2;
+);
+beginfig(1);
+ draw filler;
+ label.bot("\begin{tabular}{c}The \texttt{filler} picture\\(unrotated)\end{tabular}", point 1/2 of bbox filler);
+
+ draw o shifted 120 right;
+ label.bot("The octagon path \texttt{o}", point 1/2 of bbox o shifted 120 right);
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8-parts.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,33 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+input colorbrewer-rgb
+path o, r[];
+o = (for i=0 upto 7: 21 dir 45i -- endfor cycle) rotated -90/4;
+pair t; t = whatever[point 0 of o, point 1 of o]
+= whatever[point 2 of o, point 3 of o];
+r1 = subpath (1,2) of o -- t -- cycle;
+r2 = r1 rotated 90;
+r3 = r2 rotated 90;
+r4 = r3 rotated 90;
+picture filler; filler = image(
+ filldraw r1 withcolor Reds 8 3;
+ filldraw r2 withcolor Blues 8 3;
+ filldraw r3 withcolor Reds 8 3;
+ filldraw r4 withcolor Blues 8 3;
+ filldraw o withcolor Purples 8 2;
+);
+pair u, v;
+u = point 0 of o - point 5 of o; v = u rotated 90;
+beginfig(1);
+ numeric n; n = 5;
+ for i=-n upto n: for j=-n upto n:
+ draw filler rotated ((i+j) mod 2 * 90) shifted (i*u + j*v);
+ endfor endfor
+ for i=-n upto n: for j=-n upto n:
+ draw o shifted (i*u + j*v);
+ endfor endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-4-8-8.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,47 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+beginfig(1);
+
+ path h[]; pair m[];
+ for i=0 upto 2:
+ h[i] = (for j=0 upto 5: 30 dir 60j -- endfor cycle);
+ h[i] := h[i] shifted - point 0 of h[i] rotated (30+120i);
+ m[i] = 1/2[point 0 of h[i], point 3 of h[i]];
+ endfor
+
+ picture unit;
+ unit = image(
+ numeric i; i = -1;
+ forsuffixes $ = Purples, Oranges, Blues:
+ pair m; m = m[incr i];
+ for j=1 upto 3:
+ fill subpath (-2i+2j, 2-2i+2j) of h[i] -- m -- cycle withcolor $[8][1+j];
+ endfor
+ for j=1 upto 3:
+ draw m -- point 2j of h[i] withcolor $[8][1];
+ endfor
+ endfor
+
+ );
+
+ pair u, v;
+ u = point 3 of h1 - point 1 of h0;
+ v = u rotated 60;
+
+ numeric n; n = 4;
+ for i=-n upto n:
+ for j=-n upto n:
+ draw unit shifted (i*u + j*v);
+ endfor
+ endfor
+
+ path se; se = superellipse(right, up, left, down, 0.86);
+ clip currentpicture to se scaled 168;
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hexagon.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,54 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+
+beginfig(1);
+ path t[], s[], h;
+ h = for i=0 upto 5: 42 dir 60i -- endfor cycle;
+ for i = 1 upto 3:
+ s[i] = unitsquare zscaled (point i-1 of h - point i of h) shifted point i of h;
+ endfor
+ t1 = point 1 of h -- point 3 of s1 -- point 2 of s2 -- cycle;
+ t2 = point 2 of h -- point 3 of s2 -- point 2 of s3 -- cycle;
+
+ picture unit;
+ unit = image(
+ for i=1 upto 2:
+ fill t[i] withcolor Blues 8 4;
+ endfor
+ for i=1 upto 3:
+ fill s[i] withcolor Greens 8 1;
+ endfor
+ fill h withcolor Oranges 9 4;
+ forsuffixes $=t1, t2:
+ pair m; m = 2/3[point 0 of $, point 3/2 of $];
+ for i=1 upto 3:
+ draw m -- point i+1/2 of $ withcolor Blues 8 8;
+ endfor
+ endfor
+ forsuffixes $=s1, s2, s3:
+ draw point 1/2 of $ -- point 5/2 of $ withcolor Oranges 8 8;
+ draw point 3/2 of $ -- point 7/2 of $ withcolor Blues 8 8;
+ endfor
+ for i=1 upto 3:
+ draw point i-1/2 of h -- point i+5/2 of h withcolor Oranges 8 8;
+ endfor
+ );
+
+ pair u, v;
+ u = point 3 of s2 - point 4 of h;
+ v = u rotated 60;
+
+ numeric n; n=4;
+ for i=-n upto n:
+ for j=-n upto n:
+ draw unit shifted (i*u + j*v - floor (j/2) * u);
+ endfor
+ endfor
+ clip currentpicture to fullcircle scaled (7/4n * abs(u));
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-hst.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hex-parts.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hex-parts.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hex-parts.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,48 @@
+input colorbrewer-rgb
+% a polygon of n sides on a given path
+vardef poly expr n of p =
+ clearxy; z0 = point 0 of p; z1 = point 1 of p;
+ for i=2 upto n-1:
+ z[i] = z[i-2] rotatedabout(z[i-1], 360/n-180);
+ endfor
+ for i=0 upto n-1: z[i] -- endfor cycle
+enddef;
+vardef centroid(expr p) = save n; n = length p; origin for i=1 upto n: + point i of p / n endfor enddef;
+path t[], h;
+h = poly 6 of (origin -- 21 dir 60);
+for i=1 upto 6:
+ t[i] = poly 3 of subpath (i, i-1) of h;
+endfor
+picture P[], unit[];
+for k=0, 2:
+ t7 := poly 3 of subpath (k, k-1) of t6;
+ t8 := poly 3 of subpath (k, k-1) of t3;
+ pair u, v;
+ u = point 2+k/2 of h - point 2 of t6;
+ v = u rotated -60;
+ unit[k] = image(
+ for i=1 upto 6:
+ fill t[i] withcolor Blues 8 if odd i: 2 else: 3 fi;
+ endfor
+ for i=7 upto 8:
+ fill t[i] withcolor Oranges 8 if odd i: 3 else: 2 fi;
+ endfor
+ fill h withcolor Oranges 8 1;
+ forsuffixes $=h, t1, t2, t3, t4, t5, t6, t7, t8:
+ draw $ withpen pencircle scaled 1/4 withcolor 1/2;
+ for i=1 upto length $:
+ draw centroid($) -- point i - 1/2 of $ withcolor Reds 7 6;
+ endfor
+ endfor
+ );
+
+ numeric n; n=4;
+ P[k] = image(
+ for i=-n upto n:
+ for j=-n upto n:
+ draw unit[k] shifted (i*u + j*v - floor (j/2) * u);
+ endfor
+ endfor
+ clip currentpicture to superellipse(168 right, 168 up, 168 left, 168 down, 0.78);
+ );
+endfor
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hex-parts.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,12 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input tiling-arch-snub-hex-parts
+beginfig(1);
+ draw unit0 shifted 50 left;
+ draw unit2 shifted 50 right;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon-unit.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,14 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input tiling-arch-snub-hex-parts
+beginfig(1);
+draw P0 shifted 180 up;
+draw P2 shifted 180 down;
+numeric wd; wd = xpart (urcorner P0 - llcorner P0);
+currentpicture := currentpicture scaled (250/wd);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-hexagon.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,58 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-cmyk
+% a polygon of n sides on a given path
+vardef poly expr n of p =
+ save x, y;
+ z0 = point 0 of p;
+ z1 = point 1 of p;
+ for i=2 upto n-1:
+ z[i] = z[i-2] rotatedabout(z[i-1], 180(2/n-1));
+ endfor
+ for i=0 upto n-1: z[i] -- endfor cycle
+enddef;
+vardef centroid(expr P) =
+ (origin for i=1 upto length P: + point i of P endfor) / length P
+enddef;
+beginfig(1);
+ path t[], s[];
+ s1 = poly 4 of (origin -- 42 dir 15);
+ t1 = poly 3 of subpath (2, 1) of s1;
+ t2 = poly 3 of subpath (3, 2) of s1;
+ t3 = poly 3 of subpath (2, 1) of t1;
+ t4 = poly 3 of subpath (2, 1) of t2;
+ s2 = poly 4 of subpath (2, 1) of t4;
+
+ picture unit;
+ unit = image(
+ fill s1 withcolor Oranges 8 5;
+ fill t1 withcolor Blues 8 4;
+ fill t4 withcolor Blues 8 3;
+ fill t3 withcolor Greens 8 4;
+ fill t2 withcolor Greens 8 3;
+ fill s2 withcolor Reds 8 5;
+ forsuffixes $=s1, t1, s2, t2, t3, t4:
+ pair m; m = centroid($);
+ for i=1 upto length $:
+ draw point i - 1/2 of $ -- m
+ withpen pencircle scaled 3/2 withcolor Spectral 3 2;
+ endfor
+ endfor
+ );
+
+ pair u, v;
+ u = point 2 of t2 - point 0 of s1;
+ v = point 2 of t3 - point 0 of s1;
+
+ for i=0 upto 6:
+ for j=0 upto 9:
+ draw unit shifted (i*u + j*v);
+ endfor
+ endfor
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-arch-snub-square.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,189 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+numeric u; u = 10;
+path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+picture P[];
+% (4,6,12)
+numeric dx; dx = u*(1+ cosd(15)/sind(15));
+picture unit; unit = image(
+ path s; s = unitsquare shifted -(1/2,1/2) scaled u shifted (dx/2,0);
+ for t=0 upto 2:
+ draw s rotated 120t;
+ for tt=1 upto 3:
+ draw subpath(3,4) of s rotated (120t+30tt);
+ endfor
+ endfor
+);
+P1 = image(
+ draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+ for x=-5dx step dx until 5dx:
+ for y=-5dx step dx until 5dx:
+ draw unit shifted (x,0) shifted ((y,0) rotated 60);
+ endfor
+ endfor
+ clip currentpicture to box; draw box dashed withdots scaled 1/4;
+ label.bot("$(4, 6, 12)$", point 1/2 of bbox currentpicture);
+);
+numeric dx; dx = u*(cosd(180/8)/sind(180/8));
+path octagon; octagon = for t = 0 upto 7: 1/2(dx,u) rotated 45t -- endfor cycle;
+P2 = image(
+ draw octagon withpen pencircle scaled 4 withcolor .8[red,white];
+ for x=-5dx step dx until 5dx:
+ for y=-5dx step dx until 5dx:
+ draw octagon shifted (x,y);
+ endfor
+ endfor
+ clip currentpicture to box; draw box dashed withdots scaled 1/4;
+ label.bot("$(4, 8^2)$", point 1/2 of bbox currentpicture);
+);
+
+numeric dx; dx = u*(cosd(180/12)/sind(180/12));
+path unit; unit = for t=0 upto 11: 1/2(dx,u) rotated 30t -- endfor cycle;
+P3 = image(
+ draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+ for x=-5dx step dx until 5dx:
+ for y=-5dx step dx until 5dx:
+ draw unit shifted (x,0) shifted ((y,0) rotated 60);
+ endfor
+ endfor
+ clip currentpicture to box; draw box dashed withdots scaled 1/4;
+ label.bot("$(3, 12^2)$", point 1/2 of bbox currentpicture);
+);
+
+% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+% clip currentpicture to box; draw box dashed evenly;
+
+% endfig;
+
+% beginfig(4);
+% % (6^3)
+% save dx; dx = 3u;
+% picture unit; unit = image(
+% for t=0 upto 2:
+% draw origin -- (u,0) rotated 120t;
+% endfor
+% );
+
+% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+
+% for x=-5dx step dx until 5dx:
+% for y=-5dx step dx/3 until 5dx:
+% draw unit shifted (x,0) shifted (y,0) shifted ((y,0) rotated 60);
+% endfor
+% endfor
+
+% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+% clip currentpicture to box; draw box dashed evenly;
+
+% endfig;
+
+% (3,4,6,4)
+numeric dx; dx = u*(1+cosd(30)/sind(30));
+picture unit; unit = image(
+ path s; s = unitsquare shifted -(1/2,1/2) scaled u shifted (dx/2,0);
+ for t=0 upto 2:
+ draw s rotated 120t;
+ endfor
+);
+P4 = image(
+ draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+ for x=-5dx step dx until 5dx:
+ for y=-5dx step dx until 5dx:
+ draw unit shifted (x,0) shifted ((y,0) rotated 60);
+ endfor
+ endfor
+ clip currentpicture to box; draw box dashed withdots scaled 1/4;
+ label.bot("$(3, 4, 6, 4)$", point 1/2 of bbox currentpicture);
+);
+
+% beginfig(6);
+% % (3,6,3,6)
+% save dx; dx = 2u;
+% path unit; unit = for t=0 upto 5: (u,0) rotated 60t -- endfor cycle;
+
+% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+
+% for x=-5dx step dx until 5dx:
+% for y=-5dx step dx until 5dx:
+% draw unit shifted (x,0) shifted ((y,0) rotated 60);
+% endfor
+% endfor
+
+% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+% clip currentpicture to box; draw box dashed evenly;
+
+% endfig;
+
+% beginfig(7);
+% % (4^4)
+% save dx; dx = 4u;
+% path unit; unit = unitsquare shifted -(1/2,1/2) scaled 2u;
+
+% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+
+% for x=-5dx step dx until 5dx:
+% for y=-5dx step dx until 5dx:
+% draw unit shifted (x,0) shifted (y/2,y/2);
+% endfor
+% endfor
+
+% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+% clip currentpicture to box; draw box dashed evenly;
+
+% endfig;
+
+% beginfig(8);
+% % (3^4,6)
+% save dx; dx = 2u;
+% picture unit; unit = image(
+% for t=0 upto 5: draw ((2u,0) -- (u,0)
+% -- (u,0) rotated 60
+% -- (u,0) rotated 60 shifted (u,0)
+% ) rotated 60t; endfor
+% );
+
+% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+
+% for x=-5dx step dx until 5dx:
+% for y=-5dx step dx until 5dx:
+% draw unit shifted (x,0) shifted ((x/2,0) rotated -60)
+% shifted ((y,0) rotated 60) shifted (y/2,0);
+% endfor
+% endfor
+
+% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+% clip currentpicture to box; draw box dashed evenly;
+
+% endfig;
+% beginfig(9);
+% % (3^2,4,3,4)
+% save dx; dx = u;
+% picture unit; unit = image(
+% for t=0 upto 3: draw ( (u/2,-u/2) -- (u/2+u*sqrt(3)/2,0) -- (u/2,u/2) -- cycle) rotated 90t; endfor
+% );
+
+% draw unit withpen pencircle scaled 4 withcolor .8[red,white];
+
+% for x=-5dx step dx until 5dx:
+% for y=-5dx step dx until 5dx:
+% draw unit shifted (x,0) shifted ((x,0) rotated 30)
+% shifted (0,y) shifted ((0,y) rotated 30);
+% endfor
+% endfor
+
+% path box; box = unitsquare shifted -(1/2,1/2) scaled 12u;
+% clip currentpicture to box; draw box dashed evenly;
+
+% endfig;
+beginfig(1);
+ draw P1;
+ draw P2 shifted (12.5u, 0);
+ draw P3 shifted (0, -14.4u);
+ draw P4 shifted (12.5u, -14.4u);
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-archimedes.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,23 @@
+\documentclass[margin=1mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+input tiling-pinwheel-macro
+beginfig(1);
+pair a, b, c, d, e, f, g;
+a = origin; b = 180 right; c = 1/2 b rotated 90;
+d = 1/2[a,b]; e = 1/5[c,b]; f = 1/2[a,e]; g = 1/2[b,e];
+pinwheel(1,a,b,c,"");
+
+dotlabel.llft("$a$", a);
+dotlabel.lrt ("$b$", b);
+dotlabel.ulft("$c$", c);
+dotlabel.bot ("$d$", d);
+dotlabel.urt ("$e$", e);
+dotlabel.ulft("$f$", f);
+dotlabel.urt ("$g$", g);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-conway.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-hex-trig.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-hex-trig.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-hex-trig.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -24,49 +24,49 @@
currentpicture
enddef;
beginfig(1);
- path hexagon, triangle; pair u, v; numeric n;
- hexagon = for i=0 upto 5: (0, 16) rotated 60i -- endfor cycle;
- triangle = for i=0 upto 2: (0, 16) rotated 120i -- endfor cycle;
+ path hexagon, triangle; pair u, v; numeric n;
+ triangle = for i=0 upto 2: (0, 16) rotated 120i -- endfor cycle;
+ hexagon = for i=0 upto 5: (0, 16) rotated 60i -- endfor cycle;
- u = point 0 of triangle - point 1 of triangle;
- v = u rotated -60;
+ u = point 0 of triangle - point 1 of triangle;
+ v = u rotated -60;
- path s; s = superellipse(89 right, 89 up, 89 left, 89 down, 0.78);
- n = 8;
- picture P[];
- P3 = make_image(triangle, n, u, v, s, true);
- P6 = make_image(hexagon, n, u, v, s, true);
+ path s; s = superellipse(89 right, 89 up, 89 left, 89 down, 0.78);
+ n = 8;
+ picture P[];
+ P3 = make_image(triangle, n, u, v, s, true);
+ P6 = make_image(hexagon, n, u, v, s, true);
- picture T; T = image(
- path t'; t' = triangle reflectedabout(point 0 of triangle, point 1 of triangle);
- fill triangle withcolor Reds 8 2;
- fill t' withcolor Blues 8 2;
- draw triangle;
- draw t';
- );
- P4 = make_image(T, n, u, v, s, true);
- picture H; H = image(
- path ha, hb;
- ha = hexagon reflectedabout(point 0 of hexagon, point 1 of hexagon);
- hb = hexagon reflectedabout(point 0 of hexagon, point 5 of hexagon);
- fill hexagon withcolor Oranges 8 2;
- fill ha withcolor Blues 8 2;
- fill hb withcolor Greens 8 2;
- draw hexagon; draw ha; draw hb;
- );
- P7 = make_image(H, n, u zscaled 1.732 dir 30, v zscaled 1.732 dir 30, s, true);
+ picture T; T = image(
+ path t'; t' = triangle reflectedabout(point 0 of triangle, point 1 of triangle);
+ fill triangle withcolor Reds 8 2;
+ fill t' withcolor Blues 8 2;
+ draw triangle;
+ draw t';
+ );
+ P4 = make_image(T, n, u, v, s, true);
+ picture H; H = image(
+ path ha, hb;
+ ha = hexagon reflectedabout(point 0 of hexagon, point 1 of hexagon);
+ hb = hexagon reflectedabout(point 0 of hexagon, point 5 of hexagon);
+ fill hexagon withcolor Oranges 8 2;
+ fill ha withcolor Blues 8 2;
+ fill hb withcolor Greens 8 2;
+ draw hexagon; draw ha; draw hb;
+ );
+ P7 = make_image(H, n, u zscaled 1.732 dir 30, v zscaled 1.732 dir 30, s, true);
- picture dualt, dualh;
- dualt = image(
- draw triangle withcolor 1/2;
- for i=0 upto 2: draw origin -- point i+1/2 of triangle withcolor Reds 7 6; endfor
- draw currentpicture reflectedabout(point 0 of triangle, point 1 of triangle);
+ picture dualt, dualh;
+ dualt = image(
+ draw triangle withcolor 1/2;
+ for i=0 upto 2: draw origin -- point i+1/2 of triangle withcolor Reds 7 6; endfor
+ draw currentpicture reflectedabout(point 0 of triangle, point 1 of triangle);
);
dualh = image(
- draw hexagon withcolor 1/2;
- for i=0 upto 5:
- draw origin -- point i+1/2 of hexagon withcolor Reds 7 6;
- endfor
+ draw hexagon withcolor 1/2;
+ for i=0 upto 5:
+ draw origin -- point i+1/2 of hexagon withcolor Reds 7 6;
+ endfor
);
P5 = make_image(dualt, n, u, v, s, false);
P8 = make_image(dualh, n, u, v, s, false);
@@ -77,7 +77,7 @@
draw P6 shifted (+100, +100);
draw P7 shifted (+100, -100);
draw P8 shifted (+100, -300);
-endfig;
-\end{mplibcode}
-\end{document}
+ endfig;
+ \end{mplibcode}
+ \end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-hex-trig.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-k.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-k.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-k.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -11,7 +11,7 @@
ahangle := 10;
unit = image(
for i=-1 upto 1:
- fill s rotated 60i withcolor Spectral[9][3+2i];
+ fill s rotated 60i withcolor Oranges 8 3;
draw s rotated 60i;
endfor
);
@@ -24,7 +24,11 @@
draw unit shifted (i * u + j * v);
endfor
endfor
- clip currentpicture to fullcircle scaled 400;
+
+ picture P; P = currentpicture; currentpicture := nullpicture;
+ fill fullcircle scaled 400 withcolor Blues 5 4;
+ clip P to fullcircle scaled 400;
+ draw P;
endfig;
\end{mplibcode}
\end{document}
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-k.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,50 @@
+\documentclass[border=0mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+path o;
+o = for i=0 upto 7: 8 right rotated (45/2 + 45i) -- endfor cycle;
+numeric a, b;
+a = abs(point 1/2 of o - point 9/2 of o);
+b = abs(point 0 of o - point 1 of o);
+o := o shifted 1/2(2a + b, a);
+path s, t, x;
+s = unitsquare zscaled (point 4 of o - point 5 of o) shifted point 5 of o;
+t = unitsquare zscaled (point 6 of o - point 7 of o) shifted point 7 of o;
+x = unitsquare zscaled (point 7 of o - point 8 of o) shifted point 8 of o;
+
+input colorbrewer-rgb
+
+picture unit;
+unit = image(
+ for i=0 upto 7:
+ fill o rotated 45i withcolor Oranges 8 3;
+ draw o rotated 45i;
+ fill s rotated 45i withcolor Blues 8 2;
+ draw s rotated 45i;
+ endfor
+ for i = 0, 1, 2, 3, 5, 7:
+ fill t rotated 45i withcolor Blues 8 4;
+ draw t rotated 45i;
+ endfor
+ for i = 1, 3, 5, 7:
+ fill x rotated 45i withcolor Blues 8 4;
+ draw x rotated 45i;
+ endfor
+);
+
+beginfig(1);
+ pair u, v; u = 2 center t; v = u rotated 90;
+ n = 4;
+ for i=-n upto n:
+ for j = -n upto n:
+ draw unit shifted (i * u + j * v);
+ endfor
+ endfor
+
+ clip currentpicture to unitsquare shifted -(1/2, 1/2) yscaled sqrt(2) scaled 105mm;
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-kepler-y.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,96 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input colorbrewer-rgb
+
+numeric phi; phi = 0.61803398875;
+
+path wide[], tall[];
+wide0 = origin -- right -- phi * dir 36 -- cycle;
+wide1 = origin -- right -- phi * dir -36 -- cycle;
+tall0 = origin -- right -- (1+phi) * dir 72 -- cycle;
+tall1 = origin -- right -- (1+phi) * dir -72 -- cycle;
+
+vardef half_dart(expr level, a, b, side) =
+ save T; path T; T = wide[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Purples[9][3+side];
+ draw subpath (0, 2) of T;
+ else:
+ half_dart(level - 1, point 1 of T, point 2 of T, side);
+ half_kite(level - 1, point 2 of T, point phi of T, 1-side);
+ fi
+enddef;
+
+vardef half_kite(expr level, a, b, side) =
+ save T; path T; T = tall[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Blues[9][2+side];
+ draw subpath (0, 2) of T;
+ else:
+ half_dart(level - 1, point 2 of T, point 2+phi of T, side);
+ half_kite(level - 1, point 2+phi of T, point 0 of T, side);
+ half_kite(level - 1, point 2+phi of T, point 1+phi of T, 1-side);
+ fi
+enddef;
+
+beginfig(1);
+
+ picture kite, dart, P[];
+
+ kite = image(
+ half_kite(0, origin, 34 dir 198, 0);
+ half_kite(0, origin, 34 dir -18, 1);
+ label.bot("Kite", 55 down);
+ );
+
+ dart = image(
+ half_dart(0, origin, 55 dir 234, 0);
+ half_dart(0, origin, 55 dir 306, 1);
+ currentpicture := currentpicture shifted 4 down;
+ undraw origin;
+ label.bot("Dart", 55 down);
+ );
+
+
+ pickup pencircle scaled 1/4;
+
+ pair a, b; a = origin; b = 21 dir 198;
+ P1 = image(half_kite(0, a, b, 0); dotlabel.ulft("$a$", a); dotlabel.ulft("$b$", b));
+ P2 = image(half_kite(1, a, b, 0));
+
+ b := b reflectedabout(up, down);
+ P3 = image(half_kite(0, a, b, 1); dotlabel.urt("$a$", a); dotlabel.urt("$b$", b));
+ P4 = image(half_kite(1, a, b, 1));
+ P5 = image(begingroup; save arr; path arr; arr = (up--down) scaled 12;
+ drawarrow arr;
+ interim labeloffset := 8;
+ label.ulft(P1, point 0 of arr); label.urt(P3, point 0 of arr);
+ label.llft(P2, point 1 of arr); label.lrt(P4, point 1 of arr);
+ endgroup);
+
+ b := 34 dir 234;
+ P6 = image(half_dart(0, a, b, 0); dotlabel.ulft("$a$", a); dotlabel.ulft("$b$", b));
+ P7 = image(half_dart(1, a, b, 0));
+
+ b := b reflectedabout(up, down);
+ P8 = image(half_dart(0, a, b, 1); dotlabel.urt("$a$", a); dotlabel.urt("$b$", b));
+ P9 = image(half_dart(1, a, b, 1));
+ P10 = image(begingroup; save arr; path arr; arr = (up--down) scaled 12;
+ drawarrow arr;
+ interim labeloffset := 8;
+ label.ulft(P6, point 0 of arr); label.urt(P8, point 0 of arr);
+ label.llft(P7, point 1 of arr); label.lrt(P9, point 1 of arr);
+ endgroup);
+
+ label(kite, 42 left);
+ label(dart, 42 right);
+ label(P5, 134 left);
+ label(P10, 134 right);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart-construction.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,49 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input colorbrewer-rgb
+
+numeric phi; phi = 0.61803398875;
+
+path wide[], tall[];
+wide0 = origin -- right -- phi * dir 36 -- cycle;
+wide1 = origin -- right -- phi * dir -36 -- cycle;
+tall0 = origin -- right -- (1+phi) * dir 72 -- cycle;
+tall1 = origin -- right -- (1+phi) * dir -72 -- cycle;
+
+vardef half_dart(expr level, a, b, side) =
+ save T; path T; T = wide[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Purples[9][3+side];
+ draw subpath (0, 2) of T;
+ else:
+ half_dart(level - 1, point 1 of T, point 2 of T, side);
+ half_kite(level - 1, point 2 of T, point phi of T, 1-side);
+ fi
+enddef;
+
+vardef half_kite(expr level, a, b, side) =
+ save T; path T; T = tall[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Blues[9][2+side];
+ draw subpath (0, 2) of T;
+ else:
+ half_dart(level - 1, point 2 of T, point 2+phi of T, side);
+ half_kite(level - 1, point 2+phi of T, point 0 of T, side);
+ half_kite(level - 1, point 2+phi of T, point 1+phi of T, 1-side);
+ fi
+enddef;
+
+beginfig(1);
+ numeric wd; wd = 5in;
+ drawoptions(withpen pencircle scaled 1/8);
+ half_dart(9, 1.375 wd * left, 1.375 wd * right, 0);
+ drawoptions();
+ clip currentpicture to unitsquare shifted 1/2 left scaled wd yscaled phi;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p2-kite-dart.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,98 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input colorbrewer-rgb
+
+numeric phi; phi = 0.61803398875;
+
+path wide[], tall[];
+wide0 = origin -- right -- phi * dir 36 -- cycle;
+wide1 = origin -- right -- phi * dir -36 -- cycle;
+tall0 = origin -- right -- (1+phi) * dir 72 -- cycle;
+tall1 = origin -- right -- (1+phi) * dir -72 -- cycle;
+
+vardef half_thick(expr level, a, b, side) =
+ save T; path T; T = wide[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Purples[9][2+2side];
+ draw subpath (1, 3) of T;
+ else:
+ half_thick(level - 1, point phi of T, point 0 of T, 1-side);
+ half_thick(level - 1, point 1 of T, point 2 of T, side);
+ half_thin(level - 1, point 2 of T, point -phi of T, side);
+ fi
+enddef;
+
+vardef half_thin(expr level, a, b, side) =
+ save T; path T; T = tall[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Blues[9][2+2side];
+ draw subpath (1, 3) of T;
+ else:
+ half_thick(level - 1, point 0 of T, point 2 of T, 1-side);
+ half_thin(level - 1, point 1 of T, point 2-phi of T, side);
+ fi
+enddef;
+
+picture thin, thick, P[];
+
+pair a, b; a = -b = 13 down;
+thin = image(
+ half_thin(0, a, b, 0);
+ half_thin(0, a, b, 1);
+ label.bot("Thin", 42 down); undraw 28 up;
+);
+
+for s=0, 1:
+ P[1+s] = image(
+ half_thin(0, a, b, s);
+ dotlabel.bot("$a$", a);
+ dotlabel.top("$b$", b);
+ label("$" & decimal s & "$", (17 * (2s-1), 0));
+ );
+ P[3+s] = image(half_thin(1, a, b, s));
+endfor
+
+P5 = image(
+ begingroup; interim labeloffset := 8; save arr;
+ path arr; arr = 21 up -- 21 down; drawarrow arr;
+ label.ulft(P1, point 0 of arr); label.urt(P2, point 0 of arr);
+ label.llft(P3, point 1 of arr); label.lrt(P4, point 1 of arr);
+ endgroup;
+);
+
+pair a, b; a = -b = 28 down;
+thick = image(
+ half_thick(0, a, b, 0);
+ half_thick(0, a, b, 1);
+ label.bot("Thick", 42 down);
+);
+
+for s=0, 1:
+ P[6+s] = image(
+ half_thick(0, a, b, s);
+ dotlabel.bot("$a$", a);
+ dotlabel.top("$b$", b);
+ label("$" & decimal s & "$", (11 * (2s-1), 0));
+ );
+ P[8+s] = image(half_thick(1, a, b, s));
+endfor
+
+P10 = image(
+ begingroup; interim labeloffset := 8; save arr;
+ path arr; arr = 8 up -- 8 down; drawarrow arr;
+ label.ulft(P6, point 0 of arr); label.urt(P7, point 0 of arr);
+ label.llft(P8, point 1 of arr); label.lrt(P9, point 1 of arr);
+ endgroup;
+);
+
+beginfig(1);
+ label(thin, 53 left); label(P5, 132 left);
+ label(thick, 53 right); label(P10, 132 right);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs-construction.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,49 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+
+input colorbrewer-rgb
+
+numeric phi; phi = 0.61803398875;
+
+path wide[], tall[];
+wide0 = origin -- right -- phi * dir 36 -- cycle;
+wide1 = origin -- right -- phi * dir -36 -- cycle;
+tall0 = origin -- right -- (1+phi) * dir 72 -- cycle;
+tall1 = origin -- right -- (1+phi) * dir -72 -- cycle;
+
+vardef half_thick(expr level, a, b, side) =
+ save T; path T; T = wide[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Purples[9][1+side];
+ draw subpath (1, 3) of T;
+ else:
+ half_thick(level - 1, point phi of T, point 0 of T, 1-side);
+ half_thick(level - 1, point 1 of T, point 2 of T, side);
+ half_thin(level - 1, point 2 of T, point -phi of T, side);
+ fi
+enddef;
+
+vardef half_thin(expr level, a, b, side) =
+ save T; path T; T = tall[side] zscaled (b-a) shifted a;
+ if level = 0:
+ fill T withcolor Blues[9][2+side];
+ draw subpath (1, 3) of T;
+ else:
+ half_thick(level - 1, point 0 of T, point 2 of T, 1-side);
+ half_thin(level - 1, point 1 of T, point 2-phi of T, side);
+ fi
+enddef;
+
+beginfig(1);
+ numeric wd; wd = 5in;
+ drawoptions(withpen pencircle scaled 1/8);
+ half_thick(8, 1.375 wd * left, 1.375 wd * right, 0);
+ drawoptions();
+ clip currentpicture to unitsquare shifted 1/2 left scaled wd yscaled phi;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-penrose-tatham-p3-rhombs.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pinwheel-macro.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pinwheel-macro.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pinwheel-macro.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,15 @@
+input colorbrewer-rgb
+vardef pinwheel(expr level, a, b, c, s) =
+ if level = 0:
+ fill a--b--c--cycle withcolor s;
+ draw a--b--c--cycle;
+ else:
+ save d, e, f, g; pair d, e, f, g;
+ d = 1/2[a,b]; e = 1/5[c,b]; f = 1/2[a,e]; g = 1/2[b,e];
+ pinwheel(level - 1, f, d, e, Blues 9 2);
+ pinwheel(level - 1, f, d, a, Blues 9 3);
+ pinwheel(level - 1, e, a, c, Blues 9 4);
+ pinwheel(level - 1, g, e, d, Blues 9 5);
+ pinwheel(level - 1, g, b, d, Blues 9 6);
+ fi
+enddef;
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pinwheel-macro.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,29 @@
+% inspired by Grünbaum & Shephard - fig 8.0.1
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input colorbrewer-rgb
+beginfig(1);
+ numeric r, s; s = 9; r = 2s * (sind(75)-sind(45));
+ path a; a = unitsquare rotated -45 scaled s shifted (r, 0);
+ picture unit; unit = image(
+ for t=0 upto 5:
+ fill a rotated 60t withcolor Spectral[6][t mod 3 + 3];
+ draw a rotated 60t;
+ endfor
+ );
+ pair u, v;
+ u = (2s * sind(75), 0); u := u + u rotated 60; u := u rotated 60;
+ v = u rotated 60;
+ numeric n; n = 5;
+ for i = -n upto n:
+ for j = -n upto n:
+ draw unit shifted (i*u + j*v - floor(j/2)*u);
+ endfor
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-pp48a.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-simple.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-simple.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-simple.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -5,34 +5,29 @@
beginfig(1);
picture P[];
P1 = image(
-for i = -10 upto 10:
+ for i = -10 upto 10:
draw (left--right) scaled 200 shifted (0, 20i);
draw (down--up) scaled 200 shifted (20i, 0);
-endfor
-clip currentpicture to fullcircle scaled 180;
-draw fullcircle scaled 180;
+ endfor
+ path c; c = fullcircle scaled 180; clip currentpicture to c; draw c;
);
P2 = image(
-path unit; pair u, v; color a, b;
-unit = unitsquare scaled 24;
-u = point 1 of unit - point 0 of unit;
-v = point 3 of unit - point 0 of unit;
-a = 3/4[red, white]; b = 3/4[blue, white];
-for i=-5 upto 5:
- for j=-5 upto 5:
- fill unit shifted (i*u + j*v)
- withcolor if odd (i+j): a else: b fi;
+ path unit; pair u, v; color a, b;
+ unit = unitsquare scaled 24;
+ u = point 1 of unit - point 0 of unit;
+ v = point 3 of unit - point 0 of unit;
+ a = 3/4[red, white]; b = 3/4[blue, white];
+ for i=-5 upto 5:
+ for j=-5 upto 5:
+ fill unit shifted (i*u + j*v)
+ withcolor if odd (i+j): a else: b fi;
+ draw subpath (-1,1) of unit shifted (i*u + j*v);
+ endfor
endfor
-endfor
-for i=-5 upto 5:
- for j=-5 upto 5:
- draw subpath (0,2) of unit shifted (i*u + j*v);
- endfor
-endfor
-clip currentpicture to fullcircle scaled 180;
-draw fullcircle scaled 180;
+ path c; c = fullcircle scaled 180; clip currentpicture to c; draw c;
);
+undraw (left--right) scaled 2in;
draw P1; draw P2 shifted 200 down;
endfig;
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-simple.pdf
===================================================================
(Binary files differ)
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,16 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input tiling-pinwheel-macro
+beginfig(1);
+ pair a, b, c; a = origin; b = 460 right; c = 1/2 b rotated 90;
+ drawoptions(withpen pencircle scaled 1/8 withcolor white);
+ pinwheel(5, a, b, c, "");
+ drawoptions();
+ draw currentpicture rotatedabout(1/2[b,c], 180);
+ currentpicture := currentpicture rotated 90;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-pinwheel.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,82 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\mplibtextextlabel{enable}
+\begin{document}
+\begin{mplibcode}
+
+vardef tall(expr level, a, b, c) =
+ if level = 0:
+ fill a--b--c--cycle withcolor 3/4[blue, white];
+ draw a--c--b;
+ else:
+ save m; pair m; m = 1/3 (a + b + c); % the centroid
+ wide(level - 1, a, b, m);
+ wide(level - 1, b, c, m);
+ wide(level - 1, c, a, m);
+ fi
+enddef;
+vardef wide(expr level, a, b, c) =
+ if level = 0:
+ fill a--b--c--cycle withcolor 7/8[blue, white];
+ draw a--c--b;
+ else:
+ save p, q; pair p, q; p = 1/3[a,b]; q = 1/3[b,a];
+ wide(level - 1, c, a, p);
+ tall(level - 1, p, q, c);
+ wide(level - 1, b, c, q);
+ fi
+enddef;
+
+beginfig(1);
+
+ picture P[];
+ for i=0,1,2: z[1+i] = 173.2 up rotated 120i; endfor
+ for i=0,1,2: z[4+i] = 17.32 up rotated 120i; endfor
+
+ P1 = image(
+ pickup pencircle scaled 1/8;
+ tall(6, z1, z2, z3);
+ );
+
+ P2 = image(
+ tall(0, z4, z5, z6)
+ );
+ P3 = image(
+ tall(1, z4, z5, z6)
+ );
+ P4 = image(
+ drawarrow 10 left -- 10 right;
+ label.lft(P2, 12 left);
+ label.rt(P3, 12 right);
+ label.top("The \textit{tall} macro dissects a tall triangle into 3 wide ones",
+ point 5/2 of bbox currentpicture shifted 6 up);
+ );
+
+ P5 = image(
+ wide(0, z5, z6, origin)
+ );
+
+ P6 = image(
+ wide(1, z5, z6, origin)
+ );
+
+ P7 = image(
+ drawarrow 10 left -- 10 right;
+ label.lft(P5, 12 left);
+ label.rt(P6, 12 right);
+ label.top("The \textit{wide} macro dissects a wide triangle into 2 wides, and 1 tall.",
+ point 5/2 of bbox currentpicture shifted 6 up);
+ );
+
+ draw P1;
+ label.top(P7, point 5/2 of bbox currentpicture shifted 12 up);
+ label.top(P4, point 5/2 of bbox currentpicture shifted 12 up);
+
+ label.bot(btex \vbox{\hsize 4.2in\raggedright\noindent
+ Note that only part of the perimeter of each triangle is drawn, to give
+ the illusion that the completed tiling is made up of identical rhombs.} etex,
+ point 1/2 of bbox currentpicture shifted 12 down);
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling-subs-triangle.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,56 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
-
-prologues := 3;
-outputtemplate := "%j%c.eps";
-vardef poly_on(expr a,b,n) =
- save s,t,c; pair c;
- s = 360/n;
- t = 90-180/n;
- c = whatever[a,b rotatedabout(a,+t)]
- = whatever[b,a rotatedabout(b,-t)];
- for i=0 upto n-1: a rotatedabout(c,i*s) -- endfor cycle
-enddef;
-
-vardef make_uniform_tiling_shd(expr u, reps, scolor, hcolor, dcolor) =
- save x,y,s, h, d, t; path s[], h[], d; picture t;
- (x,y) = dir 15;
- d = for i=0 upto 11: (x/2y, 1/2) scaled u rotated 30i -- endfor cycle;
- for i=0 upto 2: s[i] = unitsquare scaled u shifted point -1 of d rotated (60+60i); endfor
- for i=0 upto 1: h[i] = poly_on(point 9+2i of d, point 8+2i of d, 6); endfor
- t = image(
- fill d withcolor dcolor;
- for i=0 upto 2: fill s[i] withcolor scolor; endfor
- for i=0 upto 1: fill h[i] withcolor hcolor; endfor
-
- draw d;
- for i=0 upto 2: draw s[i]; endfor
- for i=0 upto 1: draw h[i]; endfor
- );
- save dx, dy; pair dx, dy;
- dx = (u,0) + point -1/2 of d - point 11/2 of d;
- dy = dx rotated 60;
- for i=-reps upto reps:
- for j=-reps upto reps:
- draw t shifted (i*dx) shifted (j*dy);
- endfor
- endfor
-enddef;
-
-def rgb(expr r,g,b) = (r/255, g/255, b/255) enddef;
-color b[];
-b1 = rgb(255,255,217);
-b2 = rgb(237,248,177);
-b3 = rgb(199,233,180);
-
-beginfig(2);
-picture tt; tt = image(make_uniform_tiling_shd(4mm, 7, b1, b2, b3); fill fullcircle scaled 3 withcolor red;);
-clip tt to fullcircle scaled 12cm; draw tt;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tiling.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-circle.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-circle.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-circle.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,18 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-input torn-edge
-beginfig(1);
-path c; c = fullcircle scaled 200;
-draw c withcolor .8 white;
-y=0; n = 600;
-path t; t = for i=0 upto n-1:
- point i/n*length(c) of c
- + (0, walkr y) rotated angle direction i/n*length(c) of c
- --
-endfor cycle;
-draw t withcolor .67 red;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-circle.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-straight.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-straight.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-straight.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,14 +0,0 @@
-\documentclass{standalone}
-\usepackage{luamplib}
-\begin{document}
-\begin{mplibcode}
-input torn-edge
-beginfig(2);
-path t; numeric x, y;
-x = 0; y=0;
-t = (x, -20) -- (x, y) for i=1 upto 288: -- (incr x, walkr y) endfor -- (x, -20) -- cycle;
-fill t withcolor 1/32(32,32,31);
-draw t withcolor .67 blue;
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge-straight.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/torn-edge.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,7 +0,0 @@
-vardef signr suffix $ =
- if $<0: - else: + fi uniformdeviate 1
- enddef;
-vardef walkr suffix $ =
- $ := $ if uniformdeviate 1 < (2**-abs($)): + else: - fi signr $;
- $
- enddef;
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,37 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+vardef do_brace(expr a, b, offset, r) =
+ save d, e, m, n, brace, hook; pair e; path brace, hook[];
+ d = angle(b-a);
+ e = up scaled offset rotated d shifted r[a,b];
+ n = 1/2 offset; m = abs(n);
+ hook1 = origin {0, n} .. (m, n) {1,0};
+ hook2 = (-m,-n) {1,0} .. {0, n} origin {0,-n} .. (m,-n) {1,0};
+ hook3 = (-m, n) {1,0} .. {0,-n} origin;
+ brace = (hook1 rotated d shifted a --
+ hook2 rotated d shifted e --
+ hook3 rotated d shifted b) shifted (up scaled n rotated d);
+ draw brace withpen pencircle yscaled .6 xscaled .1666 rotated d;
+ point 3 of brace
+enddef;
+
+beginfig(1);
+z1 = origin;
+z2 = 180 right rotated 13;
+draw z1--z2 withcolor .7 white;
+dotlabel.llft("$z_1$",z1);
+dotlabel.urt("$z_2$",z2);
+drawoptions(withcolor 2/3 red);
+label.lrt("Here", do_brace(z1, z2, -12, 3/4));
+drawoptions();
+begingroup; interim ahangle := 180; interim ahlength := 3;
+drawdblarrow (z1--z2) shifted (12 up rotated angle (z2-z1)) withcolor 2/3 blue;
+endgroup;
+
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-braces.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,18 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+path a; a = (left .. right) scaled 42;
+pair P; P = origin; r = 31;
+draw a rotated r withcolor 2/3 red; draw a rotated (90+r) withcolor 2/3 red;
+draw P withpen pencircle scaled dotlabeldiam;
+label(btex $P$ etex, P shifted 10 dir 68);
+z0 = P + 20 dir -20;
+draw z0 -- P
+ cutafter fullcircle scaled 8 shifted P
+ withpen pencircle scaled 1/4;
+label.rt(btex \textit{pole} etex, z0);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-callout.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,19 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+beginfig(2);
+path c; c = fullcircle scaled 100; draw c withcolor .67 red;
+for i=0 upto 7:
+ fill fullcircle scaled 3 shifted point i of c;
+ z[i] = point i of c scaled 1.15;
+ write "label(btex $p_" & decimal i & "$ etex,("
+ & decimal x[i] & "," & decimal y[i]
+ & "));" to ".mplabels";
+endfor
+write EOF to ".mplabels";
+input ".mplabels";
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-dynamic-labels.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,24 @@
+\documentclass[border=8pt]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ for i=0 upto 15:
+ label.top(decimal i infont "cmss10" scaled 0.7, (15i,108)) withcolor .67 red;
+ for j=0 upto 7:
+ draw char (i+16j) infont "eurm10" shifted (15i-3,97-14j);
+ if i=0:
+ label.lft(decimal 16j infont "cmss10" scaled 0.7, (-8,100-14j)) withcolor .67 red;
+ fi
+ % if (i + 16j) > 0:
+ % draw char (i + 16j) infont "cmmi10"
+ % scaled 0.5
+ % shifted (15i - 6, 97-14j)
+ % withcolor .67 blue;
+ % fi
+ endfor
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-euler-sampler.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,20 @@
+\documentclass[border=3mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ string ab, AB;
+ ab = ("" for i=11 upto 23: & char i endfor
+ & "o" for i=24 upto 33: & char i endfor);
+ AB = ("AB" & char 0 & char 1 & "EZH" & char 2 & "IK"
+ & char 3 & "MNO" & char 4 & char 5 & "P"
+ & char 6 & "T" & char 7 & char 8 & "X"
+ & char 9 & char 10);
+
+ draw ab infont "cmmi10";
+ draw AB infont "cmmi10" shifted 12 down;
+ draw ab infont "eurm10" shifted 32 down;
+ draw AB infont "eurm10" shifted 44 down;
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-default-encoding.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,21 @@
+\documentclass[border=3mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+string ab, AB;
+ab = "abgdezhjiklmnoxprstufqyw";
+AB = "ABGDEZHJIKLMNOXPRSTUFQYW";
+y := 0;
+for $="grmn1000", "gporsonrg6r", "gneohellenicrg6r":
+ draw ("draw ab infont " & ditto & $ & ditto) infont "texnansi-lmtt10" scaled 0.8 shifted (0,y) withcolor .67 red;
+ draw ab infont $ shifted (0,y-10);
+ draw AB infont $ shifted (0,y-22);
+ y := y - 40;
+endfor
+undraw (6 left -- 180 right) shifted 12 up;
+undraw (6 left -- 180 right) shifted 108 down;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-gfs-encoding.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,25 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+vardef setg(text t) =
+ save G; picture G;
+ save x; numeric x; x = 0;
+ G = image(
+ for w = t:
+ picture g;
+ g = w infont "gporsonrg6r";
+ draw g shifted (x, 0);
+ x := x + xpart (urcorner g - llcorner g) + 3;
+ endfor
+ ); G enddef;
+beginfig(1);
+picture homer;
+homer = setg("m" & char 168 & "nin", char 138 & "eide", "je" & char 128,
+ "Phlh" & char 240 & char 136 & "deiw", ">Aqil" & char 168 & "oc");
+undraw 10 left -- 272 right;
+draw homer scaled 1.732 withcolor .54 red;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-greek-homer.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,48 @@
+\documentclass[border=2mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+picture p, pp;
+p = "proof" infont "pplri8r" scaled 4;
+pp = "proof" infont "pplri8r" scaled 8;
+(wd, ht) = urcorner pp;
+(xx, dp) = llcorner pp;
+xheight = ypart urcorner ("x" infont "pplri8r" scaled 8);
+
+beginfig(3);
+drawoptions( withpen pencircle scaled .5 withcolor .7[.74 red, white]);
+draw origin -- (0,ht) -- (wd, ht) -- (wd, dp) -- (0,dp) -- cycle;
+for y=0,xheight:
+ draw (0,y) -- (wd,y);
+endfor
+draw bbox pp dashed withdots scaled 1/4;
+drawoptions();
+draw pp withcolor .5 white;
+fill fullcircle scaled 4 shifted center pp withcolor .7[3/4 red,white];
+
+vardef east primary p = 1/2[urcorner p, lrcorner p] enddef;
+vardef west primary p = 1/2[ulcorner p, llcorner p] enddef;
+vardef eastx primary p = lrcorner p shifted (+1,3) enddef;
+vardef westx primary p = llcorner p shifted (-1,3) enddef;
+
+picture c[]; ahangle := 30; string s[];
+c0 = "center" infont "pplr8r" shifted center pp shifted (21,27);
+c1 = "urcorner" infont "pplr8r" shifted urcorner pp shifted (13,8);
+c2 = "ulcorner" infont "pplr8r" shifted ulcorner pp; c2 := c2 shifted (-13-xpart urcorner c2,8);
+c3 = "llcorner" infont "pplr8r" shifted llcorner pp; c3 := c3 shifted (-13-xpart urcorner c3,-13);
+c4 = "lrcorner" infont "pplr8r" shifted lrcorner pp shifted (13,-13);
+c5 = "bboxmargin" infont "pplr8r" scaled 0.8;
+draw c0 withcolor .67 red; drawarrow center c0 .. {dir -120} center pp shifted ( 1, 3) cutbefore bbox c0;
+draw c1 withcolor .67 red; drawarrow westx c1 .. {dir -120} urcorner pp shifted ( 1, 1);
+draw c2 withcolor .67 red; drawarrow eastx c2 .. {dir -60} ulcorner pp shifted (-1, 1);
+draw c3 withcolor .67 red; drawarrow eastx c3 .. {dir +60} llcorner pp shifted (-2,-2);
+draw c4 withcolor .67 red; drawarrow westx c4 .. {dir +120} lrcorner pp shifted ( 1,-1);
+label.bot(c5, point 1/2 of bbox pp) withcolor 1/4[.67 red, white];
+
+c6 = ("x-height" infont "pplr8r"); c6 := c6 shifted (-13-xpart urcorner c6,xheight-2.2);
+c7 = ("origin" infont "pplr8r"); c7 := c7 shifted (-13-xpart urcorner c7,-2.2);
+draw c6 withcolor .67 blue; drawarrow (-12,xheight) -- (-1,xheight);
+draw c7 withcolor .67 blue; drawarrow (-12,0) -- (-1,0);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-annotated.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,19 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+interim bboxmargin := 2;
+picture p, pp;
+p = "proof" infont "pplri8r" scaled 4;
+pp = image(
+draw (left -- 7 right) scaled 14 withcolor .7 white;
+draw p;
+draw bbox currentpicture withcolor 3/4[red, white]);
+beginfig(1);
+draw bbox p withcolor 3/4[red, white];
+draw p;
+draw pp shifted 120 right;
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-infont-example.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,19 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+
+ u = 8mm;
+ defaultfont := "texnansi-lmr10";
+ string minus_sign;
+ minus_sign := char 12; % if you are using the 8r encoding
+ minus_sign := char 143; % if you are using the texnansi encoding
+ for x=-3 upto 3: label(decimal x, (x*u,+9)) withcolor .67 red; endfor
+ for x=-3 upto 3: label(if x<0: minus_sign & fi decimal abs(x), (x*u,-5)) withcolor .58 blue; endfor
+ label.lft("with plain decimal:" infont "texnansi-lmss10" scaled 0.9, (-3.6u,9)) withcolor .67 red;
+ label.lft("with this hack:" infont "texnansi-lmss10" scaled 0.9, (-3.6u,-5)) withcolor .58 blue;
+
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-minus.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,22 @@
+%prologues := 3;
+%outputtemplate := "%j%c.%{outputformat}";
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+interim bboxmargin := 0;
+vardef boxed(expr p) = save P; picture P; P = image(draw bbox p withcolor 7/8[red, white]; draw p); P enddef;
+beginfig(1);
+ for i=2 upto 15:
+ numeric y; y = -14i - 4 floor(i/4);
+ label.lft(decimal 16i infont "phvr8r" scaled 0.6, (-6, y+2)) withcolor 0.54 red;
+ for j = 0 upto 15:
+ draw boxed(char (16i+j) infont "gporsonrg6r") shifted (12j + 2 floor(j/4), y);
+ endfor
+ endfor
+ for x = 0 upto 4:
+ draw (50x-4, -18) -- (50x-4, -224) withcolor 0.54 red;
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-porson.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,24 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\def\s#1{\let\\\cr\vbox{\halign{\hfil\strut ##\hfil\cr#1\crcr}}}
+\begin{document}
+\begin{mplibcode}
+input colorbrewer-rgb
+beginfig(1);
+z0 = origin; z1 = 100 down; z2 = 144 down;
+picture L[];
+L0 = thelabel(btex \vbox{\hsize 2in\parindent 0pt\raggedright
+ An extended caption or label that will be set as a
+ small paragraph with automatic hyphenation and
+ line-wrapping.
+} etex, z0);
+L1 = thelabel(btex \s{Single line} etex, z1);
+L2 = thelabel(btex \s{Longer text split\\onto a new line} etex, z2);
+forsuffixes $=0,1,2:
+ draw L$; draw bbox L$ withcolor Blues 8 2;
+ draw fullcircle scaled 2 shifted z$ withcolor Reds 8 7;
+endfor
+endfig;
+\end{mplibcode}
+\end{document}
+
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-split-labels.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,32 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+def U primary s = if string s: decode(s) fi enddef;
+vardef decode(expr given) =
+ save a,b,i,s,out; string s, out; numeric a, b, i;
+ out = ""; i=0;
+ forever:
+ i := i+1; s := substring(i-1,i) of given; a := ASCII s;
+ if a < 128:
+ elseif a = 194:
+ i := i+1; s := substring (i-1,i) of given;
+ elseif a = 195:
+ i := i+1; s := char (64 + ASCII substring (i-1,i) of given);
+ else:
+ s := "?";
+ fi
+ out := out & s;
+ exitif i >= length given;
+ endfor
+ out
+enddef;
+beginfig(2);
+draw "café noir £2.50" infont "ptmr8r";
+draw decode("café noir £2.50") infont "ptmr8r" shifted 12 down;
+defaultfont := "pncr8r";
+label.rt("café noir £2.50", 24 down);
+label.rt(decode("café noir £2.50"), 36 down);
+endfig;
+\end{mplibcode}
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-utf8.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,26 @@
+prologues := 3; outputtemplate := "%j.eps";
+verbatimtex
+\documentclass{article}
+\usepackage{listings}
+\usepackage{xcolor}
+\newcommand\mpstyle{\lstset{language=Metapost,
+basicstyle=\ttfamily,columns=fullflexible,commentstyle=\color{red},
+frame=none,keepspaces=true,showstringspaces=false}}
+\lstnewenvironment{code}[1][]{\mpstyle\lstset{#1}}{}
+\begin{document}
+etex
+beginfig(1);
+picture P; P = thelabel(btex \vbox{\begin{code}
+ % special operators
+ vardef incr suffix $ = $:=$+1; $ enddef;
+ vardef decr suffix $ = $:=$-1; $ enddef;
+ def reflectedabout(expr w,z) = % reflects about the line w..z
+ transformed begingroup transform T_;
+ w transformed T_ = w;
+ z transformed T_ = z;
+ xxpart T_ = -yypart T_;
+ xypart T_ = yxpart T_; % T_ is a reflection
+ T_ endgroup enddef;
+\end{code}} etex, origin);
+fill bbox P withcolor (1,1,31/32); draw P; draw bbox P;
+endfig; end.
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-listing.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,18 @@
+\documentclass{standalone}
+\usepackage{luamplib}
+\begin{document}
+\begin{mplibcode}
+beginfig(1);
+ string s; s = "\TeX\ sets maths like this $e=mc^2$";
+ draw ("1. " & s) infont defaultfont;
+ draw ("2. " & s) infont "texnansi-lmr10" shifted 20 down;
+ draw ("3. " & s) infont "cmtt10" shifted 40 down;
+ draw ("4. " & s) infont "texnansi-lmtt10" shifted 60 down;
+ bboxmargin := 14;
+ picture p; p = currentpicture;
+ fill bbox currentpicture withcolor (1,1,31/32);
+ draw p; draw bbox p;
+endfig;
+\end{mplibcode}
+\end{document}
+end.
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.pdf 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.pdf 2024-10-30 20:00:04 UTC (rev 72705)
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trad-verbatim-with-infont.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trigonometry-functions.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trigonometry-functions.mp (rev 0)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trigonometry-functions.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -0,0 +1,49 @@
+numeric pi;
+% approximate value
+pi := 3.14159;
+% measure round a circular arc...
+pi := 1/4 arclength (quartercircle scaled 16);
+% up to 32 digits of precision
+pi := 3.1415926535897932384626433832795;
+% as many digits as are needed...
+vardef getpi =
+ save lasts, t, s, n, na, d, da;
+ lasts=0; s=t=3; n=1; na=0; d=0; da=24;
+ forever:
+ exitif lasts=s;
+ lasts := s;
+ n := n+na; na := na+8;
+ d := d+da; da := da+32;
+ t := t*n/d;
+ s := s+t;
+ endfor
+ s
+enddef;
+pi := getpi;
+
+% conversions
+def degrees(expr theta) = theta / pi * 180 enddef;
+def radians(expr theta) = theta / 180 * pi enddef;
+% trig functions that expect radians
+def sin(expr theta) = sind(degrees(theta)) enddef;
+def cos(expr theta) = cosd(degrees(theta)) enddef;
+% inverse trig functions
+def acosd(expr a) = angle (a,1+-+a) enddef;
+def asind(expr a) = angle (1+-+a,a) enddef;
+def acos(expr a) = radians(acosd(a)) enddef;
+def asin(expr a) = radians(asind(a)) enddef;
+% tangents
+vardef tand(expr theta) = save x,y; (x,y)=dir theta; y/x enddef;
+def atand(expr a) = angle (1,a) enddef;
+
+
+% tests - run with plain `mpost` and scaled numebr system
+show pi = 3.14159;
+show abs(degrees(1) - 57.29577951308232) < 2 eps;
+show radians(90) = 1/2 pi;
+show sin(1)**2 + cos(1)**2 = 1;
+show abs(acosd(1/2) - 60) < eps;
+show abs(asind(1/2) - 30) < eps;
+show tand(45) = 1;
+show atand(1) = 45;
+end
Property changes on: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trigonometry-functions.mp
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-classical.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-classical.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-classical.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,41 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- path C, base, section, aa;
- numeric theta;
- C = fullcircle scaled 144;
- base = origin -- right scaled 172.8;
- theta = 60;
-
- z1 = point 0 of C scaled 1.2 rotated theta;
- z2 = point 4 of C rotated theta;
-
- draw C;
- draw z1 -- origin -- base;
- draw origin -- z2 -- base shifted z2 dashed evenly;
-
- section = base scaled 1.2 rotated 1/3 theta shifted z2 cutafter base;
- draw section;
-
- label.ulft("$a$", 1/2 z2);
- aa = subpath (eps, infinity) of section cutbefore C;
- label.lrt("$a$", point 1/2 of aa);
-
- draw origin -- point 0 of aa dashed withdots scaled 1/2;
-
- drawoptions(withcolor 2/3 blue); % distinguish angle labels
- label("$\theta$", 16 dir 1/2 theta);
- label("$\theta/3$", 52 dir 1/6 theta shifted z2);
- drawoptions();
-
- drawoptions(withpen pencircle scaled 2/3 dotlabeldiam);
- draw origin; draw z2; draw point 0 of aa; draw point 1 of aa;
- drawoptions();
-
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-classical.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-simple.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-simple.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-simple.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,22 +0,0 @@
-\documentclass[border=5mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-beginfig(1);
- path ray;
- numeric theta;
- ray = origin -- 200 right;
- theta = 42;
- draw ray;
- draw ray rotated 1/3 theta withcolor 2/3 red;
- draw ray rotated 2/3 theta withcolor 2/3 red;
- draw ray rotated theta;
- dotlabel.llft("$0$", origin);
- label("$\theta/3$", 72 right rotated 1/6 theta) withcolor 2/3 blue;
- label("$\theta/3$", 72 right rotated 3/6 theta) withcolor 2/3 blue;
- label("$\theta/3$", 72 right rotated 5/6 theta) withcolor 2/3 blue;
-endfig;
-\end{mplibcode}
-\end{document}
-
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-simple.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-triangles.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-triangles.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-triangles.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -1,42 +0,0 @@
-\documentclass[border=0mm]{standalone}
-\usepackage{luamplib}
-\begin{document}
-\mplibtextextlabel{enable}
-\begin{mplibcode}
-randomseed := 2485.81543;
-vardef measured_angle(expr p, o, q) =
- (angle (p-o) - angle (q-o)) mod 360
-enddef;
-beginfig(1);
-picture T;
-for i=0 upto 1:
- for j=0 upto 1:
- clearxy;
- T := image(
- z1 = (120 + uniformdeviate 21, 0);
- z2 = (120 + uniformdeviate 21, 0) rotated 120 rotated 21 normaldeviate;
- z3 = (120 + uniformdeviate 21, 0) rotated 240 rotated 21 normaldeviate;
- numeric a, b, c;
- a = measured_angle(z3, z1, z2);
- b = measured_angle(z1, z2, z3);
- c = measured_angle(z2, z3, z1);
- z4 = whatever [z1, z2 rotatedabout(z1, 1/3 a)]
- = whatever [z2, z3 rotatedabout(z2, 2/3 b)];
- z5 = whatever [z2, z3 rotatedabout(z2, 1/3 b)]
- = whatever [z3, z1 rotatedabout(z3, 2/3 c)];
- z6 = whatever [z3, z1 rotatedabout(z3, 1/3 c)]
- = whatever [z1, z2 rotatedabout(z1, 2/3 a)];
- fill z4--z5--z6--cycle withcolor 3/4[red + 1/2 green, white];
- draw z4--z5--z6--cycle;
- draw z1 -- z4 -- z2 -- z5 -- z3 -- z6 -- cycle
- dashed withdots scaled 1/4;
- draw z1 -- z2 -- z3 -- cycle;
- );
- draw T shifted (200i, 240j);
- endfor
-endfor
-label.rt(btex \vbox{\halign{#\hfil\cr The trisectors of each angle\cr
-in any given triangle form a\cr central equilateral triangle.\cr}} etex, (24, 128));
-endfig;
-\end{mplibcode}
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/trisection-triangles.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-budget.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-budget.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-budget.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -6,60 +6,41 @@
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
+input tufte-manila-paper
beginfig(1);
-path data, p;
-data = (1967, 311)
- -- (1968, 332)
- -- (1969, 372)
- -- (1970, 385)
- -- (1971, 385)
- -- (1972, 393)
- -- (1973, 387)
- -- (1974, 381)
- -- (1975, 387)
- -- (1976, 400)
- -- (1977, 380);
-
-numeric u, v;
-u = xpart urcorner textext("1980\kern 0.75em");
-v = 1.414;
-p = data shifted -(xpart point 0 of data, 300) xscaled u yscaled v;
-draw p;
-
-for d = 300 step 20 until 400:
- numeric y; y = (d - 300) * v;
+ path data; numeric n;
+ data = (1967, 311) -- (1968, 332) -- (1969, 372) -- (1970, 385)
+ -- (1971, 385) -- (1972, 393) -- (1973, 387) -- (1974, 381)
+ -- (1975, 387) -- (1976, 400) -- (1977, 380);
+ n = length data;
+ numeric u, v; path p; % make data --> p
+ u = xpart urcorner textext("1980\kern 0.75em"); v = 1.414;
+ p = data shifted -(xpart point 0 of data, 300) xscaled u yscaled v;
+ for i=0 upto n: z[i] = point i of p; endfor
+ for d = 300 step 20 until 400: % y-axis
+ numeric y; y = (d - 300) * v; draw (-8, y) -- (-12, y);
label.lft("\strut\scriptsize\$\,\small" & decimal d, (-12, y));
- draw (-8, y) -- (-12, y);
- if d > 370:
- draw (xpart point 3 of p, y) -- (xpart point infinity of p + 8, y)
- dashed evenly scaled 1/4 withpen pencircle scaled 1/4;
- fi
-endfor
-path a; a = (xpart point infinity of p + 21, (380 - 300) * v)
- -- (xpart point infinity of p + 21, (400 - 300) * v);
-interim ahangle := 180;
-interim ahlength := 2;
-drawdblarrow a withpen pencircle scaled 1/4;
-label("\small 5\%", point 1/2 of a shifted 12 right);
-
-for t=0 upto length p:
- numeric x, y; (x, y) = point t of p;
- undraw (x, y) withpen pencircle scaled 2 dotlabeldiam;
- draw (x, y) withpen pencircle scaled dotlabeldiam;
- draw (x, -8) -- (x, -12);
- label("\strut\small" & decimal xpart point t of data, (x, -20));
-endfor
-
-label.urt(btex \vbox{\halign{\small #\hfill\cr
-Per capita\cr budget expenditure\cr in constant dollars\cr}} etex,
-(0, (410 - 300) * v));
-
-picture p; p = currentpicture; currentpicture := nullpicture;
-bboxmargin := 12;
-fill bbox p withcolor 1/32(32, 32, 31);
-draw p;
-
+ endfor
+ path a, b, c; % annotating lines
+ a = (x3, y[n-1]) -- (x[n] + 8, y[n-1]);
+ b = (x3, y[n]) -- (x[n] + 8, y[n]);
+ c = (x[n] + 21, y[n]) -- (x[n] + 21, y[n-1]);
+ drawoptions(withpen pencircle scaled 1/4);
+ draw a dashed evenly scaled 1/4;
+ draw b dashed evenly scaled 1/4;
+ draw c;
+ for i=0,1: draw (left--right) scaled 2 shifted point i of c; endfor
+ label("\small 5\%", point 1/2 of c shifted 12 right);
+ drawoptions();
+ draw p; % the data points
+ for i = 0 upto n:
+ undraw z[i] withpen pencircle scaled 2 dotlabeldiam;
+ draw z[i] withpen pencircle scaled dotlabeldiam;
+ draw (x[i], -8) -- (x[i], -12);
+ label("\strut\small" & decimal xpart point i of data, (x[i], -20));
+ endfor
+ label.urt(btex \vbox{\halign{\small #\hfill\cr Per capita\cr
+ budget expenditure\cr in constant dollars\cr}} etex, (x0,y[n-1]+10v));
endfig;
\end{mplibcode}
\end{document}
-
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-budget.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-currency.mp
===================================================================
--- trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-currency.mp 2024-10-30 00:42:06 UTC (rev 72704)
+++ trunk/Master/texmf-dist/doc/metapost/drawing-with-metapost/src/tufte-currency.mp 2024-10-30 20:00:04 UTC (rev 72705)
@@ -3,7 +3,7 @@
\usepackage{unicode-math}
\setmainfont[Numbers=OldStyle]{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
-\def\tl#1{\vbox{\tiny\let\\\cr\halign{\hss ##\hss\cr#1\crcr}}}
+\def\tl#1{\vbox{\small\let\\\cr\halign{\hss ##\hss\cr#1\crcr}}}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
@@ -290,28 +290,66 @@
-- (base(2022, 02, 28), 83.827900)
-- (base(2022, 03, 31), 83.615400)
-- (base(2022, 04, 30), 83.557800)
- -- (base(2022, 05, 22), 84.892600)
+ -- (base(2022, 05, 31), 84.954600)
+ -- (base(2022, 06, 30), 85.784300)
+ -- (base(2022, 07, 31), 84.922300)
+ -- (base(2022, 08, 31), 84.566100)
+ -- (base(2022, 09, 30), 87.545600)
+ -- (base(2022, 10, 31), 87.084200)
+ -- (base(2022, 11, 30), 86.959400)
+ -- (base(2022, 12, 31), 86.945600)
+ -- (base(2023, 01, 31), 88.136600)
+ -- (base(2023, 02, 28), 88.710800)
+ -- (base(2023, 03, 31), 88.288100)
+ -- (base(2023, 04, 30), 88.306300)
+ -- (base(2023, 05, 31), 87.190600)
+ -- (base(2023, 06, 30), 85.824200)
+ -- (base(2023, 07, 31), 85.8333)
+ -- (base(2023, 08, 31), 85.9054)
+ -- (base(2023, 09, 30), 86.2139)
+ -- (base(2023, 10, 31), 86.8168)
+ -- (base(2023, 11, 30), 87.0744)
+ -- (base(2023, 12, 31), 86.2330)
+ -- (base(2024, 01, 31), 85.8814)
+ -- (base(2024, 02, 29), 85.4670)
+ -- (base(2024, 03, 31), 85.5549)
+ -- (base(2024, 04, 30), 85.6500)
+ -- (base(2024, 05, 31), 85.6277)
+ -- (base(2024, 06, 30), 84.7218)
+ -- (base(2024, 07, 31), 84.4672)
+ -- (base(2024, 08, 31), 85.1493)
+ -- (base(2024, 09, 30), 84.0409)
+ -- (base(2024, 10, 26), 83.5291)
;
-years = (base(1999, 01, 01), 1999) for y=2000 upto 2022: -- (base(y, 1, 1), y) endfor;
+years = (base(1999, 01, 01), 1999) for y=2000 upto 2025: -- (base(y, 1, 1), y) endfor;
+numeric u, v; u = 67; v = 5;
numeric offset;
offset = base(1999, 1, 1);
-euro := euro shifted -(offset, 0) xscaled 42 yscaled 3;
-years := years shifted -(offset, 0) xscaled 42;
+euro := euro shifted -(offset, 0) xscaled u yscaled v;
+years := years shifted -(offset, 0) xscaled u;
+input tufte-manila-paper
beginfig(1);
-draw euro withcolor 3/4 blue;
-numeric baseline; baseline = 54*3;
-draw (xpart point 0 of euro, baseline) -- (xpart point infinity of euro, baseline);
+
+draw euro
+ withpen pencircle scaled 1/4 withcolor 3/4;
+for t=0 upto length euro: draw point t of euro
+ withpen pencircle scaled if t mod 12 = 0: 3/2 else: 1 fi
+ withcolor 3/4 blue; endfor
+numeric baseline_height; baseline_height = 54v;
+draw (xpart point 0 of euro, baseline_height) -- (xpart point infinity of euro, baseline_height);
for t = 1 upto length years:
- numeric x, y, q; (x, y) = point t of years; 4q = xpart (point t-1 of years - point t of years);
- draw (x, baseline) -- (x, baseline + 4);
+ numeric x, y, q;
+ (x, y) = point t of years;
+ 4q = xpart (point t-1 of years - point t of years);
+ draw (x, baseline_height) -- (x, baseline_height + 4);
for i=1 upto 3:
- draw (x + i*q, baseline) -- (x + i*q, baseline + 2);
+ draw (x + i*q, baseline_height) -- (x + i*q, baseline_height + 2);
endfor
if not odd y:
- label.bot("\small\strut " & decimal y, (x, baseline));
+ label.bot("\small\strut " & decimal y, (x, baseline_height));
fi
endfor
numeric minx, miny, maxx, maxy;
@@ -322,42 +360,45 @@
if y > maxy: maxy := y; maxx := x; fi
if y < miny: miny := y; minx := x; fi
endfor
-draw (2 up -- up) scaled 2 shifted (maxx, maxy) withcolor red;
-draw (2 down -- down) scaled 2 shifted (minx, miny) withcolor red;
+fill ((0,1)--(1,4)--(-1,4)--cycle) scaled 2 shifted (maxx, maxy) withcolor 1/2 green;
+fill ((0,-1)--(1,-4)--(-1,-4)--cycle) scaled 2 shifted (minx, miny) withcolor 3/4 red;
-numeric left_axis, right_axis; left_axis = -16; right_axis = 368;
+numeric left_axis_x, right_axis_x;
@@ Diff output truncated at 1234567 characters. @@
More information about the tex-live-commits
mailing list.