20 #ifndef __OpenKarto_GridIndexLookup_h__ 21 #define __OpenKarto_GridIndexLookup_h__ 147 , m_ppLookupArray(NULL)
169 return m_ppLookupArray[index];
190 assert(angleOffset != 0.0);
191 assert(angleResolution != 0.0);
208 Pose2 vec = transform.InverseTransformPose(
Pose2(*iter, 0.0));
209 localPoints.Add(vec);
215 kt_double startAngle = angleCenter - angleOffset;
216 for (
kt_int32u angleIndex = 0; angleIndex < nAngles; angleIndex++)
218 angle = startAngle + angleIndex * angleResolution;
219 ComputeOffsets(angleIndex, angle, localPoints);
233 m_ppLookupArray[angleIndex]->SetSize(static_cast<kt_int32u>(rLocalPoints.
Size()));
234 m_Angles[angleIndex] = angle;
239 const Vector2d& rGridOffset = m_pGrid->GetCoordinateConverter()->GetOffset();
246 kt_int32s* pAngleIndexPointer = m_ppLookupArray[angleIndex]->GetArrayPointer();
250 const Vector2d& rPosition = iter->GetPosition();
254 offset.
SetX(cosine * rPosition.
GetX() - sine * rPosition.
GetY());
255 offset.
SetY( sine * rPosition.
GetX() + cosine * rPosition.
GetY());
258 Vector2i gridPoint = m_pGrid->WorldToGrid(offset + rGridOffset);
261 kt_int32s lookupIndex = m_pGrid->Grid<T>::GridIndex(gridPoint,
false);
263 pAngleIndexPointer[readingIndex] = lookupIndex;
267 assert(readingIndex == rLocalPoints.
Size());
280 if (m_ppLookupArray != NULL)
295 m_Angles.Resize(size);
305 delete m_ppLookupArray[i];
308 delete[] m_ppLookupArray;
309 m_ppLookupArray = NULL;
328 #endif // __OpenKarto_GridIndexLookup_h__
virtual kt_size_t Size() const
const List< kt_double > & GetAngles() const
kt_int32s * GetArrayPointer()
kt_bool IsUpTo(const T &value, const T &maximum)
void ComputeOffsets(kt_int32u angleIndex, kt_double angle, const Pose2List &rLocalPoints)
kt_double Round(kt_double value)
Pose2 GetSensorPose() const
void ComputeOffsets(LocalizedLaserScan *pScan, kt_double angleCenter, kt_double angleOffset, kt_double angleResolution)
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
List< kt_double > m_Angles
const LookupArray * GetLookupArray(kt_int32u index) const
kt_int32s & operator[](kt_int32u index)
void SetSize(kt_int32u size)
GridIndexLookup(Grid< T > *pGrid)
kt_int32u GetSize() const
virtual ~GridIndexLookup()
LookupArray ** m_ppLookupArray
kt_int32s * GetArrayPointer() const
void SetSize(kt_int32u size)
kt_int32s operator[](kt_int32u index) const
#define karto_const_forEach(listtype, list)
const Vector2dList & GetPointReadings(kt_bool wantFiltered=false) const