https://github.com/jan-mue/geometer
A geometry library written in Python
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A geometry library written in Python
Basic Info
- Host: GitHub
- Owner: jan-mue
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://geometer.readthedocs.io
- Size: 1.3 MB
Statistics
- Stars: 109
- Watchers: 5
- Forks: 12
- Open Issues: 3
- Releases: 2
Topics
Metadata Files
README.md
geometer
Geometer is a geometry library for Python that uses projective geometry and numpy for fast geometric computation. In projective geometry every point in 2D is represented by a three-dimensional vector and every point in 3D is represented by a four-dimensional vector. This has the following advantages:
- There are points at infinity that can be treated just like normal points.
- Projective transformations are described by matrices but they can also represent translations and general affine transformations.
- Two lines have a unique point of intersection if they lie in the same plane. Parallel lines have a point of intersection at infinity.
- Points of intersection, planes or lines through given points can be calculated using simple cross products or tensor diagrams.
- Special complex points at infinity and cross ratios can be used to calculate angles and to construct perpendicular geometric structures.
- Collections of points and lines can be represented by tensors. Their connecting lines and intersections can be calculated using fast matrix multiplications.
Most of the computation in the library is done via tensor diagrams (using numpy.einsum).
The source code of the package can be found on GitHub and the documentation on Read the Docs.
Installation
You can install the package directly from PyPI:
bash
pip install geometer
Usage
```Python from geometer import * import numpy as np
Meet and Join operations
p = Point(2, 4) q = Point(3, 5) l = Line(p, q) m = Line(0, 1, 0) l.meet(m)
Point(-2, 0)
Parallel and perpendicular lines
m = l.parallel(through=Point(1, 1)) n = l.perpendicular(through=Point(1, 1)) is_perpendicular(m, n)
True
Angles and distances (euclidean)
a = angle(l, Point(1, 0)) p + 2dist(p, q)Point(np.cos(a), np.sin(a))
Point(4, 6)
Transformations
t1 = translation(0, -1) t2 = rotation(-np.pi) t1t2p
Point(-2, -5)
Collections of points and lines
coordinates = np.random.randint(100, size=(1000, 2)) points = PointCollection([Point(x, y) for x, y in coordinates]) lines = points.join(-points) zero = PointCollection(np.zeros((1000, 2)), homogenize=True) lines.meet(rotation(np.pi/2)*lines) == zero
True
Ellipses/Quadratic forms
a = Point(-1, 0) b = Point(0, 3) c = Point(1, 2) d = Point(2, 1) e = Point(0, -1)
conic = Conic.frompoints(a, b, c, d, e) ellipse = Conic.fromfoci(c, d, bound=b)
Geometric shapes
o = Point(0, 0) x, y = Point(1, 0), Point(0, 1) r = Rectangle(o, x, x+y, y) r.area
1
3-dimensional objects
p1 = Point(1, 1, 0) p2 = Point(2, 1, 0) p3 = Point(3, 4, 0) l = p1.join(p2) A = join(l, p3) A.project(Point(3, 4, 5))
Point(3, 4, 0)
l = Line(Point(1, 2, 3), Point(3, 4, 5)) A.meet(l)
Point(-2, -1, 0)
p3 = Point(1, 2, 0) p4 = Point(1, 1, 1) c = Cuboid(p1, p2, p3, p4) c.area
6
Cross ratios
t = rotation(np.pi/16) crossratio(q, tq, t2 * q, t*3 * q, p)
1.4408954235712448
Higher dimensions
p1 = Point(1, 1, 4, 0) p2 = Point(2, 1, 5, 0) p3 = Point(3, 4, 6, 0) p4 = Point(0, 2, 7, 0) E = Plane(p1, p2, p3, p4) l = Line(Point(0, 0, 0, 0), Point(1, 2, 3, 4)) E.meet(l)
Point(0, 0, 0, 0)
```
References
Many of the algorithms and formulas implemented in the package are taken from the following books and papers:
- Jürgen Richter-Gebert, Perspectives on Projective Geometry
- Jürgen Richter-Gebert and Thorsten Orendt, Geometriekalküle
- Olivier Faugeras, Three-Dimensional Computer Vision
- Jim Blinn, Lines in Space: The 4D Cross Product
- Jim Blinn, Lines in Space: The Line Formulation
- Jim Blinn, Lines in Space: The Two Matrices
- Jim Blinn, Lines in Space: Back to the Diagrams
- Jim Blinn, Lines in Space: A Tale of Two Lines
- Jim Blinn, Lines in Space: Our Friend the Hyperbolic Paraboloid
- Jim Blinn, Lines in Space: The Algebra of Tinkertoys
- Jim Blinn, Lines in Space: Line(s) through Four Lines
Owner
- Name: Jan Müller
- Login: jan-mue
- Kind: user
- Location: Heidelberg, Germany
- Repositories: 4
- Profile: https://github.com/jan-mue
GitHub Events
Total
- Create event: 75
- Release event: 3
- Issues event: 3
- Watch event: 3
- Delete event: 68
- Issue comment event: 55
- Push event: 255
- Pull request review event: 72
- Pull request event: 136
Last Year
- Create event: 75
- Release event: 3
- Issues event: 3
- Watch event: 3
- Delete event: 68
- Issue comment event: 55
- Push event: 255
- Pull request review event: 72
- Pull request event: 136
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jan Müller | j****v@t****e | 405 |
| dependabot[bot] | 4****] | 35 |
| renovate[bot] | 2****] | 6 |
| Paul Jurczak | p****k@h****m | 1 |
| FredInChina | t****d@g****m | 1 |
| Jose Sabater | n****o@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 18
- Total pull requests: 236
- Average time to close issues: 4 months
- Average time to close pull requests: 10 days
- Total issue authors: 13
- Total pull request authors: 6
- Average comments per issue: 1.94
- Average comments per pull request: 0.61
- Merged pull requests: 164
- Bot issues: 1
- Bot pull requests: 175
Past Year
- Issues: 2
- Pull requests: 143
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Issue authors: 2
- Pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.38
- Merged pull requests: 113
- Bot issues: 1
- Bot pull requests: 98
Top Authors
Issue Authors
- pauljurczak (3)
- manuel-delverme (2)
- coproc (2)
- mcow (2)
- jan-mue (1)
- GroveDG (1)
- gnevan (1)
- aaichert (1)
- xrmx (1)
- nro-bot (1)
- bhgomes (1)
- renovate[bot] (1)
- penbeuz (1)
Pull Request Authors
- renovate[bot] (96)
- dependabot[bot] (75)
- jan-mue (59)
- github-actions[bot] (4)
- pauljurczak (1)
- nudomarinero (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 623 last-month
- Total dependent packages: 0
- Total dependent repositories: 3
- Total versions: 15
- Total maintainers: 1
pypi.org: geometer
Python geometry package based on projective geometry and numpy.
- Documentation: https://github.com/jan-mue/geometer#readme
- License: mit
-
Latest release: 0.4.1
published 9 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pre-commit/action v3.0.0 composite
- actions/checkout v4 composite
- actions/setup-python v4 composite
- codecov/codecov-action v3 composite
- numpy >=1.22