it seems that the Mesh method called nearestFacetOnRay() does not take into account the sign (or orientation) of the ray vector (second argument).
Here a exemple of what I mean :
Code: Select all
import FreeCAD
import Part,Mesh,MeshPart
myDocument = FreeCAD.newDocument("testfgg")
FreeCAD.setActiveDocument("testfgg")
myMesh = FreeCAD.ActiveDocument.addObject("Mesh::Feature","myMeshName")
cube = Part.makeBox(1,1,1)
Part.show(cube)
myMesh = MeshPart.meshFromShape(cube)
val1 = myMesh.nearestFacetOnRay((0.75, 0.25, 0.1), (0.0, +1.0, 0.0))
val2 = myMesh.nearestFacetOnRay((0.75, 0.25, 0.1), (0.0, -1.0, 0.0))
val3 = myMesh.nearestFacetOnRay((0.75, 0.75, 0.1), (0.0, +1.0, 0.0))
val4 = myMesh.nearestFacetOnRay((0.75, 0.75, 0.1), (0.0, -1.0, 0.0))
# Result
# val1 = val2 = {4: (0.75, 0.0, 0.1)}
# val3 = val4 = {6: (0.75, 1.0, 0.1)}
What is the more efficient way (from computation time point of view) to obtain this kind of result ?
Thanks by advance
Regards
Gab
FreeCAD Version used :
--------------------------------
OS: CentOS Stream 8 (GNOME/gnome)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: French/France (fr_FR)