Example #1
0
    def __init__(self):
        """
        Initialisation of the Box object
        """
        debugMsg("Called Box.__init__()")
        Item.__init__(self)

        # define a box in many ways, either by its centre and width, height
        # and depth, or by its bounds, xmin, xmax, ymin, ymax, zmin, zmax,
        # or by its bottom left front and top right back points.

        # set the default bounds
        self.xmin = -0.5
        self.xmax = 0.5
        self.ymin = -0.5
        self.ymax = 0.5
        self.zmin = -0.5
        self.zmax = 0.5

        # set the default origin (the centre of the box)
        self.origin = ((self.xmin + self.xmax)/2.0, 
                (self.ymin + self.ymax)/2.0, 
                (self.zmin + self.zmax)/2.0)

        # set the default dimensions
        self.width = self.xmax - self.xmin
        self.height = self.ymax - self.ymin
        self.depth = self.zmax - self.zmin

        # set the default blf and trb points
        self.blf = (self.xmin, self.ymin, self.zmin)
        self.trb = (self.xmax, self.ymax, self.zmax)

        # tolerance for calculated variables checking purposes
        self.tolerance = 1e-8
Example #2
0
    def __init__(self, scene):
        """
        Initialisation of the Plane object
        """
        debugMsg("Called Plane.__init__()")
        Item.__init__(self)

        self.renderer = scene.renderer
Example #3
0
    def __init__(self, scene=None):
        """
        Initialises the Image class object
        
        @param scene: The Scene object to add to
        @type scene: Scene object
        """
        debugMsg("Called Image.__init__()")
        Item.__init__(self)

        if scene is not None:
            self.renderer = scene.renderer
Example #4
0
    def __init__(self, scene):
        """
        Initialisation of the Text object

        @param scene: the scene with which to associate the Text object
        @type scene: Scene object
        """
        debugMsg("Called Text.__init__()")
        Item.__init__(self)
        self.font = "Times"

        if scene is None:
            raise ValueError, "You must specify a scene object"
Example #5
0
    def __init__(self, scene):
        """
        Initialisation of the abstract Plot class
        
        @param scene: The Scene to render the plot in
        @type scene: Scene object
        """
        debugMsg(" Called Plot.__init__()")
        Item.__init__(self)

        self.renderer = scene.renderer

        # defaults for plot label-type stuff
        self.title = None
        
        self.xlabel = None
        self.ylabel = None
        self.zlabel = None

        # list of objects registered with this plot object
        self.objectList = []
Example #6
0
    def __init__(self, scene):
        """
        Initialisation of the Camera object

        @param scene: The Scene object to add the Camera object to
        @type scene: Scene object
        """
        debugMsg("Called Camera.__init__()")
        Item.__init__(self)

        # default x,y,z positions of Camera (specific to vtk)
        self.xPos = 0.0
        self.yPos = 0.0
        self.zPos = 3.0

        # default x,y,z positions of the Camers's focal point (specific to vtk)
        self.xFocalPoint = 0.0
        self.yFocalPoint = 0.0
        self.zFocalPoint = 0.0

        # default elevation and azimuth
        # these need to be set to the matlab defaults
        self.elevation = 30
        self.azimuth = 30

        # keep a reference to the renderer so we can send stuff to it
        self.renderer = scene.renderer

        # some vtk initialisation commands
        self.renderer.runString("# Camera.__init__()")
        self.renderer.runString("_camera = _renderer.GetActiveCamera()")

        # initialise the position of the Camera
        self.setPosition(self.xPos, self.yPos, self.zPos)
        self.setFocalPoint(self.xFocalPoint, self.yFocalPoint, self.zFocalPoint)
        self.renderer.runString("_renderer.SetActiveCamera(_camera)")
        # dunno if this next line is exactly necessary
        self.renderer.runString("_renderer.ResetCamera()")