MCPcopy
hub / github.com/CadQuery/cadquery / normals

Method normals

cadquery/occ_impl/shapes.py:3440–3464  ·  view source on GitHub ↗

Computes the normal vectors at the desired locations in the u,v parameter space. :returns: a tuple of list of vectors representing the normal directions and the positions :param us: the u parametric locations to compute the normal at. :param vs: the v parametric loc

(
        self, us: Iterable[Real], vs: Iterable[Real]
    )

Source from the content-addressed store, hash-verified

3438 return Vector(vn).normalized(), Vector(p)
3439
3440 def normals(
3441 self, us: Iterable[Real], vs: Iterable[Real]
3442 ) -> tuple[list[Vector], list[Vector]]:
3443 """
3444 Computes the normal vectors at the desired locations in the u,v parameter space.
3445
3446 :returns: a tuple of list of vectors representing the normal directions and the positions
3447 :param us: the u parametric locations to compute the normal at.
3448 :param vs: the v parametric locations to compute the normal at.
3449 """
3450
3451 rv_n = []
3452 rv_p = []
3453
3454 p = gp_Pnt()
3455 vn = gp_Vec()
3456 BGP = BRepGProp_Face(self.wrapped)
3457
3458 for u, v in zip(us, vs):
3459 BGP.Normal(u, v, p, vn)
3460
3461 rv_n.append(Vector(vn).normalized())
3462 rv_p.append(Vector(p))
3463
3464 return rv_n, rv_p
3465
3466 def tangentAt(self, u: Real, v: Real) -> tuple[Vector, Vector, Vector]:
3467 """

Callers 1

test_normalsFunction · 0.80

Calls 3

VectorClass · 0.85
appendMethod · 0.80
normalizedMethod · 0.80

Tested by 1

test_normalsFunction · 0.64