Module util :: Class Point
[frames] | no frames]

Class Point

Represent a point with its x, y values

Instance Methods
 
__init__(self, x, y)
 
near(self, point, distEps)
Returns: true if the distance between self and util.Point is less than distEps
 
isNear(self, point, distEps)
Returns: true if the distance between self and util.Point is less than distEps
 
distance(self, point)
Returns: Euclidean distance between self and util.Point
 
magnitude(self)
Returns: Magnitude of this point, interpreted as a vector in 2-space
 
xyTuple(self)
Returns: pair of x, y values
 
__repr__(self)
 
angleTo(self, p)
Returns: angle in radians of vector from self to p
 
add(self, point)
Vector addition
 
__add__(self, point)
 
sub(self, point)
Vector subtraction
 
__sub__(self, point)
 
scale(self, s)
Vector scaling
 
__rmul__(self, s)
 
dot(self, p)
Dot product
Instance Variables
  x = 0.0
x coordinate
  y = 0.0
y coordinate
Method Details

near(self, point, distEps)

 
Parameters:
  • point - instance of util.Point
  • distEps - positive real number
Returns:
true if the distance between self and util.Point is less than distEps

isNear(self, point, distEps)

 
Parameters:
  • point - instance of util.Point
  • distEps - positive real number
Returns:
true if the distance between self and util.Point is less than distEps

distance(self, point)

 
Parameters:
  • point - instance of util.Point
Returns:
Euclidean distance between self and util.Point

magnitude(self)

 
Returns:
Magnitude of this point, interpreted as a vector in 2-space

xyTuple(self)

 
Returns:
pair of x, y values

angleTo(self, p)

 
Parameters:
  • p - instance of util.Point or util.Pose
Returns:
angle in radians of vector from self to p