Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
protokolle:20.12.18 [2019/01/17 17:57] stefanborn |
protokolle:20.12.18 [2019/08/28 00:08] (aktuell) morningstar |
||
---|---|---|---|
Zeile 27: | Zeile 27: | ||
__Hauptprogramm__ | __Hauptprogramm__ | ||
+ | <code> | ||
# coding: utf-8 | # coding: utf-8 | ||
from __future__ import division | from __future__ import division | ||
Zeile 87: | Zeile 87: | ||
| | ||
MyPaintApp().run() | MyPaintApp().run() | ||
+ | </code> | ||
+ | |||
+ | __Mover__ | ||
+ | <code> | ||
+ | import numpy as np | ||
+ | import time | ||
+ | class Mover(object): | ||
| | ||
+ | | ||
+ | def __init__(self, circles): | ||
+ | self.circles = circles | ||
+ | self.v = 5 | ||
+ | while True: | ||
+ | time.sleep(0.1) | ||
+ | for circ in self.circles: | ||
+ | richtung = np.array((-circ.pos[0],-circ.pos[1])) | ||
+ | richtung = 1/np.linalg.norm(richtung) * richtung | ||
+ | circ.pos = (circ.pos[0]+self.v*richtung[0],circ.pos[1]+self.v*richtung[1]) | ||
+ | print circ.pos | ||
+ | </code> | ||
- | + | |[[protokolle:13.12.18|Zurück]] | [[protokolle:10.01.19|Weiter]]| | |
- | + | ||
- | + | ||