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 00010 00014 #ifndef P_SPRINGTOOL_H 00015 #define P_SPRINGTOOL_H 00016 00017 #include "P_Tool.h" 00018 class SpringTool : public Tool { 00019 public: 00020 SpringTool(int id, VMDApp *, Displayable *); 00021 virtual void do_event(); 00022 virtual int isgrabbing() { return 0; } // tug instead of grabbing! 00023 00024 virtual void setspringscale(float sc) { 00025 springscale=sc; 00026 Tool::setspringscale(sc); 00027 } 00028 00029 const char *type_name() const { return "spring"; } 00030 00031 protected: 00032 virtual void start_tug() {} 00033 00034 private: 00035 virtual int istugging() { return Tool::isgrabbing(); } 00036 virtual void do_tug(float *force); 00037 virtual void set_tug_constraint(float *pos); 00038 00039 int tugging; 00040 float tugged_pos[3]; 00041 float offset[3]; // An offset so that initial force is always zero 00042 float springscale; 00043 }; 00044 00045 #endif