Skip to content

point_2d

point_2d

A two-dimensional point or vector with the coordinates u and v.

Wherever a point_2d is expected, a plain (u, v) tuple of length 2 may be passed instead: it is implicitly converted to a point_2d.

__eq__(other: object) -> bool

Check if two points are equal.

Returns:

Name Type Description
bool bool

True if equal, False otherwise.

__getitem__(index: int) -> float

Get coordinate by index (0: u, 1: v).

Returns:

Name Type Description
float float

The coordinate value.

Raises: IndexError: If index is out of range.

__init__(u: float = 0.0, v: float = 0.0)

Initialize an instance of a point_2d.

Parameters:

Name Type Description Default
u float

The u-coordinate of the point.

0.0
v float

The v-coordinate of the point.

0.0

__ne__(other: object) -> bool

Check if two points are not equal.

Returns:

Name Type Description
bool bool

True if not equal, False otherwise.

__repr__() -> str

Return the string representation of the point.

Returns:

Name Type Description
str str

The string representation.

__setitem__(index: int, value: float) -> None

Set coordinate by index (0: u, 1: v).

Raises:

Type Description
IndexError

If index is out of range.