MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / RayNearestField

Method RayNearestField

src/Mod/Mesh/App/Core/Algorithm.cpp:221–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221bool MeshAlgorithm::RayNearestField(
222 const Base::Vector3f& rclPt,
223 const Base::Vector3f& rclDir,
224 const std::vector<FacetIndex>& raulFacets,
225 Base::Vector3f& rclRes,
226 FacetIndex& rulFacet,
227 float /*fMaxAngle*/
228) const
229{
230 Base::Vector3f clProj, clRes;
231 bool bSol = false;
232 FacetIndex ulInd = 0;
233
234 for (FacetIndex index : raulFacets) {
235 if (_rclMesh.GetFacet(index).Foraminate(rclPt, rclDir, clRes /*, fMaxAngle*/)) {
236 if (!bSol) { // first solution
237 bSol = true;
238 clProj = clRes;
239 ulInd = index;
240 }
241 else { // is closer to the point
242 if ((clRes - rclPt).Length() < (clProj - rclPt).Length()) {
243 clProj = clRes;
244 ulInd = index;
245 }
246 }
247 }
248 }
249
250 if (bSol) {
251 rclRes = clProj;
252 rulFacet = ulInd;
253 }
254
255 return bSol;
256}
257
258bool MeshAlgorithm::FirstFacetToVertex(
259 const Base::Vector3f& rPt,

Callers

nothing calls this directly

Calls 3

ForaminateMethod · 0.80
GetFacetMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected