brown.utils.point

classes

A two dimensional point.

The x-axis grows left-to right, and the y-axis grows top-to-bottom.

Assert the near-equality of two points.

  • For testing purposes only.*
Both self.x and self.y must be Unittypes.

__init__ (x, y) permalink view source

arguments:

x (float or Unit): The x axis position

y (float or Unit): The y axis position

properties

x: Unit, int, or float The x coordinate of the point. permalink view source

y: Unit, int, or float The y coordinate of the point. permalink view source

class methods

from_existing (point) permalink view source

Clone a Point

arguments:

point (Point): The point to clone

returns:

inherited from Point

from_parent_point (parent_point) permalink view source

Create a Point from an ParentPoint, discarding its parent.

arguments:

parent_point (ParentPoint):

returns:

inherited from Point

methods

to_unit (unit) permalink view source

Translate coordinates to be of a certain unit type.

arguments:

unit (type): A Unit class.

returns:

Point: the modified self point.

__eq__ (other) permalink view source

Two Points are equal if their attributes are all equal.

returns:

Bool

__add__ (other) permalink view source

Points are added by adding their x and y values in a new Point

returns:

__sub__ (other) permalink view source

Points are subtracted by adding their x and y values in a new Point

returns:

__mul__ (other) permalink view source

Points may be multiplied with scalars.

arguments:

other (Unit, int, float): A scalar value

returns: