Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


projets:infini:mecanique:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

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:56]
resonance
projets:infini:mecanique:accueil [2016/11/25 12:20] (Version actuelle)
resonance [Modélisation infini]
Ligne 6: Ligne 6:
   * Fichiers : {{:projets:infini:mecanique:fichiers_infini.zip|}}   * Fichiers : {{:projets:infini:mecanique:fichiers_infini.zip|}}
  
 +
 +<WRAP group>
 +<WRAP half column>
  
 <html> <html>
-<iframe src="http://reso-nance.org/public/infini/infini.html" width="50%" height="400px" seamless frameBorder="0"></iframe>+<iframe src="http://reso-nance.org/public/infini/infini.html" width="100%" height="400px" seamless frameBorder="0"></iframe>
 </html> </html>
 +</WRAP>
 +
 +<WRAP half column>
  
 <html> <html>
-<iframe src="http://reso-nance.org/public/infini/infini2.html" width="50%" height="400px" seamless frameBorder="0"></iframe>+<iframe src="http://reso-nance.org/public/infini/infini2.html" width="100%" height="400px" seamless frameBorder="0"></iframe>
 </html> </html>
  
 +</WRAP>
 +</WRAP>
 +
 +
 +
 +++++ 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, a=2, b=0.5, obj_file='test.obj'):
 +    """
 +    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/4, np.pi/4, n_segments//2)
 +
 +    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[::-1], xx])
 +    yy = np.concatenate([-yy[::-1], yy])
 +
 +    zz = b * np.sin(2*t)
 +    zz = np.concatenate([zz[::-1], zz])
 +    verts = np.vstack([xx, yy, zz]).T
 +    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'.format(
 +        verts.shape[0])
 +    for v in verts:
 +        obj_text += 'v {:.10f} {:.10f} {:.10f}\n'.format(v[0], v[1], v[2])
 +    for f in faces:
 +        indices = ' '.join(str(idx+1) for idx in f)
 +        obj_text += 'f '+indices+'\n'
 +
 +    with open(obj_file, 'w+') as of:
 +        of.write(obj_text)
 +
 +
 +if __name__ == '__main__':
 +    parser = argparse.ArgumentParser()
 +    parser.add_argument("nb", help="number of segments", type=int)
 +    parser.add_argument("amplitude", help="amplitude in meter", type=float)
 +    parser.add_argument("width", help="width in meter", type=float)
 +    parser.add_argument("f", help="output OBJ file")
 +    args = parser.parse_args()
 +    generate_curve(n_segments=args.nb, a=args.amplitude, b=args.width, obj_file=args.f)
 +
 +</code>
 +++++
  
 +Dans Blender, importer le stl, le transformer en "curve" (alt-c), ajouter une forme mesh circle ou plane, transformé également en curve. Sélectionner le stl, aller dans le menu "curve properties" (icône d'une courbe) et dans Bevel object choisissez le cercle ou le carré. En redimensionnant cette forme, cela modifie tout l'objet.
  
 ==== En 2D ==== ==== En 2D ====
/home/resonancg/www/wiki/data/attic/projets/infini/mecanique/accueil.1480071397.txt.gz · Dernière modification: 2016/11/25 11:56 de resonance