1Metadata-Version: 2.1 2Name: geometer 3Version: 0.2.3 4Summary: Python geometry package based on projective geometry and numpy. 5Home-page: https://github.com/jan-mue/geometer 6Author: Jan Müller 7Author-email: 8License: MIT 9Description: 10 # geometer 11 12 [![image](https://img.shields.io/pypi/v/geometer.svg)](https://pypi.org/project/geometer/) 13 [![image](https://img.shields.io/pypi/l/geometer.svg)](https://pypi.org/project/geometer/) 14 [![image](https://img.shields.io/pypi/pyversions/geometer.svg)](https://pypi.org/project/geometer/) 15 [![Build Status](https://travis-ci.org/jan-mue/geometer.svg?branch=master)](https://travis-ci.org/jan-mue/geometer) 16 [![codecov](https://codecov.io/github/jan-mue/geometer/coverage.svg?branch=master)](https://codecov.io/github/jan-mue/geometer) 17 [![Downloads](https://pepy.tech/badge/geometer)](https://pepy.tech/project/geometer) 18 19 Geometer is a geometry library for Python 3 that uses projective geometry and numpy for fast geometric computation. 20 In projective geometry every point in 2D is represented by a three-dimensional vector and every point in 3D 21 is represented by a four-dimensional vector. This has the following advantages: 22 23 - There are points at infinity that can be treated just like normal points. 24 - Projective transformations are described by matrices but they can also 25 represent affine transformations i.e. also translations. 26 - Every two lines have a unique point of intersection if they lie in the same 27 plane. Parallel lines have a point of intersection at infinity. 28 - Points of intersection, planes or lines through given points can be 29 calculated using simple cross products or tensor diagrams. 30 - Special complex points at infinity and cross ratios can be used to calculate 31 angles and to construct perpendicular geometric structures. 32 33 Most of the computation in the library is done via tensor diagrams (using numpy.einsum). 34 35 Geometer was originally built as a learning exercise and is based on two graduate courses taught at the 36 Technical University Munich. After investing a lot of time in the project, it is now reasonably well tested 37 and the API should be stable. 38 39 The source code of the package can be found on [GitHub](https://github.com/jan-mue/geometer) 40 and the documentation on [Read the Docs](https://geometer.readthedocs.io). 41 42 ## Installation 43 44 You can install the package directly from PyPI: 45 ```bash 46 pip install geometer 47 ``` 48 49 ## Usage 50 51 ```Python 52 from geometer import * 53 import numpy as np 54 55 # Meet and Join operations 56 p = Point(2, 4) 57 q = Point(3, 5) 58 l = Line(p, q) 59 m = Line(0, 1, 0) 60 l.meet(m) 61 # Point(-2, 0) 62 63 # Parallel and perpendicular lines 64 m = l.parallel(through=Point(1, 1)) 65 n = l.perpendicular(through=Point(1, 1)) 66 is_perpendicular(m, n) 67 # True 68 69 # Angles and distances (euclidean) 70 a = angle(l, Point(1, 0)) 71 p + 2*dist(p, q)*Point(np.cos(a), np.sin(a)) 72 # Point(4, 6) 73 74 # Transformations 75 t1 = translation(0, -1) 76 t2 = rotation(-np.pi) 77 t1*t2*p 78 # Point(-2, -5) 79 80 # Ellipses/Quadratic forms 81 a = Point(-1, 0) 82 b = Point(0, 3) 83 c = Point(1, 2) 84 d = Point(2, 1) 85 e = Point(0, -1) 86 87 conic = Conic.from_points(a, b, c, d, e) 88 ellipse = Conic.from_foci(c, d, bound=b) 89 90 # Geometric shapes 91 o = Point(0, 0) 92 x, y = Point(1, 0), Point(0, 1) 93 r = Rectangle(o, x, x+y, y) 94 r.area 95 # 1 96 97 # 3-dimensional objects 98 p1 = Point(1, 1, 0) 99 p2 = Point(2, 1, 0) 100 p3 = Point(3, 4, 0) 101 l = p1.join(p2) 102 A = join(l, p3) 103 A.project(Point(3, 4, 5)) 104 # Point(3, 4, 0) 105 106 l = Line(Point(1, 2, 3), Point(3, 4, 5)) 107 A.meet(l) 108 # Point(-2, -1, 0) 109 110 p3 = Point(1, 2, 0) 111 p4 = Point(1, 1, 1) 112 c = Cuboid(p1, p2, p3, p4) 113 c.area 114 # 6 115 116 # Cross ratios 117 t = rotation(np.pi/16) 118 crossratio(q, t*q, t**2 * q, t**3 * q, p) 119 # 1.4408954235712448 120 121 # Higher dimensions 122 p1 = Point(1, 1, 4, 0) 123 p2 = Point(2, 1, 5, 0) 124 p3 = Point(3, 4, 6, 0) 125 p4 = Point(0, 2, 7, 0) 126 E = Plane(p1, p2, p3, p4) 127 l = Line(Point(0, 0, 0, 0), Point(1, 2, 3, 4)) 128 E.meet(l) 129 # Point(0, 0, 0, 0) 130 131 ``` 132 133 ## References 134 135 Many of the algorithms and formulas implemented in the package are taken from 136 the following books and papers: 137 138 - Jürgen Richter-Gebert, Perspectives on Projective Geometry 139 - Jürgen Richter-Gebert and Thorsten Orendt, Geometriekalküle 140 - Olivier Faugeras, Three-Dimensional Computer Vision 141 - Jim Blinn, Lines in Space: The 4D Cross Product 142 - Jim Blinn, Lines in Space: The Line Formulation 143 - Jim Blinn, Lines in Space: The Two Matrices 144 - Jim Blinn, Lines in Space: Back to the Diagrams 145 - Jim Blinn, Lines in Space: A Tale of Two Lines 146 - Jim Blinn, Lines in Space: Our Friend the Hyperbolic Paraboloid 147 - Jim Blinn, Lines in Space: The Algebra of Tinkertoys 148 - Jim Blinn, Lines in Space: Line(s) through Four Lines 149 150Platform: UNKNOWN 151Classifier: License :: OSI Approved :: MIT License 152Classifier: Programming Language :: Python 153Classifier: Programming Language :: Python :: 3 154Classifier: Programming Language :: Python :: Implementation :: CPython 155Classifier: Programming Language :: Python :: Implementation :: PyPy 156Requires-Python: >=3.5.0 157Description-Content-Type: text/markdown 158