Geom3py
geom3py is a library developed entirely in Pure Python for analytical geometry calculations in three-dimensional space. It features its own vector and linear algebra engine and provides an object-oriented API for vectors, points, lines, planes and faces including geometric transformations such as scaling, rotation, translation and reflection.
The library has no external dependencies and is suitable for teaching and study as well as a foundation for geometric applications, visualization or CAD-related projects.
Features
Vectors (Vector)
-
Vector addition and subtraction
-
Scalar multiplication
-
Magnitude
-
Dot product
-
Cross product
-
Normalization
-
Angle calculation
-
Transformations
- Scale
- Translate
- Rotate
- Reflect on point
- Reflect on line
- Reflect on plane
Points (Point)
- Creation of points in ℝ³
- Distance between points
- Direction vector between two points
- All geometric transformations
Lines (Line)
-
Creation from
- two points
- support and direction vector
-
Calculation of any point on the line
-
Foot point of a point
-
Intercept points
-
Distances to
- points
- lines
-
Intersection with lines
-
Positional relationships
- identical
- parallel
- intersecting
- skew
-
Angle calculations
-
Geometric transformations
Planes (Plane)
-
Creation from
- point and normal vector
- point and two direction vectors
-
Foot point of a point
-
Intersection line of two planes
-
Intersection with lines
-
Intercept points
-
Distances to
- points
- lines
- planes
-
Intersection angles
-
Positional relationships
- identical
- parallel
- intersecting
-
Geometric transformations
Faces (Face)
Representation of bounded planar quadrilaterals.
Supports among others:
-
Center point
-
Perimeter
-
Area
-
Normal vector
-
Point-in-face test
-
Positional relationships between faces
- identical
- parallel
- intersecting
- outside
- coplanar intersecting
- coplanar outside
- on edge
- touching
- edge intersecting
-
Distance between faces
-
Intersection point (if unique)
-
Geometric transformations
Properties
- ✅ Completely in Pure Python
- ✅ No external dependencies
- ✅ Custom vector engine
- ✅ Custom linear algebra helper functions
- ✅ Object-oriented API
- ✅ Numerically robust calculations using custom tolerance functions
- ✅ Geometric transformations for all objects
- ✅ Extensive unit tests
- ✅ Suitable for teaching, study and technical applications
Installation
pip install geom3py
📚 Examples
Basic Geometry
from geom3py import Point, Line
A = Point([0, 0, 0])
B = Point([2, 2, 2])
g = Line.from_points(A, B)
print(A.distance_to_point(B))
print(g.point_at(0.5))
print(g.contains_point(A))
Planes
from geom3py import Point, Plane
E = Plane([1, 2, 3], [1, 1, 1])
P = Point([4, 5, 6])
print(E.distance_point(P))
print(E.contains_point(P))
print(E.intercept_points())
Transformations
from geom3py import Line
g = Line(Point(1, 2, 3), Point(1, 0, 0))
g2 = g.scale(2)
g3 = g.translate(Point(5, 0, 0))
g4 = g.rotate(90, "z")
g5 = g.reflect_on_point(Point(0, 0, 0))
Face
from geom3py import Point, Face
face = Face(
[0, 0, 0],
[10, 0, 0],
[10, 8, 0],
[0, 8, 0]
)
print(face.area())
print(face.perimeter())
print(face.center)
P = Point([5, 4, 0])
print(face.contains_point(P))
Intersection Between Line and Plane
from geom3py import Line, Plane
g = Line([0, 0, 0], [1, 1, 1])
E = Plane([1, 0, 0], [0, 1, 0])
print(E.position_line(g))
print(E.intersection_line(g))
Angle Calculations
from geom3py import Line, Plane
g1 = Line([0, 0, 0], [1, 0, 0])
g2 = Line([0, 0, 0], [1, 1, 0])
print(g1.angle_lines(g2, deg=True))
E = Plane([0, 0, 0], [0, 0, 1])
print(E.angle_line(g1, deg=True))
E2 = Plane([0, 0, 0], [1, 1, 0])
print(E.angle_plane(E2, deg=True))
Dependencies
- Python ≥ 3.10
License
MIT License.
Release files for geom3py 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| geom3py-2.0.0.tar.gz | 34.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geom3py-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.8 kB
Release files / geom3py-2.0.0.tar.gz
| Download URL | geom3py-2.0.0.tar.gz |
|---|---|
| Size | 34.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d8b03c165efefed83b057f8f6f7f5d66dde5a7031bb12830d74695010bd7b6f
|
|
BLAKE2b-256 checksum How to use checksums |
1747326d7d1276696269798824e490d8b6f5462b4ea2c45053cf0784edd49d48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / geom3py-2.0.0-py3-none-any.whl
| Download URL | geom3py-2.0.0-py3-none-any.whl |
|---|---|
| Size | 34.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85f59167392d8199da8b89587eb2746990068508c1d9af56f915d99b80d6f8cc
|
|
BLAKE2b-256 checksum How to use checksums |
598a89dd2240db52346821eb335331a5d32f851bd9dbada366752aefc8201008
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|