ResolveAngle.cpp
Go to the documentation of this file.
2 
3 ResolveAngle::ResolveAngle(vector< Geometry::Vector3d> list)
4 {
5  list_ = list;
6  a_ = Resolve();
7  if (list_.size() > 0)
8  b_ = Resolve();
9  if (list_.size() > 0)
10  c_ = Resolve();
11  Dec();
12 }
13 
15 {
16 
17 }
18 
19 
20 vector< Geometry::Vector3d> ResolveAngle::Resolve()
21 {
22  vector< Geometry::Vector3d> m;
23  Geometry::Vector3d temp;
24  temp = *list_.begin();
25 
26  vector< Geometry::Vector3d>::iterator it;
27  for (it = list_.begin(); it != list_.end();)
28  {
30  double s= Geometry::angle(target, temp);
31  if (Geometry::angle(target, temp) < extruder_.Angle())
32  {
33  m.push_back(target);
34  temp = target;
35  it=list_.erase(it);
36  }
37  else
38  {
39  break;
40  }
41  }
42 
43  if (list_.size() >0 )
44  {
45  for (it = list_.end()-1; it != list_.begin();)
46  {
48  if (Geometry::angle(target, temp) < extruder_.Angle())
49  {
50  m.push_back(target);
51  temp = target;
52  list_.erase(it);
53  it = list_.end() - 1;
54  }
55  else
56  {
57  break;
58  }
59  }
60  }
61  return m;
62 }
63 
65 {
66  a_.clear();
67  b_.clear();
68  c_.clear();
69 
70 }
71 
73 {
74  vector<Geometry::Vector3d> max;
75  max = a_;
76  if (max.size() < b_.size())
77  max = b_;
78 
79  if (max.size() < c_.size())
80  max = c_;
81 
82  if (max.size() == 1)
83  {
84  dec = max[0];
85  wave = 0;
86  return;
87  }
88 
89 
90  if (max.size() ==72)
91  {
92  int id = 0;
93  double z_max = -1;
94  for (int i = 0; i < max.size(); i++)
95  {
96  if (z_max < max[i].getZ())
97  {
98  z_max = max[i].getZ();
99  id = i;
100  }
101  }
102 
103 
104  dec = max[id];
105  wave = 2 * F_PI;
106  return;
107 
108  }
109 
110 
111  Geometry::Vector3d temp_max(0,0,0);
112 
113  for (int i = 0; i < max.size(); i++)
114  {
115  temp_max =temp_max+ max[i];
116  }
117  temp_max.normalize();
118  dec = temp_max;
119  wave = 0;
120  for (int i = 0; i < max.size(); i++)
121  {
122  if (Geometry::angle(temp_max, max[i])>wave)
123  wave = Geometry::angle(temp_max, max[i]);
124 
125  }
126 
127 }
const GLfloat * m
static double angle(Vector3d vec1, Vector3d vec2)
Definition: Geometry.h:158
Geometry::Vector3d dec
Definition: ResolveAngle.h:56
vector< Geometry::Vector3d > a_
Definition: ResolveAngle.h:58
GLenum target
vector< Geometry::Vector3d > c_
Definition: ResolveAngle.h:60
vector< Geometry::Vector3d > Resolve()
ExtruderCone extruder_
Definition: ResolveAngle.h:62
#define F_PI
Definition: GCommon.h:54
GLdouble s
vector< Geometry::Vector3d > list_
Definition: ResolveAngle.h:63
vector< Geometry::Vector3d > b_
Definition: ResolveAngle.h:59
double Angle()
Definition: ExtruderCone.h:68
TFSIMD_FORCE_INLINE const tfScalar & getZ() const


choreo_task_sequence_planner
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:03:14