/* -------------------- Program: ESQUI Info and Bugs: {marf,rsantana}@ctm.ulpgc.es ------------------------------------------- Copyright (c) 2006, Center for Technology in Medicine, University of Las Palmas de Gran Canaria (Canary Islands, Spain). All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Creative Commons' "by-attribution" license (http://creativecommons.org/licenses/by/2.5). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================*/ #ifndef __vtkSimulation_h #define __vtkSimulation_h #include "vtkObject.h" #include "vtkesquiT2MeshWin32Header.h" #include struct vtkMovementTool { vtkIdType ActiveTool; float Yaw; float Forward; float Pitch; float Roll; }; enum vtkTypeOfMovement { FORWARD, YAW, PITCH, BACKWARD, ROLL }; class vtkOrganCollection; class vtkToolCollection; class vtkColision; class vtkInfoColision; class vtkInfoColisionCollection; class vtkRenderWindowInteractor; class vtkPolyDataNormals; class VTK_ESQUI_TMESH_EXPORT vtkSimulation: public vtkObject { public: vtkTypeRevisionMacro(vtkSimulation,vtkObject); static vtkSimulation* New(); const char *GetClassName() {return "vtkSimulation";} void PrintSelf(ostream &os, vtkIndent indent); //! Set/Get the organ collection void SetOrganCollection(vtkOrganCollection *Organos); //! Set/Get the organ collection vtkOrganCollection* GetOrganCollection(); //! Set/Get the tool collection void SetToolCollection(vtkToolCollection *Herramientas); //! Set/Get the tool collection vtkToolCollection* GetToolCollection(); //! Set/Get the collision library void SetCollisionLibrary(vtkColision *Libreria); //! Set/Get the collision library vtkColision* GetCollisionLibrary(); //! Set/Get the interactor void SetInteractor(vtkRenderWindowInteractor *iren); //! Set/Get the interactor vtkRenderWindowInteractor* GetInteractor(); //! Executes a simulation step calling the needed methods. int SimulationStep(); void SetActiveTool(vtkIdType Tool); vtkIdType GetActiveTool(); void SetMovement(vtkTypeOfMovement Tipo, float valor); protected: vtkSimulation(); ~vtkSimulation(); vtkOrganCollection *Organos; vtkToolCollection *Herramientas; vtkColision *LibreriaColisiones; vtkRenderWindowInteractor *Interactor; //! Vertices pinzados por herramienta 1 vtkInfoColisionCollection *_vVertexTool1; //! Vertices pinzados por herramienta 2 vtkInfoColisionCollection *_vVertexTool2; //! Para recalcular las normales vtkPolyDataNormals *Filtro; vtkMovementTool *Movement; float fStep; //BTX bool FreeContacts; //ETX //! Detects collisions calling to collision library int DetectCollisions(); void AddEvents(); void UpdateHaptics(); private: vtkSimulation(const vtkSimulation &); void operator=(const vtkSimulation &); }; #endif