00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: P_RotateTool.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.35 $ $Date: 2019/01/17 21:21:01 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu 00019 * 00020 * This tool, meant for use with a haptic device, is useful for 00021 * accurate rotations. Pressing the button grabs the molecule and 00022 * fixes you to the surface of a sphere. Moving around its surface 00023 * rotates as if you are grabbing a big trackball. I want to add 3d 00024 * detentes! 00025 * 00026 ***************************************************************************/ 00027 #ifdef VMDVRPN 00028 #include "P_Tool.h" 00029 00033 class RotateTool : public Tool { 00034 public: 00035 RotateTool(int id, VMDApp *, Displayable *); 00036 virtual void do_event(); 00037 virtual const float *position() const; 00038 virtual int isgrabbing(); 00039 virtual const Matrix4 *orientation(); 00040 00041 const char *type_name() const { return "rotate"; } 00042 private: 00043 int grab_toggle; 00044 int button_was_down; 00045 00046 int constrained; 00047 float rotatecenter[3]; 00048 float rotateradius; 00049 float constrainedpos[3]; 00050 float old_pos[3]; 00051 float old_normal[3]; 00052 q_type qoffset; 00053 Matrix4 offset; 00054 Matrix4 start; 00055 Matrix4 product; 00056 }; 00057 00058 #endif