MCPcopy Create free account
hub / github.com/KumarRobotics/sloam / distance

Method distance

sloam/src/objects/cylinder.cpp:175–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175Scalar Cylinder::distance(const CylinderParameters &tgt) const
176{
177 // sample trees at pre-defined heights
178 std::vector<Scalar> heights;
179 heights.push_back(0.0);
180 heights.push_back(3.0);
181 heights.push_back(6.0);
182
183 Scalar distance = 0.0;
184 for (const auto &height : heights)
185 {
186 Scalar src_t = (height - model.root[2]) / model.ray[2];
187 Vector3 modelPoint = model.root + src_t * model.ray;
188
189 Scalar tgt_t = (height - tgt.root[2]) / tgt.ray[2];
190 Vector3 tgtPoint = tgt.root + tgt_t * tgt.ray;
191 distance += (modelPoint - tgtPoint).norm();
192 }
193 return distance / 3.0;
194};
195
196Scalar Cylinder::distance(const PointT &point) const
197{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected