An abstract mathematical Line.
It is defined by either two points or by a Point and a Vector.
Parameters : | arg1 : point-like arg2 : {point-like, vector} |
---|
Notes
A line can be defined in three ways, but we use here only the vectorial definition for which we need a Point and a Vector. If two points are given the Vector \(\boldsymbol{\mathtt{p_1p_2}}\) will be calculated and then we can define the Line as:
Here \(t\) is a parameter.
Attributes
p1 | [point] Get the 1st Point that defines the Line. |
p2 | [point] Get the 2nd Point that defines the Line. |
phi | [scalar] Get self.v.phi. Convenience method. |
v | [vector] Get the Vector pointing from self.p1 to`self.p2`. |
Methods
__contains__(x) | Searches for x in “itself”. |
__getitem__(idx) | Get the points that define the Line by index. |
__len__() | The Line is made of 2 points so it’s length is 2.’ |
has(point) | Inspect if point (Point-like) is part of this Line. |
intersection(obj) | Find if self is intersecting the provided object. |
is_line_like(obj) | Check if an object is in the form of Line-like for fast |
parallel_to(obj) | Find out if provided Vector or Line-like is |
perpendicular_to(obj) | Find out if provided Line is perpendicular to self. |
rotate(theta[, point, angle]) | Rotate self around pivot point. |
translate(dx, dy) | Translate self by given amounts on x and y. |
Detailed description
An abstract mathematical Line.
It is defined by either two points or by a Point and a Vector.
Parameters : | arg1 : point-like arg2 : {point-like, vector} |
---|
Notes
A line can be defined in three ways, but we use here only the vectorial definition for which we need a Point and a Vector. If two points are given the Vector \(\boldsymbol{\mathtt{p_1p_2}}\) will be calculated and then we can define the Line as:
Here \(t\) is a parameter.
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}
|
Get the points that define the Line by index.
Parameters : | idx : scalar
|
---|---|
Returns : | ret : point
|
Inspect if point (Point-like) is part of this Line.
Parameters : | point : point-like |
---|---|
Returns : | ret : {True, False}
|
See also
Find if self is intersecting the provided object.
If an intersection is found, the Point of intersection is returned, except for a few special cases. For further explanation see the notes.
Parameters : | obj : geometric object |
---|---|
Returns : | out : {geometric object, tuple} |
Raises : | TypeError :
|
Notes
Check if an object is in the form of Line-like for fast computations (not necessary to build lines).
Parameters : | obj : anything |
---|---|
Returns : | res : {True, False} |
Find out if provided Vector or Line-like is parllel to self.
Parameters : | obj : {vector, line-like} |
---|---|
Returns : | ret : {True, False}
|
Find out if provided Line is perpendicular to self.
Returns : | ret : {True, False} |
---|
Rotate self around pivot point.
Parameters : | theta : scalar
point : {point-like}, optional
angle : {‘degrees’, ‘radians’}, optional
|
---|
Translate self by given amounts on x and y.
Parameters : | dx, dy : scalar
|
---|
[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 |