brown.utils.parent_point

classes

permalink view source

ParentPoint (Point)

A Point with an optional parent.

This is identical to a Point except that it has an additional parent attribute. Its coordinates are then considered to be relative to the parent.

__init__ (x, y, parent=None) permalink view source

overriden from Point

arguments:

x (float or Unit):

y (float or Unit):

parent (GraphicObject or None): The object this point is anchored to.

properties

parent: GraphicObject or None The parent of this point permalink view source

inherited properties

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

inherited from Point

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

inherited from Point

class methods

from_existing (parent_point) permalink view source

Clone an ParentPoint.

overriden from Point

arguments:

parent_point (ParentPoint): The anchored point to clone

returns:

inherited from ParentPoint

from_point (point, parent) permalink view source

Create an ParentPoint from an existing Point and a parent.

arguments:

point (Point):

parent (GraphicObject):

inherited from ParentPoint

inherited class methods

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

__eq__ (other) permalink view source

Two ParentPoints are equal if their attributes are all equal.

overriden from Point

Return: Bool

__add__ (other) permalink view source

ParentPoints may be added with each other if they share a parent

overriden from Point

returns:

__sub__ (other) permalink view source

ParentPoints may be subtracted with each other if they share a parent

overriden from Point

returns:

__mul__ (other) permalink view source

ParentPoints may be multiplied with scalars.

overriden from Point

returns:

inherited 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.

inherited from Point