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/08 18:20] emoc [(titre du projet)] |
recherche:residence_polygones:start [2025/11/08 22:27] (Version actuelle) emoc ç |
||
|---|---|---|---|
| Ligne 11: | Ligne 11: | ||
| ===== mesh 2 svg ===== | ===== mesh 2 svg ===== | ||
| - | Meshlab : https://www.meshlab.net/ | + | Meshlab : https://www.meshlab.net/ Rien tiré de meshlab pour transformer un mesh (stl, obj) en svg \\ |
| - | Visualiseur en ligne pour fichiers VRML : https://imagetostl.com/view-wrl-online#convert \\ | + | Premier essai concluant avec https://www.svgai.org/convert/stl-to-svg, le fichier s'ouvre bien avec inkscape, l'épaisseur des traits est bien trop élevée mais ça s'arrange facilement. __Aucune face n'est cachée__ |
| + | **Conseil de Laurent : utiliser «ln» de Michael Fogleman** : https://github.com/fogleman/ln | ||
| + | C'est programmé en Go, jamais utilisé | ||
| + | # ************************************** # installation du langage Go sur Debian 12 @ tenko | ||
| + | sudo apt update | ||
| + | sudo apt install golang | ||
| + | go version # go version go1.19.8 linux/amd64 | ||
| + | go env GOPATH # ok : /home/emoc/go | ||
| + | go install github.com/fogleman/ln/ln@latest | ||
| + | mkdir -p ~/go/bin | ||
| + | | ||
| + | Aucun des tests d'installation ne fonctionne correctement ... (ci-dessous) | ||
| + | git clone https://github.com/fogleman/ln.git | ||
| + | cd ln | ||
| + | go mod init lnbuild | ||
| + | go mod tidy | ||
| + | go build -o ~/go/bin/ln ./ln | ||
| + | chmod +x ~/go/bin/ln | ||
| + | ~/go/bin/ln --help # erreur | ||
| + | |||
| + | alors plutôt j'essaie de comprendre comment doit fonctionner go... | ||
| + | |||
| + | **Test d'un helloworld** \\ | ||
| + | Créer un fichier vide hello.go | ||
| + | nano hello.go | ||
| + | Y écrire | ||
| + | <code go> | ||
| + | package main | ||
| + | |||
| + | import "fmt" | ||
| + | |||
| + | func main() { | ||
| + | fmt.Println("HelloWorld, Golang!") | ||
| + | } | ||
| + | </code> | ||
| + | Puis | ||
| + | go run hello.go | ||
| + | | ||
| + | **Transformation d'un .OBJ en .SVG** | ||
| + | Ça marche! Le fichier svg est créé, en fonction du point de vue défini dans le script go, les faces qui doivent l'être sont cachées. | ||
| + | git clone https://github.com/fogleman/ln.git | ||
| + | cd ln | ||
| + | go mod init ln/ln | ||
| + | go mod tidy | ||
| + | go run teapot.go | ||
| + | |||
| + | placer le fichier teapot.obj dans le dossier et créer le fichier teapot.go : | ||
| + | <code go> | ||
| + | package main | ||
| + | |||
| + | import "github.com/fogleman/ln/ln" | ||
| + | |||
| + | func main() { | ||
| + | scene := ln.Scene{} | ||
| + | mesh, err := ln.LoadOBJ("teapot.obj") | ||
| + | if err != nil { | ||
| + | panic(err) | ||
| + | } | ||
| + | mesh.UnitCube() | ||
| + | scene.Add(ln.NewTransformedShape(mesh, ln.Rotate(ln.Vector{0, 1, 0}, 0.5))) | ||
| + | // scene.Add(mesh) | ||
| + | eye := ln.Vector{-0.5, 0.5, 2} | ||
| + | center := ln.Vector{} | ||
| + | up := ln.Vector{0, 1, 0} | ||
| + | width := 1024.0 | ||
| + | height := 1024.0 | ||
| + | paths := scene.Render(eye, center, up, width, height, 35, 0.1, 100, 0.01) | ||
| + | paths.WriteToPNG("teapot.png", width, height) | ||
| + | paths.WriteToSVG("teapot.svg", width, height) | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | ==== Petite parenthèse VRML ==== | ||
| + | |||
| + | Visualiseur en ligne pour fichiers VRML : https://imagetostl.com/view-wrl-online#convert \\ | ||
| Navigateur VRML à compiler : https://freewrl.sourceforge.io/examples.html \\ | Navigateur VRML à compiler : https://freewrl.sourceforge.io/examples.html \\ | ||
| - | Peut être possible d'afficher un fichier VRML avevc : https://castle-engine.io/ | + | Peut être possible d'afficher un fichier VRML avevc : https://castle-engine.io/ \\ |
| + | https://www.qiew.org/ \\ | ||
| + | https://web.archive.org/web/20140412054654/http://cic.nist.gov/vrml/vbdetect.html \\ | ||
| + | |||