Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
recherche:residence_polygones:start [2025/11/11 12:58] gweltaz [Physarum Polycephalum (now in 3D!)] |
recherche:residence_polygones:start [2025/11/13 14:48] (Version actuelle) emoc [Dessiner un fichier svg depuis linux] |
||
|---|---|---|---|
| Ligne 34: | Ligne 34: | ||
| https://web.archive.org/web/20140412054654/http://cic.nist.gov/vrml/vbdetect.html \\ | https://web.archive.org/web/20140412054654/http://cic.nist.gov/vrml/vbdetect.html \\ | ||
| - | ===== Physarum Polycephalum (now in 3D!) ===== | + | ===== Physarum Polycephalum ===== |
| - | Reprise d'un vieux projet de génération de motifs d'après l'algorithme de croissance du [[https://fr.wikipedia.org/wiki/Physarum_polycephalum|Physarum Polycephalum]] (a.k.a "le blob"), mais en y ajoutant une troisième dimension pour passer du pixel au voxel (saupoudré de polygones, histoire de...). | + | **Maintenant en 3D !** 🍩 |
| + | Reprise d'un vieux projet de génération de motifs d'après l'algorithme de croissance du [[https://fr.wikipedia.org/wiki/Physarum_polycephalum|Physarum Polycephalum]] (a.k.a "le blob"), mais en y ajoutant une troisième dimension pour passer du pixel au voxel. | ||
| + | |||
| + | * Godot 4.5 | ||
| * Utilisation d'un compute shader pour accelerer le calcul de diffusion des traces chimiques. | * Utilisation d'un compute shader pour accelerer le calcul de diffusion des traces chimiques. | ||
| - | * Grille 3D relativement petite (32x32x32 à 100x100x100) avec un nombre d'agent/particules allant de 5000 à 20.000 | + | * Grille 3D relativement petite (32x32x32 à 100x100x100) avec un nombre d'agent/particules allant de 5.000 à 20.000 |
| (code source à venir) | (code source à venir) | ||
| - | {{:recherche:residence_polygones:phypoly_1.png?direct&400|}} {{:recherche:residence_polygones:phypoly_2.png?direct&400|}} | + | {{:recherche:residence_polygones:phypoly_1.png?direct&400|}} {{:recherche:residence_polygones:phypoly_2.png?direct&400|}} {{:recherche:residence_polygones:polyphy_3.png?direct&400|}} |
| {{:recherche:residence_polygones:slice_723_0.png?nolink&200|}} | {{:recherche:residence_polygones:slice_723_0.png?nolink&200|}} | ||
| - | (coupe au centre de la grille de voxels) | + | (vue de coupe au centre de la grille de voxels) |
| - | ==== Travaux similaires (mais plus aboutis) ==== | + | ==== Travaux similaires (et plus aboutis) ==== |
| * [[https://escholarship.org/uc/item/1x6458cp|PolyPhy]] | * [[https://escholarship.org/uc/item/1x6458cp|PolyPhy]] | ||
| * [[https://www.researchgate.net/publication/380331398_PhysOM_Physarum_polycephalum_Oriented_Microstructures|PhysOM]] | * [[https://www.researchgate.net/publication/380331398_PhysOM_Physarum_polycephalum_Oriented_Microstructures|PhysOM]] | ||
| + | |||
| + | ===== Pavages de polygones brodés ===== | ||
| + | |||
| + | Les fichiers sont sur la clés usb de la machine, dossier 'laurent' | ||
| + | |||
| + | {{:recherche:residence_polygones:pb101050.jpg?600|}} | ||
| + | |||
| + | {{:recherche:residence_polygones:pb101051.jpg?600|}} | ||
| + | |||
| + | {{:recherche:residence_polygones:pb101055.jpg?600|}} | ||
| + | |||
| + | ===== Roland DPX-3300 ===== | ||
| + | |||
| + | {{:recherche:residence_polygones:pb111077.jpg?400|}} | ||
| + | |||
| + | {{:recherche:residence_polygones:pb111079.jpg?400|}} | ||
| + | ==== Dessiner un fichier svg depuis linux ==== | ||
| + | |||
| + | === Conversion de fichiers svg en RP-GL2 avec vpype-rpgl === | ||
| + | |||
| + | <code> | ||
| + | pipx install vpype | ||
| + | pipx inject vpype https://gitlab.com/losylam/vpype-rpgl/-/archive/v0.1.0/vpype-rpgl-v0.1.0.tar.gz | ||
| + | </code> | ||
| + | |||
| + | Usage | ||
| + | |||
| + | <code> | ||
| + | vpype read input.svg rpwrite output.rpgl | ||
| + | </code> | ||
| + | |||
| + | === Streamer le fichier avec hpplot === | ||
| + | |||
| + | Installation [[https://github.com/rhalkyard/hpplot|hpplot]] | ||
| + | |||
| + | <code> | ||
| + | git clone https://github.com/rhalkyard/hpplot | ||
| + | cd hpplot | ||
| + | pipx install . | ||
| + | </code> | ||
| + | |||
| + | Usage | ||
| + | |||
| + | <code> | ||
| + | hpplot -f query -B 32 /dev/ttyUSB0 output.rpgl | ||
| + | </code> | ||
| + | |||
| + | === Les trucs qui ne marchent pas === | ||
| + | |||
| + | * Le dessin s'arrête avant la fin, il manque les quelques derniers traits et souvent le stylo reste baissé. | ||
| + | * Le dessin est retourné en y (le haut est en bas) => à corriger dans vpype-rpgl | ||
| + | * Le chargement / changement de stylo ne fonctionne pas | ||
| + | * Il faut placer la feuille en bas à gauche (x=11mm, y=8mm), l'origine est fixée en dur dans le plugin (voir plus bas) | ||
| + | |||
| + | ==== Création du plugin vpype-rpgl ==== | ||
| + | Les sources sont disponibles sur [[https://gitlab.com/losylam/vpype-rpgl|gitlab]] | ||
| + | |||
| + | D'après [[https://vpype.readthedocs.io/en/latest/plugins.html | la documentation de pipx]] | ||
| + | |||
| + | 1. Utilisation de cookiecutter pour faire un squelette de plugin vpype | ||
| + | <code> | ||
| + | # installer cookiecutter | ||
| + | pipx install cookiecutter | ||
| + | # initialiser un projet à partir du modèle de plugin | ||
| + | cookiecutter gh:abey79/cookiecutter-vpype-plugin # | ||
| + | </code> | ||
| + | Un formulaire permet de changer le noms du module (ici ''vpype-rpgl'') et de la commande (ici ''rpwrite'') | ||
| + | |||
| + | 2. Conversion | ||
| + | |||
| + | Le processus a lieu dans le fichier ''vpype_rpgl/rpwrite.py'' | ||
| + | |||
| + | Inspiré du plugin [[https://github.com/plottertools/vpype-gcode|vpype-gcode]] | ||
| + | |||
| + | <code python> | ||
| + | from __future__ import annotations | ||
| + | import click | ||
| + | import copy | ||
| + | |||
| + | import vpype as vp | ||
| + | import vpype_cli | ||
| + | |||
| + | |||
| + | def cplx(p: complex, offset_x, offset_y) -> str: | ||
| + | return f"{int(round(p.real)+offset_x)},{int(round(p.imag)+offset_y)}" | ||
| + | |||
| + | # @click.command() | ||
| + | @click.argument("output", type=vpype_cli.FileType("w")) | ||
| + | @vpype_cli.cli.command(group="Plugins") | ||
| + | @vpype_cli.global_processor | ||
| + | def rpwrite(document: vp.Document, output: typing.TextIO) -> vp.LineCollection: | ||
| + | """ | ||
| + | Write rp-gl2 files for the vpype pipeline. | ||
| + | """ | ||
| + | orig_document = document | ||
| + | document = copy.deepcopy(document) # do NOT affect the pipeline's document | ||
| + | unit_scale = vp.convert_length('mm') | ||
| + | # unit_scale = 100 | ||
| + | offset_x = -17750 | ||
| + | offset_y = -11180 | ||
| + | mult = 50 / 1.25 | ||
| + | document.scale(mult / unit_scale, mult / unit_scale) | ||
| + | lc = vp.LineCollection() | ||
| + | layers = document.layers | ||
| + | output.write('IN;') | ||
| + | output.write('PA;') | ||
| + | output.write('SP1;PU;\n') | ||
| + | output.write('OS;\n') | ||
| + | for (layer_id, layer) in layers.items(): | ||
| + | for line in layer: | ||
| + | output.write('PU' + cplx(line[0], offset_x, offset_y) + ';\n') | ||
| + | for pt in line[1:]: | ||
| + | output.write('PD' + cplx(pt, offset_x, offset_y) + ';\n') | ||
| + | |||
| + | output.write('PU 0,0 ;\n') | ||
| + | return orig_document | ||
| + | </code> | ||
| + | |||
| + | ==== TODO ==== | ||
| + | |||
| + | * Corriger les trucs qui ne marchent pas cités plus haut | ||
| + | * Ajoutes des paramètres (vitesse et pression) voir des profils machines comme pour vpype-gcode | ||