kurse:efcomputergrafik:teil2:brainstorm

This is an old revision of the document!


Ziele

  • Physikalisch halbwegs realistische Achterbahn mit Blender
  • Ansteuerung des Whiteboard-Plotters vom Tech-Lab. Siehe https://fginfo.ksbg.ch/~ivo/videos/tech-lab-whiteboard-plotter.mp4. Input: SVG-Datei aus Inkscape, Output: Folge von $(r_1,r_2)$-Koordinaten, die linear abgefahren werden, plus Kommandos zum Heben/Senken des Stifts. Einheit: mm.

Programm

Brainstorm

Blender stuff

Zusammenfassung: Add → Curve → Bezier

  • 'e' → Extrude um neuen Punkt anzufügen.
  • 'gz' → In z-Richtung verschieben.
  • Auf Koordinatenachsen klicken, für orthonormale Projektion
  • Rechtsklick 'Toggle Cyclic'
import bpy
 
obj = bpy.data.objects['BezierCurve']
 
if obj.type == 'CURVE':
    for subcurve in obj.data.splines:
        curvetype = subcurve.type
        if curvetype == 'BEZIER':
            print("curve is closed:", subcurve.use_cyclic_u)
            for bezpoint in subcurve.bezier_points:
                print('knot', bezpoint.co)
                print('handle_left', bezpoint.handle_left)
                print('handle_right', bezpoint.handle_right)
# Eigene, selbstgeschriebene Bezier-Klasse
Bezier = bpy.data.texts["bezier.py"].as_module().Bezier
e = bpy.data.objects['Camera']
e.animation_data_clear()
 
# Loop über die frames
    # Orthonormales system (y,-an,-vv) und Ursprung pp 
    # wobei -vv die Blickrichtung, -an nach unten zeigt und y nach rechts zeigt.
    # matrix_world = (rechts, unten, hinten)
    e.matrix_world = ( (y.x,y.y,y.z,1), (-an.x, -an.y, -an.z, 1),  (-vv.x,-vv.y,-vv.z,1),  (pp.x, pp.y, pp.z, 0))
    # Rotation und Translation "keyframen"
    e.keyframe_insert(data_path="rotation_euler", frame=frame)
    e.keyframe_insert(data_path="location", frame=frame)
    frame+=1
import numpy as np
 
a = np.array([[3,1], [1,2]])
b = np.array([9,8])
x = np.linalg.solve(a, b)
print(x)  # Das geht unter Linux ins Terminal, wo Blender gestartet wurde. Keine Ahnung wohin das sonst geht...
ffmpeg -r 30 -i %04d.png test.mkv

Z.B. https://fginfo.ksbg.ch/~ivo/videos/achterbahn-take1.mkv

  • kurse/efcomputergrafik/teil2/brainstorm.1573998412.txt.gz
  • Last modified: 2019/11/17 14:46
  • by Ivo Blöchliger