Positions -> Direction#

class miniworldmaker.positions.direction.Direction(direction)[source]#

Public Data Attributes:

Inherited from float

real

the real part of a complex number

imag

the imaginary part of a complex number

Public Methods:

__init__(direction)

create(direction)

Create Board-Direction from. int, str or two points. :type direction: Union[int, str, Tuple, Vector, Direction] :param direction: int: Integer value direction, str: Str Direction ("e.g." "right"), or Tuple[Position, Position] with two points. :return:.

from_token_towards_direction(token, direction)

from_token_to_position(t1[, pos])

from_tokens(t1, t2)

from_two_points(pos1, pos2)

rtype:

Direction

Inherited from float

__repr__()

Return repr(self).

__hash__()

Return hash(self).

__getattribute__(name, /)

Return getattr(self, name).

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__eq__(value, /)

Return self==value.

__ne__(value, /)

Return self!=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.

__add__(value, /)

Return self+value.

__radd__(value, /)

Return value+self.

__sub__(value, /)

Return self-value.

__rsub__(value, /)

Return value-self.

__mul__(value, /)

Return self*value.

__rmul__(value, /)

Return value*self.

__mod__(value, /)

Return self%value.

__rmod__(value, /)

Return value%self.

__divmod__(value, /)

Return divmod(self, value).

__rdivmod__(value, /)

Return divmod(value, self).

__pow__(value[, mod])

Return pow(self, value, mod).

__rpow__(value[, mod])

Return pow(value, self, mod).

__neg__()

-self

__pos__()

+self

__abs__()

abs(self)

__bool__()

True if self else False

__int__()

int(self)

__float__()

float(self)

__floordiv__(value, /)

Return self//value.

__rfloordiv__(value, /)

Return value//self.

__truediv__(value, /)

Return self/value.

__rtruediv__(value, /)

Return value/self.

conjugate()

Return self, the complex conjugate of any float.

__trunc__()

Return the Integral closest to x between 0 and x.

__floor__()

Return the floor as an Integral.

__ceil__()

Return the ceiling as an Integral.

__round__([ndigits])

Return the Integral closest to x, rounding half toward even.

as_integer_ratio()

Return integer ratio.

fromhex()

Create a floating-point number from a hexadecimal string.

hex()

Return a hexadecimal representation of a floating-point number.

is_integer()

Return True if the float is an integer.

__getnewargs__()

__getformat__()

You probably don't want to use this function.

__format__(format_spec, /)

Formats the float according to format_spec.

Private Methods:

_value_to_direction(value)

Transforms a string value ("top", "left", "right", "bottom) into a position

_value_from_token_to_direction(token, value)

rtype:

int


classmethod create(direction)[source]#

Create Board-Direction from. int, str or two points. :type direction: Union[int, str, Tuple, Vector, Direction] :param direction: int: Integer value direction, str: Str Direction (“e.g.” “right”), or Tuple[Position, Position]

with two points.

Returns:

classmethod from_token_to_position(t1, pos=typing.Union[tuple, ForwardRef('board_position.Position')])[source]#
classmethod from_token_towards_direction(token, direction)[source]#
classmethod from_tokens(t1, t2)[source]#
classmethod from_two_points(pos1, pos2)[source]#
Return type:

Direction