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 | ||
projets:infini:mecanique:accueil [2016/11/25 11:54] resonance [Modélisation infini] |
projets:infini:mecanique:accueil [2016/11/25 12:20] (Version actuelle) resonance [Modélisation infini] |
||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
===== Modélisation " | ===== Modélisation " | ||
- | <iframe src=" | + | * Fichiers : {{: |
+ | |||
+ | |||
+ | <WRAP group> | ||
+ | <WRAP half column> | ||
+ | |||
+ | < | ||
+ | <iframe src=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP half column> | ||
+ | |||
+ | < | ||
+ | <iframe src=" | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ++++ Code Python : générateur du .stl (développé par Guillaume Gay merci!) | | ||
+ | <code python> | ||
+ | import numpy as np | ||
+ | import argparse | ||
+ | |||
+ | def generate_curve(n_segments=120, | ||
+ | """ | ||
+ | Generate a Moebius curve in 3D | ||
+ | |||
+ | Parameters | ||
+ | ---------- | ||
+ | n_segments: int | ||
+ | the number of segments (higher -> higher definition) | ||
+ | a: float | ||
+ | amplitude of the curve in the x,y plane | ||
+ | b: float | ||
+ | amplitude of the curve along z | ||
+ | obj_file: str | ||
+ | name / path to the output obj file | ||
+ | """ | ||
+ | t = np.linspace(-np.pi/ | ||
+ | |||
+ | xx = np.sqrt(2 * a**2 * np.cos(2*t)) * np.cos(t) | ||
+ | yy = np.sqrt(2 * a**2 * np.cos(2*t)) * np.sin(t) | ||
+ | xx = np.concatenate([-xx[:: | ||
+ | yy = np.concatenate([-yy[:: | ||
+ | |||
+ | zz = b * np.sin(2*t) | ||
+ | zz = np.concatenate([zz[:: | ||
+ | verts = np.vstack([xx, | ||
+ | faces = np.array([np.arange(verts.shape[0])], | ||
+ | |||
+ | obj_text = ''' | ||
+ | # Wavefront OBJ file | ||
+ | # Created by glyg. | ||
+ | # | ||
+ | # unnamed object | ||
+ | |||
+ | ''' | ||
+ | obj_text += '# {} vertices, no textcoords, no normals, 1 faces\n' | ||
+ | verts.shape[0]) | ||
+ | for v in verts: | ||
+ | obj_text += 'v {:.10f} {:.10f} {: | ||
+ | for f in faces: | ||
+ | indices = ' ' | ||
+ | obj_text += 'f ' | ||
+ | |||
+ | with open(obj_file, | ||
+ | of.write(obj_text) | ||
+ | |||
+ | |||
+ | if __name__ == ' | ||
+ | parser = argparse.ArgumentParser() | ||
+ | parser.add_argument(" | ||
+ | parser.add_argument(" | ||
+ | parser.add_argument(" | ||
+ | parser.add_argument(" | ||
+ | args = parser.parse_args() | ||
+ | generate_curve(n_segments=args.nb, | ||
+ | |||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | Dans Blender, importer le stl, le transformer en " | ||
==== En 2D ==== | ==== En 2D ==== | ||
Lemniscate de Bernouilli : https:// | Lemniscate de Bernouilli : https:// |