point

Defines a 2d Point

Supports:

  • addition
  • subtaction
  • multiplication
  • distance calculation

P Objects

class P()

Implementation of a 2-D point

__init__

 | __init__(x, y=None)

Initialize an point

Examples:

pt1 = P(3,4)
pt2 = P((3,4))
pt3 = P([3,4])
pt4 = P(pt3)

val

 | @property
 | val()

Return the value of the point as a tuple rounded to the nearest integer point

mag

 | @property
 | mag()

Return the magnitude of the point (it's distance from zero)