An abstract mathematical point.
It can be built by passing no parameters to the constructor, this way having the origin coordinates (0, 0), or by passing a Point, a tuple or a list of length two or even two scalar values.
| Parameters : | *args : {two scalars, point-like}, optional
|
|---|---|
| Raises : | TypeError :
|
Attributes
| x | [scalar] Get the x coordinate. |
| y | [scalar] Get the y coordinate. |
Methods
| __contains__(x) | Searches for x in “itself”. |
| __eq__(point) | Equality (==) operator for two points. |
| __getitem__(idx) | Return values as a list for easier acces. |
| __len__() | The length of a Point object is 2. |
| __lt__(point) | Less than (<) operator for two points. |
| belongs_to(obj) | Check if the Point is part of a GeometricObject. |
| distance_to(obj) | Calculate the distance to another GeometricObject. |
| intersection(obj) | Return points of intersection if any. |
| is_left(obj) | Determine if self is left|on|right of an infinite Line or |
| is_point_like(obj) | See if obj is of Point-like. |
| move(x, y) | The difference between this and translate is that this |
| rotate(theta[, point, angle]) | Rotate self by angle theta. |
| translate(dx, dy) | See GeometricObject.translate. |
Detailed description
An abstract mathematical point.
It can be built by passing no parameters to the constructor, this way having the origin coordinates (0, 0), or by passing a Point, a tuple or a list of length two or even two scalar values.
| Parameters : | *args : {two scalars, point-like}, optional
|
|---|---|
| Raises : | TypeError :
|
Searches for x in “itself”. If we’re talking about a Point or a Vector then this searches within their components (x, y). For everything else it searches within the list of points (vertices).
| Parameters : | x : {point, scalar}
|
|---|---|
| Returns : | out : {True, False}
|
Equality (==) operator for two points.
| Parameters : | point : {point-like}
|
|---|---|
| Returns : | res : {True, False} |
| Raises : | TypeError :
|
Less than (<) operator for two points.
| Parameters : | point : {point-like}
|
|---|---|
| Returns : | res : {True, False}
|
Check if the Point is part of a GeometricObject.
This method is actually using the method defined on the passed obj.
| Returns : | out : {True, False} |
|---|
Calculate the distance to another GeometricObject.
For now it can only calculate the distance to Line, Ray, Segment and Point.
| Parameters : | obj : geometric object
|
|---|---|
| Returns : | out : (float, point) |
Return points of intersection if any.
This method just calls the intersection method on the other objects that have it implemented.
| Parameters : | obj : geometric object
|
|---|---|
| Returns : | ret : {point, None}
|
Determine if self is left|on|right of an infinite Line or Point.
| Parameters : | obj : {point-like, line-like}
|
|---|---|
| Returns : | out : {scalar, None} |
| Raises : | ValueError : |
See if obj is of Point-like.
Point-like means Point or a list or tuple of length 2.
| Parameters : | obj : geometric object |
|---|---|
| Returns : | out : {True, False}
|
The difference between this and translate is that this function moves self to the given coordinates instead.
Rotate self by angle theta.
| Parameters : | theta : scalar
point : {None, point-like}, optional
angle : {‘radians’, ‘degrees’}, optional
|
|---|
| [Arnon1983] | Arnon et al., A Linear Time Algorithm for the Minimum Area Rectangle Enclosing a Convex Polygon” (1983), Computer Science Technical Reports. Paper 382 |
| [WPolygon] | http://en.wikipedia.org/wiki/Polygon |