Skip to content

point_3d

cadwork.point_3d

point_3d

Source code in cadwork/point_3d.py
class point_3d:
    def __init__(self, x: float, y: float, z: float) -> None:
        self.x = x
        self.y = y
        self.z = z

    def __add__(self, p: 'point_3d'):
        """adds two points

        Args:
            p ( point_3d): p

        Returns:
            point_3d: a third point
        """

    def __sub__(self, p: 'point_3d'):
        """subtracts two points

        Args:
            p ( point_3d): p

        Returns:
            point_3d: a third point
        """

    def __mul__(self, p: 'point_3d'):
        """multiplies two points

        Args:
            p ( point_3d): p

        Returns:
            point_3d: a third point
        """

    def __div__(self, p: 'point_3d'):
        """divides two points

        Args:
            p ( point_3d): p

        Returns:
            point_3d: a third point
        """

    def __eq__(self, p: 'point_3d'):
        """checks if two points are equal

        Args:
            p ( point_3d): p

        Returns:
            bool: condition
        """

    def __ne__(self, p: 'point_3d'):
        """checks if two points are not equal

        Args:
            p ( point_3d): p
        """

    def __getitem__(self, index: int):
        """gets the value of a point at a given index

        Args:
            index (int): index

        Returns:
            float: value
        """

    def __setitem__(self, index: int, value: float):
        """sets the value of a point at a given index

        Args:
            index (int): index
            value (float): value
        """

    def dot(self, p: 'point_3d') -> float:
        """dot
        Args:
            p ( point_3d): p

        Returns:
            float
        """

    def cross(self, p: 'point_3d') -> 'point_3d':
        """cross
        Args:
            p ( point_3d): p

        Returns:
            point_3d
        """

    def magnitude(self) -> float:
        """magnitude
        Args:

        Returns:
            float
        """

    def normalized(self) -> 'point_3d':
        """normalized
        Args:

        Returns:
            point_3d
        """

    def distance(self, p: 'point_3d') -> float:
        """distance
        Args:
            p ( point_3d): p

        Returns:
            float
        """

    def invert(self) -> 'point_3d':
        """invert
        Args:

        Returns:
            point_3d
        """

__add__(self, p) special

adds two points

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
point_3d

a third point

Source code in cadwork/point_3d.py
def __add__(self, p: 'point_3d'):
    """adds two points

    Args:
        p ( point_3d): p

    Returns:
        point_3d: a third point
    """

__div__(self, p) special

divides two points

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
point_3d

a third point

Source code in cadwork/point_3d.py
def __div__(self, p: 'point_3d'):
    """divides two points

    Args:
        p ( point_3d): p

    Returns:
        point_3d: a third point
    """

__eq__(self, p) special

checks if two points are equal

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
bool

condition

Source code in cadwork/point_3d.py
def __eq__(self, p: 'point_3d'):
    """checks if two points are equal

    Args:
        p ( point_3d): p

    Returns:
        bool: condition
    """

__getitem__(self, index) special

gets the value of a point at a given index

Parameters:

Name Type Description Default
index int

index

required

Returns:

Type Description
float

value

Source code in cadwork/point_3d.py
def __getitem__(self, index: int):
    """gets the value of a point at a given index

    Args:
        index (int): index

    Returns:
        float: value
    """

__mul__(self, p) special

multiplies two points

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
point_3d

a third point

Source code in cadwork/point_3d.py
def __mul__(self, p: 'point_3d'):
    """multiplies two points

    Args:
        p ( point_3d): p

    Returns:
        point_3d: a third point
    """

__ne__(self, p) special

checks if two points are not equal

Parameters:

Name Type Description Default
p point_3d

p

required
Source code in cadwork/point_3d.py
def __ne__(self, p: 'point_3d'):
    """checks if two points are not equal

    Args:
        p ( point_3d): p
    """

__setitem__(self, index, value) special

sets the value of a point at a given index

Parameters:

Name Type Description Default
index int

index

required
value float

value

required
Source code in cadwork/point_3d.py
def __setitem__(self, index: int, value: float):
    """sets the value of a point at a given index

    Args:
        index (int): index
        value (float): value
    """

__sub__(self, p) special

subtracts two points

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
point_3d

a third point

Source code in cadwork/point_3d.py
def __sub__(self, p: 'point_3d'):
    """subtracts two points

    Args:
        p ( point_3d): p

    Returns:
        point_3d: a third point
    """

cross(self, p)

cross

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
point_3d

point_3d

Source code in cadwork/point_3d.py
def cross(self, p: 'point_3d') -> 'point_3d':
    """cross
    Args:
        p ( point_3d): p

    Returns:
        point_3d
    """

distance(self, p)

distance

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
float

float

Source code in cadwork/point_3d.py
def distance(self, p: 'point_3d') -> float:
    """distance
    Args:
        p ( point_3d): p

    Returns:
        float
    """

dot(self, p)

dot

Parameters:

Name Type Description Default
p point_3d

p

required

Returns:

Type Description
float

float

Source code in cadwork/point_3d.py
def dot(self, p: 'point_3d') -> float:
    """dot
    Args:
        p ( point_3d): p

    Returns:
        float
    """

invert(self)

invert

Returns:

Type Description
point_3d

point_3d

Source code in cadwork/point_3d.py
def invert(self) -> 'point_3d':
    """invert
    Args:

    Returns:
        point_3d
    """

magnitude(self)

magnitude

Returns:

Type Description
float

float

Source code in cadwork/point_3d.py
def magnitude(self) -> float:
    """magnitude
    Args:

    Returns:
        float
    """

normalized(self)

normalized

Returns:

Type Description
point_3d

point_3d

Source code in cadwork/point_3d.py
def normalized(self) -> 'point_3d':
    """normalized
    Args:

    Returns:
        point_3d
    """