geo2d.geometry.GeometricObject

class geo2d.geometry.GeometricObject[source]

Abstract geometric object class.

It’s not meant to be used directly. This only implements methods that are called on other objects.

Methods

__contains__(x) Searches for x in “itself”.
intersection(obj) Return points of intersection if any.
rotate(theta[, point, angle]) Rotate self around pivot point.
translate(dx, dy) Translate self by given amounts on x and y.

Detailed description

class geo2d.geometry.GeometricObject[source]

Abstract geometric object class.

It’s not meant to be used directly. This only implements methods that are called on other objects.

__contains__(x)[source]

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}

The object to search for.

Returns :

out : {True, False}

True if we find x in self, else False.

intersection(obj)[source]

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

obj is any object that has intersection implemented.

Returns :

ret : {point, None}

The point of intersection if any, if not, just None.

rotate(theta, point=None, angle='degrees')[source]

Rotate self around pivot point.

Parameters :

theta : scalar

The angle to be rotated by.

point : {point-like}, optional

If given this will be used as the rotation pivot.

angle : {‘degrees’, ‘radians’}, optional

This tells the function how theta is passed: as degrees or as radians. Default is degrees.

translate(dx, dy)[source]

Translate self by given amounts on x and y.

Parameters :

dx, dy : scalar

Amount to translate (relative movement).

[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

Previous topic

geo2d.geometry.get_perpendicular_to

Next topic

geo2d.geometry.Point

This Page