Skip to content

Point

Source code in gdsr/_gdsr.pyi
class Point:
    @property
    def x(self) -> float:
        """Return the x coordinate."""
    @property
    def y(self) -> float:
        """Return the y coordinate."""
    def __init__(self, x: float, y: float) -> None:
        """Initialize the Point with x and y coordinates.

        :param float x: x coordinate
        :param float y: y coordinate
        """
    def distance_to(self, other: PointLike) -> float:
        """Return the distance to another point."""
    def cross(self, other: PointLike) -> float:
        """Return the cross product with another point."""
    def copy(self) -> Self:
        """Return a copy of the point."""
    def rotate(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
        """Rotates the point by an angle around a centre point.

        :param float angle: Counter-clockwise rotation angle in degrees.
        :param PointLike centre: Centre point of rotation, defaults to Point(0, 0).
        """
    def scale(self, factor: float, centre: PointLike = Point(0, 0)) -> Self:
        """Scales the point by a factor around a centre point.

        :param float factor: Scaling factor.
        :param PointLike centre: Centre point of scaling, defaults to Point(0, 0).
        """
    def round(self, digits: int = 0) -> Self:
        """Return the point with rounded coordinates.

        :param int digits: Number of digits to round to, defaults to None.
        """
    def angle_to(self, other: PointLike) -> float | None:
        """Return the angle to another point in degrees.

        The angle is measured counter-clockwise from the x-axis
        and is in the range of 0 to 360 degrees.

        Return None if the points are the same.

        :param PointLike other: The other point.
        """
    def is_close(
        self, other: PointLike, rel_tol: float = 1e-7, abs_tol: float = 1e-10
    ) -> bool:
        """Return True if the point is close to another point.

        :param PointLike other: The other point.
        :param float rel_tol: Relative tolerance, defaults to 1e-9.
        :param float abs_tol: Absolute tolerance, defaults to 0.0.
        """
    def epsilon_is_close(self, other: PointLike) -> bool:
        """Return True if the point is close to another point using epsilon.

        This is used in all equality checks in gdsr.

        :param PointLike other: The other point.
        """
    def reflect(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
        """Reflect the point across a line defined by an angle around a centre point.

        :param float angle: Angle of the line in degrees.
        :param PointLike centre: Centre point of reflection, defaults to Point(0, 0).
        """
    def __getitem__(self, index: Literal[0, 1]) -> float:
        """Return the x or y coordinate of the point."""
    def __bool__(self) -> bool:
        """Return True if the point is not the origin."""
    def __repr__(self) -> str:
        """Return a string representation of the point."""
    def __str__(self) -> str:
        """Return a string representation of the point."""
    def __add__(self, other: PointLike) -> Self:
        """Return the sum of the point and another point."""
    def __radd__(self, other: PointLike) -> Self:
        """Return the sum of the point and another point."""
    def __sub__(self, other: PointLike) -> Self:
        """Return the difference of the point and another point."""
    def __rsub__(self, other: PointLike) -> Self:
        """Return the difference of the point and another point."""
    def __mul__(self, value: float) -> Self:
        """Return the product of the point and a scalar."""
    def __rmul__(self, value: float) -> Self:
        """Return the product of the point and a scalar."""
    def __truediv__(self, value: float) -> Self:
        """Return the quotient of the point and a scalar."""
    def __floordiv__(self, value: float) -> Self:
        """Return the floored quotient of the point and a scalar."""
    def __neg__(self) -> Self:
        """Return the negative of the point."""
    def __round__(self, ndigits: int | None) -> Self:
        """Return the point with rounded coordinates."""
    def __eq__(self, other: object) -> bool:
        """Return True if the point is equal to another object."""
    def __ne__(self, value: object) -> bool:
        """Return True if the point is not equal to another object."""
    def __lt__(self, other: object) -> bool:
        """Return True if the point is less than another object."""
    def __le__(self, other: object) -> bool:
        """Return True if the point is less than or equal to another object."""
    def __gt__(self, other: object) -> bool:
        """Return True if the point is greater than another object."""
    def __ge__(self, other: object) -> bool:
        """Return True if the point is greater than or equal to another object."""
    def __hash__(self) -> int:
        """Return the hash of the point."""
    def __iter__(self) -> PointIterator:
        """Return an iterator over the coordinates of the point."""

x property

x: float

Return the x coordinate.

y property

y: float

Return the y coordinate.

__init__

__init__(x: float, y: float) -> None

Initialize the Point with x and y coordinates.

Parameters:

  • x (float) –

    x coordinate

  • y (float) –

    y coordinate

Source code in gdsr/_gdsr.pyi
def __init__(self, x: float, y: float) -> None:
    """Initialize the Point with x and y coordinates.

    :param float x: x coordinate
    :param float y: y coordinate
    """

distance_to

distance_to(other: PointLike) -> float

Return the distance to another point.

Source code in gdsr/_gdsr.pyi
def distance_to(self, other: PointLike) -> float:
    """Return the distance to another point."""

cross

cross(other: PointLike) -> float

Return the cross product with another point.

Source code in gdsr/_gdsr.pyi
def cross(self, other: PointLike) -> float:
    """Return the cross product with another point."""

copy

copy() -> Self

Return a copy of the point.

Source code in gdsr/_gdsr.pyi
def copy(self) -> Self:
    """Return a copy of the point."""

rotate

rotate(angle: float, centre: PointLike = Point(0, 0)) -> Self

Rotates the point by an angle around a centre point.

Parameters:

  • angle (float) –

    Counter-clockwise rotation angle in degrees.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of rotation, defaults to Point(0, 0).

Source code in gdsr/_gdsr.pyi
def rotate(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
    """Rotates the point by an angle around a centre point.

    :param float angle: Counter-clockwise rotation angle in degrees.
    :param PointLike centre: Centre point of rotation, defaults to Point(0, 0).
    """

scale

scale(factor: float, centre: PointLike = Point(0, 0)) -> Self

Scales the point by a factor around a centre point.

Parameters:

  • factor (float) –

    Scaling factor.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of scaling, defaults to Point(0, 0).

Source code in gdsr/_gdsr.pyi
def scale(self, factor: float, centre: PointLike = Point(0, 0)) -> Self:
    """Scales the point by a factor around a centre point.

    :param float factor: Scaling factor.
    :param PointLike centre: Centre point of scaling, defaults to Point(0, 0).
    """

round

round(digits: int = 0) -> Self

Return the point with rounded coordinates.

Parameters:

  • digits (int, default: 0 ) –

    Number of digits to round to, defaults to None.

Source code in gdsr/_gdsr.pyi
def round(self, digits: int = 0) -> Self:
    """Return the point with rounded coordinates.

    :param int digits: Number of digits to round to, defaults to None.
    """

angle_to

angle_to(other: PointLike) -> float | None

Return the angle to another point in degrees.

The angle is measured counter-clockwise from the x-axis and is in the range of 0 to 360 degrees.

Return None if the points are the same.

Parameters:

  • other (PointLike) –

    The other point.

Source code in gdsr/_gdsr.pyi
def angle_to(self, other: PointLike) -> float | None:
    """Return the angle to another point in degrees.

    The angle is measured counter-clockwise from the x-axis
    and is in the range of 0 to 360 degrees.

    Return None if the points are the same.

    :param PointLike other: The other point.
    """

is_close

is_close(other: PointLike, rel_tol: float = 1e-07, abs_tol: float = 1e-10) -> bool

Return True if the point is close to another point.

Parameters:

  • other (PointLike) –

    The other point.

  • rel_tol (float, default: 1e-07 ) –

    Relative tolerance, defaults to 1e-9.

  • abs_tol (float, default: 1e-10 ) –

    Absolute tolerance, defaults to 0.0.

Source code in gdsr/_gdsr.pyi
def is_close(
    self, other: PointLike, rel_tol: float = 1e-7, abs_tol: float = 1e-10
) -> bool:
    """Return True if the point is close to another point.

    :param PointLike other: The other point.
    :param float rel_tol: Relative tolerance, defaults to 1e-9.
    :param float abs_tol: Absolute tolerance, defaults to 0.0.
    """

epsilon_is_close

epsilon_is_close(other: PointLike) -> bool

Return True if the point is close to another point using epsilon.

This is used in all equality checks in gdsr.

Parameters:

  • other (PointLike) –

    The other point.

Source code in gdsr/_gdsr.pyi
def epsilon_is_close(self, other: PointLike) -> bool:
    """Return True if the point is close to another point using epsilon.

    This is used in all equality checks in gdsr.

    :param PointLike other: The other point.
    """

reflect

reflect(angle: float, centre: PointLike = Point(0, 0)) -> Self

Reflect the point across a line defined by an angle around a centre point.

Parameters:

  • angle (float) –

    Angle of the line in degrees.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of reflection, defaults to Point(0, 0).

Source code in gdsr/_gdsr.pyi
def reflect(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
    """Reflect the point across a line defined by an angle around a centre point.

    :param float angle: Angle of the line in degrees.
    :param PointLike centre: Centre point of reflection, defaults to Point(0, 0).
    """

__getitem__

__getitem__(index: Literal[0, 1]) -> float

Return the x or y coordinate of the point.

Source code in gdsr/_gdsr.pyi
def __getitem__(self, index: Literal[0, 1]) -> float:
    """Return the x or y coordinate of the point."""

__bool__

__bool__() -> bool

Return True if the point is not the origin.

Source code in gdsr/_gdsr.pyi
def __bool__(self) -> bool:
    """Return True if the point is not the origin."""

__repr__

__repr__() -> str

Return a string representation of the point.

Source code in gdsr/_gdsr.pyi
def __repr__(self) -> str:
    """Return a string representation of the point."""

__str__

__str__() -> str

Return a string representation of the point.

Source code in gdsr/_gdsr.pyi
def __str__(self) -> str:
    """Return a string representation of the point."""

__add__

__add__(other: PointLike) -> Self

Return the sum of the point and another point.

Source code in gdsr/_gdsr.pyi
def __add__(self, other: PointLike) -> Self:
    """Return the sum of the point and another point."""

__radd__

__radd__(other: PointLike) -> Self

Return the sum of the point and another point.

Source code in gdsr/_gdsr.pyi
def __radd__(self, other: PointLike) -> Self:
    """Return the sum of the point and another point."""

__sub__

__sub__(other: PointLike) -> Self

Return the difference of the point and another point.

Source code in gdsr/_gdsr.pyi
def __sub__(self, other: PointLike) -> Self:
    """Return the difference of the point and another point."""

__rsub__

__rsub__(other: PointLike) -> Self

Return the difference of the point and another point.

Source code in gdsr/_gdsr.pyi
def __rsub__(self, other: PointLike) -> Self:
    """Return the difference of the point and another point."""

__mul__

__mul__(value: float) -> Self

Return the product of the point and a scalar.

Source code in gdsr/_gdsr.pyi
def __mul__(self, value: float) -> Self:
    """Return the product of the point and a scalar."""

__rmul__

__rmul__(value: float) -> Self

Return the product of the point and a scalar.

Source code in gdsr/_gdsr.pyi
def __rmul__(self, value: float) -> Self:
    """Return the product of the point and a scalar."""

__truediv__

__truediv__(value: float) -> Self

Return the quotient of the point and a scalar.

Source code in gdsr/_gdsr.pyi
def __truediv__(self, value: float) -> Self:
    """Return the quotient of the point and a scalar."""

__floordiv__

__floordiv__(value: float) -> Self

Return the floored quotient of the point and a scalar.

Source code in gdsr/_gdsr.pyi
def __floordiv__(self, value: float) -> Self:
    """Return the floored quotient of the point and a scalar."""

__neg__

__neg__() -> Self

Return the negative of the point.

Source code in gdsr/_gdsr.pyi
def __neg__(self) -> Self:
    """Return the negative of the point."""

__round__

__round__(ndigits: int | None) -> Self

Return the point with rounded coordinates.

Source code in gdsr/_gdsr.pyi
def __round__(self, ndigits: int | None) -> Self:
    """Return the point with rounded coordinates."""

__eq__

__eq__(other: object) -> bool

Return True if the point is equal to another object.

Source code in gdsr/_gdsr.pyi
def __eq__(self, other: object) -> bool:
    """Return True if the point is equal to another object."""

__ne__

__ne__(value: object) -> bool

Return True if the point is not equal to another object.

Source code in gdsr/_gdsr.pyi
def __ne__(self, value: object) -> bool:
    """Return True if the point is not equal to another object."""

__lt__

__lt__(other: object) -> bool

Return True if the point is less than another object.

Source code in gdsr/_gdsr.pyi
def __lt__(self, other: object) -> bool:
    """Return True if the point is less than another object."""

__le__

__le__(other: object) -> bool

Return True if the point is less than or equal to another object.

Source code in gdsr/_gdsr.pyi
def __le__(self, other: object) -> bool:
    """Return True if the point is less than or equal to another object."""

__gt__

__gt__(other: object) -> bool

Return True if the point is greater than another object.

Source code in gdsr/_gdsr.pyi
def __gt__(self, other: object) -> bool:
    """Return True if the point is greater than another object."""

__ge__

__ge__(other: object) -> bool

Return True if the point is greater than or equal to another object.

Source code in gdsr/_gdsr.pyi
def __ge__(self, other: object) -> bool:
    """Return True if the point is greater than or equal to another object."""

__hash__

__hash__() -> int

Return the hash of the point.

Source code in gdsr/_gdsr.pyi
def __hash__(self) -> int:
    """Return the hash of the point."""

__iter__

__iter__() -> PointIterator

Return an iterator over the coordinates of the point.

Source code in gdsr/_gdsr.pyi
def __iter__(self) -> PointIterator:
    """Return an iterator over the coordinates of the point."""