39 for(
auto it = begin();it!=end();it++)
41 result += (*it)->getLength();
56 template<
typename TArray1,
typename TArray2>
57 bool sample(TArray1 sample_array,
int i0,
int i1,TArray2& outx,TArray2& outy,TArray2& outz)
59 if(size()==0)
return false;
60 auto value_position = begin();
61 double range_start = 0;
62 double range_end = (*begin())->
getLength();
63 for(
int i=i0;i<=i1;i++)
65 double sample = sample_array[i];
69 if(value_position==end())
return false;
70 range_start = range_end;
71 range_end += (*value_position)->getLength();
73 if(
sample<range_start)
return false;
74 if((*value_position)->m_path==
nullptr)
76 double s = (
sample-range_start)/(range_end-range_start);
77 outx[i] = (*value_position)->m_id.m_first.m_X + s*((*value_position)->m_id.m_last.m_X - (*value_position)->m_id.m_first.m_X);
78 outy[i] = (*value_position)->m_id.m_first.m_Y + s*((*value_position)->m_id.m_last.m_Y - (*value_position)->m_id.m_first.m_Y);
79 outz[i] = (*value_position)->m_id.m_first.m_Z + s*((*value_position)->m_id.m_last.m_Z - (*value_position)->m_id.m_first.m_Z);
83 auto p = (*value_position)->m_path->f(
sample-range_start);
96 std::vector<Border*>::iterator
bit_;
103 if(bs->size()==0)
return LineIterator(bs->end(),0,
false);
108 if(bs->size()==0)
return LineIterator(bs->end(),0,
false);
109 auto it = std::next(bs->begin(),bs->size()-1);
111 return LineIterator(it,(*it)->m_path->getData().nc()-1);
122 if( (*bit_)->m_path==
nullptr )
136 if((*bit_)->m_path->getData().nc()-1==
idx_)
149 x0 = (*bit_)->m_id.m_first.m_X;
150 y0 = (*bit_)->m_id.m_first.m_Y;
151 z0 = (*bit_)->m_id.m_first.m_Z;
152 x1 = (*bit_)->m_id.m_last.m_X;
153 y1 = (*bit_)->m_id.m_last.m_Y;
154 z1 = (*bit_)->m_id.m_last.m_Z;
158 auto next = std::next(
bit_);
159 x0 = (*bit_)->m_id.m_last.m_X;
160 y0 = (*bit_)->m_id.m_last.m_Y;
161 z0 = (*bit_)->m_id.m_last.m_Z;
162 x1 = (*next)->m_id.m_first.m_X;
163 y1 = (*next)->m_id.m_first.m_Y;
164 z1 = (*next)->m_id.m_first.m_Z;
168 x0 = (*bit_)->m_path->getData()(1,
idx_);
169 y0 = (*bit_)->m_path->getData()(2,
idx_);
170 z0 = (*bit_)->m_path->getData()(3,
idx_);
171 x1 = (*bit_)->m_path->getData()(1,
idx_+1);
172 y1 = (*bit_)->m_path->getData()(2,
idx_+1);
173 z1 = (*bit_)->m_path->getData()(3,
idx_+1);
177 if((*bit_)->m_path==
nullptr)
190 if(
idx_==(*bit_)->m_path->getData().nc()-1)
A class which augments a vector of Border* with some sampling features.
Definition: bordersequence.h:28
bool sample(TArray1 sample_array, int i0, int i1, TArray2 &outx, TArray2 &outy, TArray2 &outz)
step through border sequence and sample the values along the borders
Definition: bordersequence.h:57
LineIterator beginLines()
Definition: bordersequence.h:203
double getLength() const
returns the total lenght of all contained borders
Definition: bordersequence.h:36
LineIterator endLines()
Definition: bordersequence.h:204
x0
Definition: adore_set_goal.py:25
y0
Definition: adore_set_goal.py:26
z0
Definition: adore_set_goal.py:27
y1
Definition: adore_set_pose.py:29
x1
Definition: adore_set_pose.py:28
z1
Definition: adore_set_pose.py:30
Definition: areaofeffectconverter.h:20
Definition: bordersequence.h:95
bool operator!=(const LineIterator &other) const
Definition: bordersequence.h:115
void getValue_nopath(double &x0, double &y0, double &z0, double &x1, double &y1, double &z1)
Definition: bordersequence.h:147
bool valid_
Definition: bordersequence.h:98
void getValue_gap(double &x0, double &y0, double &z0, double &x1, double &y1, double &z1)
Definition: bordersequence.h:156
int idx_
Definition: bordersequence.h:97
void getValue(double &x0, double &y0, double &z0, double &x1, double &y1, double &z1)
Definition: bordersequence.h:175
void operator++(int)
Definition: bordersequence.h:120
static LineIterator begin(std::vector< Border * > *bs)
Definition: bordersequence.h:101
void getValue_normal(double &x0, double &y0, double &z0, double &x1, double &y1, double &z1)
Definition: bordersequence.h:166
static LineIterator end(std::vector< Border * > *bs)
Definition: bordersequence.h:106
LineIterator(std::vector< Border * >::iterator bit, int idx, bool valid=true)
Definition: bordersequence.h:99
std::vector< Border * >::iterator bit_
Definition: bordersequence.h:96