geo2d.geometry
Very basic 2D abstract geometry package. It defines these geometrical constructs:
- GeometricObject - abstract base class, not meant to be used directly
- Point
- Vector
- BoundingBox
- Line
- Ray
- Segment
- Polygon
- ...for now
Except for the Point and Vector classes which will be discussed below, all of the other classes define a __getitem__ method that can be used to retreive the points defining the GeometricObject by indices.
The Point class defines the __getitem__ method in a sperate way, i.e. it returns the Cartesian coordinates of the Point by indinces. The Vector class does the same except it returns the x & y Cartesian coordinates in this case.
Contents:
get_perpendicular_to(obj[, at_point]) | Creates a new Vector or Line perpendicular with |
GeometricObject | Abstract geometric object class. |
Point(*args) | An abstract mathematical point. |
Vector(*args, **kwargs) | An abstract Vector object. |
BoundingBox(obj) | Represents the far extremeties of another GeometricObject |
Line(arg1, arg2) | An abstract mathematical Line. |
Ray(arg1, arg2) | A Ray extension on Line. |
Segment(arg1, arg2) | An extension on Line. |
Polygon(vertices) | A general (closed) Polygon class. |
geo2d.utils
This module is used by the geometry module. It introduces some helper functions that I felt would best go in another module altogether.
Contents:
find_first_missing(seq) | Given an ascending sequence seq, the first missing number is returned |
float_to_2pi(angle) | Convert any floating point number to the inverval [0, 2pi). |
rotated(list_, by) | Rotates an iterable (but only if it supports negative indexing) by the given amount. |
cached_property(func) | Simple decorator for caching class properties. |