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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geom3py-2.0.0.tar.gz.
File metadata
- Download URL: geom3py-2.0.0.tar.gz
- Upload date:
- Size: 34.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d8b03c165efefed83b057f8f6f7f5d66dde5a7031bb12830d74695010bd7b6f
|
|
| MD5 |
c52b6c75c77214fb8b43ec741e3c37ed
|
|
| BLAKE2b-256 |
1747326d7d1276696269798824e490d8b6f5462b4ea2c45053cf0784edd49d48
|
File details
Details for the file geom3py-2.0.0-py3-none-any.whl.
File metadata
- Download URL: geom3py-2.0.0-py3-none-any.whl
- Upload date:
- Size: 34.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f59167392d8199da8b89587eb2746990068508c1d9af56f915d99b80d6f8cc
|
|
| MD5 |
d3fe977a63d52a40634eca9a48e13e1f
|
|
| BLAKE2b-256 |
598a89dd2240db52346821eb335331a5d32f851bd9dbada366752aefc8201008
|