Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:51

0001 #!/usr/bin/env python
0002 #
0003 # Copyright (c) 2019 Opticks Team. All Rights Reserved.
0004 #
0005 # This file is part of Opticks
0006 # (see https://bitbucket.org/simoncblyth/opticks).
0007 #
0008 # Licensed under the Apache License, Version 2.0 (the "License"); 
0009 # you may not use this file except in compliance with the License.  
0010 # You may obtain a copy of the License at
0011 #
0012 #   http://www.apache.org/licenses/LICENSE-2.0
0013 #
0014 # Unless required by applicable law or agreed to in writing, software 
0015 # distributed under the License is distributed on an "AS IS" BASIS, 
0016 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0017 # See the License for the specific language governing permissions and 
0018 # limitations under the License.
0019 #
0020 
0021 """
0022 This turned out not to help much, easier to simply construct 
0023 eye-look-up array directly as done in:
0024 
0025 flightpath.py
0026     early attempts, at mpl viz of flight path with 3D arrows, 
0027     quiver plots turned out to be a better way  
0028 
0029 mm0prim2.py 
0030     xz + xy circles path and testing flightpath cmds
0031 
0032 """
0033 import numpy as np
0034 
0035 class View(object):
0036     EYE = 0 
0037     LOOK = 1 
0038     UP = 2 
0039     def __init__(self, eye=[-1,1,0], look=[0,0,0], up=[0,0,1], dtype=np.float32 ):
0040         self.v = np.zeros( (4,4), dtype=dtype )
0041         self.eye = eye
0042         self.look = look
0043         self.up = up
0044 
0045     def _set_eye(self, a ):
0046         self.v[self.EYE,:3] = a[:3]
0047     def _get_eye(self):
0048         return self.v[self.EYE,:3] 
0049     eye = property(_get_eye, _set_eye)
0050 
0051     def _set_look(self, a ):
0052         self.v[self.LOOK,:3] = a[:3]
0053     def _get_look(self):
0054         return self.v[self.LOOK,:3] 
0055     look = property(_get_look, _set_look)
0056 
0057     def _set_up(self, a ):
0058         self.v[self.UP,:3] = a[:3]
0059     def _get_up(self):
0060         return self.v[self.UP,:3] 
0061     up = property(_get_up, _set_up)
0062 
0063 
0064 
0065 if __name__ == '__main__':
0066 
0067      v = View()
0068      print repr(v.v)
0069 
0070      v.eye = [3,3,3]
0071      print repr(v.v)
0072 
0073 
0074 
0075