[ Fixed ] [ Bug? ] Mesh: nearestFacetOnRay and foraminate ignore mesh Placement

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

[ Fixed ] [ Bug? ] Mesh: nearestFacetOnRay and foraminate ignore mesh Placement

Post by Roy_043 »

While working on the Draft code I noticed that nearestFacetOnRay and foraminate ignore the Placement of the mesh. Is this a bug?

Code: Select all

import FreeCAD as App

doc = App.ActiveDocument
cube = doc.addObject("Mesh::Cube", "Cube")
cube.Length = 10
cube.Width = 10
cube.Height = 10
cube.Placement.Base = App.Vector(50, 50, 0)

doc.recompute()

mesh = cube.Mesh

print(mesh.BoundBox) # BoundBox (45, 45, -5, 55, 55, 5)

result_1 = mesh.nearestFacetOnRay((1, 2, 10), (0, 0, 1))
print(result_1) # {10: (1.0, 2.0, 5.0)}

result_2 = mesh.foraminate((1, 2, 10), (0, 0, 1))
print(result_2) # {8: (1.0, 2.0, -5.0), 10: (1.0, 2.0, 5.0)}
Last edited by Roy_043 on Fri Aug 05, 2022 8:31 am, edited 1 time in total.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [ Bug? ] Mesh: nearestFacetOnRay and foraminate ignore mesh Placement

Post by wmayer »

Is this a bug?
Well, it's rather a question of what makes more sense and I think the Mesh API should indeed hide the complexity from the user whether a placement is set or not. So, in other words: nearestFacetOnRay, foraminate and other methods should take care of the placement.

This way the API would be consistent to the Shape API. Feel free to open a ticket (bug or feature).
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: [ Bug? ] Mesh: nearestFacetOnRay and foraminate ignore mesh Placement

Post by Roy_043 »

Great! Thank you.
Post Reply