MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / getDistanceAt

Method getDistanceAt

grid_map_sdf/src/SignedDistanceField.cpp:106–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106double SignedDistanceField::getDistanceAt(const Position3& position) const
107{
108 double xCenter = size_.x() / 2.0;
109 double yCenter = size_.y() / 2.0;
110 int i = std::round(xCenter - (position.x() - position_.x()) / resolution_);
111 int j = std::round(yCenter - (position.y() - position_.y()) / resolution_);
112 int k = std::round((position.z() - zIndexStartHeight_) / resolution_);
113 i = std::max(i, 0);
114 i = std::min(i, size_.x() - 1);
115 j = std::max(j, 0);
116 j = std::min(j, size_.y() - 1);
117 k = std::max(k, 0);
118 k = std::min(k, (int)data_.size() - 1);
119 return data_[k](i, j);
120}
121
122double SignedDistanceField::getInterpolatedDistanceAt(const Position3& position) const
123{

Callers 1

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64