class attach_ring: public bist_plugin{
public:
  attach_ring(immagine* image, string libpath);
  virtual ~attach_ring();
  
  virtual bool act(int e);
  
  
  virtual void register_plugin();
  virtual bool time_to_act();
  

  virtual bool need_atom();
  virtual bool need_leg();

  virtual string libpath();
  void inizialize();


  bool search(string start,bool& found);

  virtual std::string menu_path();

protected:

  void  attach(bool aromatic);

  std::pair<float,float> calc_angle(atomo* slot, gruppo ring);

  float calc_bisect(std::vector<float> x_n,
                    std::vector<float> y_n,
                    float min_pos, float max_neg);

  void sort_ang_idx(std::vector< std::pair<float,int> >& vc, bool asc);

  bool _has_to_act;
  bool _has_acted;
  int  _vertices;
  

};

extern "C" bist_plugin* create_plugin(immagine* imm, string libpath);
extern "C"  void destroy_plugin(bist_plugin* j);

