| 173 | } |
| 174 | |
| 175 | Scalar 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 | |
| 196 | Scalar Cylinder::distance(const PointT &point) const |
| 197 | { |
nothing calls this directly
no outgoing calls
no test coverage detected