Given any face I want to find the normal vector at a given point on the surface, using Cadquery or OCCT.
I am looking for a generic solution, not just the spline where the normal can be calculated.
Cadquery's documentation does not address this topic : https://cadquery.readthedocs.io/en/latest/intro.html
import cadquery as cq
s = cq.Workplane("XY")
sPnts = [
(1.0, 0.75),
(0.5, 0.25),
(0, 0.5),
]
r = s.lineTo(1.5, 0).lineTo(1.5, 0.25).spline(sPnts, includeCurrent=True).close()
result = r.extrude(0.5)
from OCP.gp import gp_Pnt
from OCP.BRepBuilderAPI import BRepBuilderAPI_MakeVertex
from OCP.BRepExtrema import BRepExtrema_DistShapeShape
point_origin = (0.5, 0.25, 0.25)
near_sphere = cq.Workplane(origin=point_origin).sphere(0.005)
assy = (cq.Assembly()
.add(result, name="main_object")
.add(near_sphere, name="point_origin")
)