Пример #1
0
    def _GetLimits(self):
        """ _GetLimits()
        
        Get the limits in world coordinates between which the object exists.
        
        """

        # Get vertices and remove nans
        vertices = self._vertices.copy()
        I = np.isnan(vertices[:, 2])
        vertices[I, 0] = np.nan
        I = np.isnan(vertices[:, 1])
        vertices[I, 0] = np.nan
        I = (1 - np.isnan(vertices[:, 0])).astype(np.bool)
        vertices = vertices[I, :]

        try:
            # Obtain untransformed coords
            x1, x2 = vertices[:, 0].min(), vertices[:, 0].max()
            y1, y2 = vertices[:, 1].min(), vertices[:, 1].max()
            z1, z2 = vertices[:, 2].min(), vertices[:, 2].max()

            # There we are
            return Wobject._GetLimits(self, x1, x2, y1, y2, z1, z2)
        except Exception:
            return None
Пример #2
0
    def _GetLimits(self):
        """ _GetLimits()
        
        Get the limits in world coordinates between which the object exists.
        
        """

        # Get vertices and remove nans
        vertices = self._vertices.copy()
        I = np.isnan(vertices[:, 2])
        vertices[I, 0] = np.nan
        I = np.isnan(vertices[:, 1])
        vertices[I, 0] = np.nan
        I = (1 - np.isnan(vertices[:, 0])).astype(np.bool)
        vertices = vertices[I, :]

        try:
            # Obtain untransformed coords
            x1, x2 = vertices[:, 0].min(), vertices[:, 0].max()
            y1, y2 = vertices[:, 1].min(), vertices[:, 1].max()
            z1, z2 = vertices[:, 2].min(), vertices[:, 2].max()

            # There we are
            return Wobject._GetLimits(self, x1, x2, y1, y2, z1, z2)
        except Exception:
            return None
Пример #3
0
 def _GetLimits(self):
     """ Get the limits in world coordinates between which the object exists.
     """
     
     # Obtain untransformed coords 
     shape = self._dataRef3D.shape
     x1, x2 = -0.5, shape[2]-0.5
     y1, y2 = -0.5, shape[1]-0.5
     z1, z2 = -0.5, shape[0]-0.5
     
     # There we are
     return Wobject._GetLimits(self, x1, x2, y1, y2, z1, z2)
Пример #4
0
 def _GetLimits(self):
     """ Get the limits in world coordinates between which the object exists.
     """
     
     # Obtain untransformed coords
     shape = self._dataRef3D.shape
     x1, x2 = -0.5, shape[2]-0.5
     y1, y2 = -0.5, shape[1]-0.5
     z1, z2 = -0.5, shape[0]-0.5
     
     # There we are
     return Wobject._GetLimits(self, x1, x2, y1, y2, z1, z2)
Пример #5
0
 def __init__(self, parent, data):
     
     # Check data first
     if not isinstance(data, np.ndarray):
         raise ValueError('Textures can only be described using Numpy arrays.')
     
     # Instantiate as wobject (after making "sure" this texture can be ok)
     Wobject.__init__(self, parent)
     Colormapable.__init__(self)
     
     # create texture (remember, this is an abstract class)
     self._texture1 = None
     
     # create glsl program for this texture...
     self._shader = shaders.Shader()
     
     # scale and translation transforms
     self._trafo_scale = Transform_Scale()
     self._trafo_trans = Transform_Translate()
     self.transformations.append(self._trafo_trans)
     self.transformations.append(self._trafo_scale)        
Пример #6
0
 def __init__(self, parent, data):
     
     # Check data first
     if not isinstance(data, np.ndarray):
         raise ValueError('Textures can only be described using Numpy arrays.')
     
     # Instantiate as wobject (after making "sure" this texture can be ok)
     Wobject.__init__(self, parent)
     Colormapable.__init__(self)
     
     # create texture (remember, this is an abstract class)
     self._texture1 = None
     
     # create glsl program for this texture...
     self._shader = shaders.Shader()
     
     # scale and translation transforms
     self._trafo_scale = Transform_Scale()
     self._trafo_trans = Transform_Translate()
     self.transformations.append(self._trafo_trans)
     self.transformations.append(self._trafo_scale)        
Пример #7
0
 def __init__(self, parent, *args, **kwargs):
     Wobject.__init__(self, parent)
     
     # Init flat normals
     self._flatNormals = None
     
     # Create colormap and init texture
     Colormapable.__init__(self)
     self._texture = None
     
     # create glsl shaders for this wobject. For faces, edges and shape
     self._faceShader = shaders.Shader()
     self._edgeShader = shaders.Shader()
     self._shapeShader = shaders.Shader()
     self._InitShaders()
     self.useNativeShading = False
     
     # Material properties
     self._ambient = 0.7
     self._diffuse = 0.7
     self._specular = 0.3
     self._shininess = 50
     self._emission = 0.0
     
     # Reference colors
     self._faceColor = (1, 1, 1, 1)
     self._edgeColor = (0,0,0,1)
     
     # Shading
     self.faceShading = 'smooth'
     self.edgeShading = None
     
     # What faces to cull
     self._cullFaces = None # gl.GL_BACK (for surf(), None makes most sense)
     
     # Save data
     BaseMesh.__init__(self, *args, **kwargs)
     
     # Store value2, which are like 'values' but clim-corrected
     self._values2 = self._values
Пример #8
0
 def __init__(self, parent, *args, **kwargs):
     Wobject.__init__(self, parent)
     
     # Init flat normals
     self._flatNormals = None
     
     # Create colormap and init texture
     Colormapable.__init__(self)
     self._texture = None
     
     # create glsl shaders for this wobject. For faces, edges and shape
     self._faceShader = shaders.Shader()
     self._edgeShader = shaders.Shader()
     self._shapeShader = shaders.Shader()
     self._InitShaders()
     self.useNativeShading = False
     
     # Material properties
     self._ambient = 0.7
     self._diffuse = 0.7
     self._specular = 0.3
     self._shininess = 50
     self._emission = 0.0
     
     # Reference colors
     self._faceColor = (1, 1, 1, 1)
     self._edgeColor = (0,0,0,1)
     
     # Shading
     self.faceShading = 'smooth'
     self.edgeShading = None
     
     # What faces to cull
     self._cullFaces = None # gl.GL_BACK (for surf(), None makes most sense)
     
     # Save data
     BaseMesh.__init__(self, *args, **kwargs)
     
     # Store value2, which are like 'values' but clim-corrected
     self._values2 = self._values
Пример #9
0
 def _GetLimits(self):
     """ _GetLimits()
     
     Get the limits in world coordinates between which the object exists.
     
     """
     
     # Get vertices with all coordinates unmasked and finite
     v = self._vertices
     if isinstance(v, np.ma.MaskedArray):
         v = v.filled(np.nan)
     valid = np.isfinite(v[:,0]) * np.isfinite(v[:,1]) * np.isfinite(v[:,2])
     validverts = v[valid,:]
     
     try:
         # Obtain untransformed coords
         x1, y1, z1 = validverts.min(axis=0)
         x2, y2, z2 = validverts.max(axis=0)
         
         # There we are
         return Wobject._GetLimits(self, x1, x2, y1, y2, z1, z2)
     except Exception:
         return None
Пример #10
0
 def _GetLimits(self):
     """ _GetLimits()
     
     Get the limits in world coordinates between which the object exists.
     
     """
     
     # Get vertices with all coordinates unmasked and finite
     v = self._vertices
     if isinstance(v, np.ma.MaskedArray):
         v = v.filled(np.nan)
     valid = np.isfinite(v[:,0]) * np.isfinite(v[:,1]) * np.isfinite(v[:,2])
     validverts = v[valid,:]
     
     try:
         # Obtain untransformed coords
         x1, y1, z1 = validverts.min(axis=0)
         x2, y2, z2 = validverts.max(axis=0)
         
         # There we are
         return Wobject._GetLimits(self, x1, x2, y1, y2, z1, z2)
     except Exception:
         return None
Пример #11
0
 def __init__(self, parent, interval=100):
     Wobject.__init__(self, parent)
     MotionMixin.__init__(self)
     self.motionSplineType = 'nearest'
     self.MotionPlay(interval)
Пример #12
0
 def __init__(self, parent, interval=100):
     Wobject.__init__(self,parent)    
     MotionMixin.__init__(self)
     self.motionSplineType = 'nearest'
     self.MotionPlay(interval)