BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
backboneModel.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: backboneModel.h,v 1.20.18.1 2007/03/25 21:26:05 oliver Exp $
5 //
6 
7 #ifndef BALL_VIEW_MODELS_BACKBONEMODEL_H
8 #define BALL_VIEW_MODELS_BACKBONEMODEL_H
9 
10 #ifndef BALL_VIEW_MODELS_MODELPROCESSOR_H
12 #endif
13 
14 #ifndef BALL_MATHS_VECTOR3_H
15 # include <BALL/MATHS/vector3.h>
16 #endif
17 
18 #ifndef BALL_KERNEL_SECONDARYSTRUCTURE_H
20 #endif
21 
22 #ifndef BALL_KERNEL_PROTEIN_H
23  #include <BALL/KERNEL/protein.h>
24 #endif
25 
26 #ifndef BALL_MATHS_MATRIX44_H
27  #include <BALL/MATHS/matrix44.h>
28 #endif
29 
30 namespace BALL
31 {
32  namespace VIEW
33  {
42  {
43  //_
44  protected:
45 
46  struct ModelPart
47  {
48  ModelPart();
49  ModelPart(const ModelPart& m);
50  const ModelPart& operator = (const ModelPart& p);
51 
52  // residues for this ModelPart
53  vector<Residue*> residues;
54  // Model Type, e.g. Strand, Helix, Ribbon
56  // start and end index in guide_points_
59  // start and end index in interpolated_points_
62  };
63 
65  {
68  NUCLEIC_ACID
69  };
70 
71  public:
72 
74 
75 
77 
79  AddBackboneModel(const AddBackboneModel& add_Backbone_model);
80 
82  virtual ~AddBackboneModel();
83 
87  virtual void clear();
88 
90  virtual bool start();
91 
99  virtual Processor::Result operator() (Composite& composite);
100 
108  virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
109 
111  void setTubeRadius(float radius)
112  { tube_radius_ = radius;}
113 
115  float getTubeRadius() const
116  { return tube_radius_;}
117 
119  virtual bool createGeometricObjects();
120 
122  void setRibbonMode(bool state)
123  {ribbon_mode_ = state;}
124 
126  bool ribbonModeEnabled() const
127  {return ribbon_mode_;}
128 
129  protected:
130 
131  virtual void calculateModelParts(Protein& protein);
132  virtual bool collectPositions(vector<Residue*> residues);
133  virtual void calculateGuidePoints_();
134 
135  virtual void assignModelType(ModelPart& part);
136 
137  virtual void createModel_(Position set_pos, Position model_pos);
138  // build a tube model
139  virtual void createTube_(Position set_pos, Position model_pos);
140  // build a ribbon / helix
141  virtual void createRibbon_(Position set_pos, Position model_pos);
142 
143 
144  virtual void refineGuidePoints_() {};
145  virtual void interpolate_();
146  virtual void refineModelParts_();
147 
148  virtual void clear_();
149 
150  inline void evaluateBSpline(const Vector3& v1, const Vector3& v2,
151  const Vector3& v3, float x, Vector3& result);
152 
153  inline bool residuesAreConnected_(Residue& residue1, Residue& residue2);
154 
155  inline void calculateTubePoints_(Vector3 right, Vector3 dir, vector<Vector3>& points);
156  inline void calculateRibbonPoints_(Vector3 xn, Vector3 dir, vector<Vector3>& points);
157  inline void calculateRibbonEllipse_(float ribbon_width, float ribbon_height);
158 
159  //_
161 
162  //_
164  // must be alwas uneven:
170 
171  vector<vector<vector<Vector3> > > guide_points_;
172  vector<vector<vector<Vector3> > > interpolated_points_;
173  vector<vector<Vector3> > backbone_;
174  vector<vector<Vector3> > offsets_;
175  vector<vector<ModelPart> > model_parts_;
176 
182  vector<vector<Index> > ss_;
183  // temp variables for speedup:
189  vector<float> xs_, ys_;
190  };
191 
192  } // namespace VIEW
193 } // namespace BALL
194 
195 #endif // BALL_VIEW_MODELS_BACKBONEMODEL_H