コード例 #1
0
ファイル: presenter.py プロジェクト: tps12/Why-So-Spherious
 def map_dragged(self, start, end):
     th, u = self._projection.get_xy_rotation(start[0], start[1],
                                              end[0], end[1])
     x, y, z = [c * sin(th/2) for c in u]
     rot = quat(cos(th/2), x, y, z) * self._rotation
     if not any((isnan(c) for c in rot.q)):
         self._rotation = rot
     self.view_map_size_changed(self._view.map_size)
コード例 #2
0
ファイル: presenter.py プロジェクト: tps12/Why-So-Spherious
    def __init__(self, model, view):
        projections = [SineProjection, FlatProjection]

        self._model = model
        
        self._view = view
        self._view.set_projection_options(projections,
                                          self._set_projection)

        self._rotation = quat(1)
        
        self._view.map_size_changed = self.view_map_size_changed
        self._view.map_dragged = self.map_dragged

        self._set_projection(projections[0])
コード例 #3
0
ファイル: presenter.py プロジェクト: tps12/Why-So-Spherious
 def _rotate(self, v):
     q = quat(0,v[0],v[1],v[2])
     return ((self._rotation*q)/self._rotation).q[1:4]