Dessins géométriques et artistiques avec votre micro-ordinateur
👉 https://editor.p5js.org/v3ga/collections/ALPCSgG3E
This repository presents programs written by french mathematician and computer scientist Jean-Paul Delahaye in the book "Dessins géométriques et artistiques avec votre micro-ordinateur" published in 1985 for the Eyrolles french publishing house.
The programs were originally programmed with Microsoft Basic for Canon X-07 computer, outputs were drawn on a Canon X710 plotter. They were recoded with p5.js, the online collection can be found here. You can click on each thumb to jump to the corresponding sketch. Be sure to edit the DESSIN variable in the program header.
I contacted Jean-Paul Delahaye who gave me access to links for downloading scans of the two editions of “Dessins géométriques”. He kindly allowed me to share them.
👉 Dessins géométriques et artistiques avec votre micro-ordinateur
👉 Nouveaux dessins géométriques et artistiques avec votre micro-ordinateur
Library
I tried to be as close as possible as the original syntax, thus I developed a parser that interprets the string generated by LPRINT commands.
The library contains the following command :
Command | Description |
---|---|
INIT |
set up the canvas with an initial size of 500x500 pixels, accepts {svg:true} as parameter to export to vector format |
INIT2(height) |
set up the canvas with the width equal to 500 pixels and a custom height, accepts {svg:true} as parameter to export to vector format |
INIT_WH(width,height) |
set up the canvas with custom width and height, accepts {svg:true} as parameter to export to vector format |
LPRINT(s) |
concatenates s to the OUTPUT global variable used by TRACE() for drawing |
TRACE() |
draw the output using beginShape / vertex / endShape commands by interpretating the string generated by LPRINT calls |
TRACE2() |
draw the output, endShape is not used with CLOSE parameter |
PALETTE(which) |
sets the palette, use RED ,YELLOW or GREEN as parameter. Defaults otherwise to grey background and black stroke |
Some sketches were added a translate command to center the drawing as it happened sometimes it was out of canvas bounds.
Example
let DESSIN = 1;
let NP=480,PI=Math.PI;
let K=3,CX=NP/2,CY=NP/2,R=NP*0.45,AD=0;
function setup()
{
INIT();
for (let I = 0; I < K; I++) {
let X = int(CX + R * cos((2 * I * PI) / K + AD));
let Y = int(CY + R * sin((2 * I * PI) / K + AD));
if (I == 0) LPRINT(`M${X},${Y}`);
if (I > 0) LPRINT(`D${X},${Y}`);
}
TRACE();
}
Summary
- 1. Polygones, étoiles, etc.
- 2. Dessins à partir de données
- 3. Dragons de papiers pliés
- 4. Étoiles fractales
- 5. Courbes
- 6. Dessins linéaires
- 7. Fractales simples
- 8. Quadrillages élastiques
- 9. Surfaces
- 10. La troisième dimension