Skip to content

point_3d

cadwork.point_3d

Source code in cadwork/__init__.py
class point_3d():

    def __init__(self, x: float, y: float, z: float) -> None:
        self.x = x
        self.y = y
        self.z = z

    def cross(self, another_point_3d):
        """cross product takes two vectors and produces a third vector that is orthogonal to both

        Args:
            point_3d (point_3d): a second vector

        Returns:
            point_3d: a third vector orthogonal to both
        """

    def distance(self, another_point_3d) -> float:
        """distance between to points

        Args:
            point_3d (point_3d): a second point

        Returns:
            float: distance
        """

    def dot(self, another_point_3d) -> float:
        """When calculating the dot product of two unit vectors, the result is always between -1 and +1.
        The scalar product of two vectors of given length is thus zero if they are perpendicular to each other, and maximum if they have the same direction.
        A negative dot product between two vectors means that the two vectors go in the opposite general direction.

        Args:
            point_3d (point_3d): a second vector

        Returns:
            float: value betweend 0.0 and 1.0
        """

    def magnitude(self) -> float:
        """magnitude of a vector is the length of the vector.

        Returns:
            float: vector length
        """

    def normalized(self):
        """A normalized vector is a vector with a length equal to one unit.

        Returns:
            point_3d: normalized vector
        """

    def invert(self):
        """Invert point_3d

        Returns:
            point_3d: inverted point_3d
        """

cross(self, another_point_3d)

cross product takes two vectors and produces a third vector that is orthogonal to both

Parameters:

Name Type Description Default
point_3d point_3d

a second vector

required

Returns:

Type Description
point_3d

a third vector orthogonal to both

Source code in cadwork/__init__.py
def cross(self, another_point_3d):
    """cross product takes two vectors and produces a third vector that is orthogonal to both

    Args:
        point_3d (point_3d): a second vector

    Returns:
        point_3d: a third vector orthogonal to both
    """

distance(self, another_point_3d)

distance between to points

Parameters:

Name Type Description Default
point_3d point_3d

a second point

required

Returns:

Type Description
float

distance

Source code in cadwork/__init__.py
def distance(self, another_point_3d) -> float:
    """distance between to points

    Args:
        point_3d (point_3d): a second point

    Returns:
        float: distance
    """

dot(self, another_point_3d)

When calculating the dot product of two unit vectors, the result is always between -1 and +1. The scalar product of two vectors of given length is thus zero if they are perpendicular to each other, and maximum if they have the same direction. A negative dot product between two vectors means that the two vectors go in the opposite general direction.

Parameters:

Name Type Description Default
point_3d point_3d

a second vector

required

Returns:

Type Description
float

value betweend 0.0 and 1.0

Source code in cadwork/__init__.py
def dot(self, another_point_3d) -> float:
    """When calculating the dot product of two unit vectors, the result is always between -1 and +1.
    The scalar product of two vectors of given length is thus zero if they are perpendicular to each other, and maximum if they have the same direction.
    A negative dot product between two vectors means that the two vectors go in the opposite general direction.

    Args:
        point_3d (point_3d): a second vector

    Returns:
        float: value betweend 0.0 and 1.0
    """

invert(self)

Invert point_3d

Returns:

Type Description
point_3d

inverted point_3d

Source code in cadwork/__init__.py
def invert(self):
    """Invert point_3d

    Returns:
        point_3d: inverted point_3d
    """

magnitude(self)

magnitude of a vector is the length of the vector.

Returns:

Type Description
float

vector length

Source code in cadwork/__init__.py
def magnitude(self) -> float:
    """magnitude of a vector is the length of the vector.

    Returns:
        float: vector length
    """

normalized(self)

A normalized vector is a vector with a length equal to one unit.

Returns:

Type Description
point_3d

normalized vector

Source code in cadwork/__init__.py
def normalized(self):
    """A normalized vector is a vector with a length equal to one unit.

    Returns:
        point_3d: normalized vector
    """