Skip to content

Commit

Permalink
Draft: WorkingPlane, Pythonic style, improved the docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
vocx-fc authored and yorikvanhavre committed Aug 9, 2019
1 parent 9b3aba6 commit 2d29499
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions src/Mod/Draft/WorkingPlane.py
Expand Up @@ -202,7 +202,24 @@ def offsetToPoint(self, p, direction=None):
return direction.dot(self.position.sub(p))

def projectPoint(self, p, direction=None):
'''project point onto plane, default direction is orthogonal'''
"""Project a point onto the plane, by default orthogonally.
Parameters
----------
p : Base::Vector3
The point to project.
direction : Base::Vector3, optional
The unit vector that indicates the direction of projection.
It defaults to `None`, which then uses the `plane.axis` (normal)
value, meaning that the point is projected perpendicularly
to the plane.
Returns
-------
Base::Vector3
The projected vector, scaled to the appropriate distance.
"""
if not direction:
direction = self.axis
lp = self.getLocalCoords(p)
Expand All @@ -217,7 +234,26 @@ def projectPoint(self, p, direction=None):
return gp.add(DraftVecUtils.scaleTo(gd, hyp))

def projectPointOld(self, p, direction=None):
'''project point onto plane, default direction is orthogonal. Obsolete'''
"""Project a point onto the plane. OBSOLETE.
Parameters
----------
p : Base::Vector3
The point to project.
direction : Base::Vector3, optional
The unit vector that indicates the direction of projection.
It defaults to `None`, which then uses the `plane.axis` (normal)
value, meaning that the point is projected perpendicularly
to the plane.
Returns
-------
Base::Vector3
The projected point,
or the original point if the angle between the `direction`
and the `plane.axis` is 90 degrees.
"""
if not direction:
direction = self.axis
t = Vector(direction)
Expand Down

0 comments on commit 2d29499

Please sign in to comment.