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

Method projectToPlane

cadquery/occ_impl/geom.py:210–221  ·  view source on GitHub ↗

Vector is projected onto the plane provided as input. :param args: Plane object Returns the projected vector.

(self, plane: "Plane")

Source from the content-addressed store, hash-verified

208 raise NotImplementedError("Have not needed this yet, but OCCT supports it!")
209
210 def projectToPlane(self, plane: "Plane") -> "Vector":
211 """
212 Vector is projected onto the plane provided as input.
213
214 :param args: Plane object
215
216 Returns the projected vector.
217 """
218 base = plane.origin
219 normal = plane.zDir
220
221 return self - normal * (((self - base).dot(normal)) / normal.Length ** 2)
222
223 def __neg__(self) -> "Vector":
224 return self * -1

Callers 2

workplaneMethod · 0.95
testVectorProjectMethod · 0.80

Calls 1

dotMethod · 0.80

Tested by 1

testVectorProjectMethod · 0.64