Professional 2D and 3D geometry toolkit with shapes, vectors, conics, transformations, coordinate geometry, and analytic 3D formulas.
Project description
GeomLib Advanced
GeomLib Advanced is a pure-Python geometry toolkit for 2D and 3D mathematical work. It is designed for students, teachers, competitive programming, simulations, graphics prototypes, CAD-style utilities, and backend services that need dependable geometry formulas without a heavy dependency stack.
Features
2D geometry
- Points, vectors, lines, circles, triangles, rectangles, squares, rhombuses, parallelograms, ellipses, polygons
- Area, perimeter, centroid, midpoint, slope, angle, distance, containment, intersections
- Coordinate geometry helpers including distance and section formula
- Transformations including translate, rotate, scale, and reflection
Conic sections
- Circle and ellipse support
- Parabola with focus, directrix, latus rectum, parametric points
- Hyperbola with foci, eccentricity, asymptotes, point checks
3D geometry
- Point3D, Vector3D, Line3D, Plane
- Sphere, cube, cuboid, cylinder, cone
- Volume, surface area, space diagonal, containment
- Dot product, cross product, scalar triple product, projections, angles
- Distances between 3D points, points and lines, points and planes, and skew lines
Formula helpers
- Pythagorean theorem
- Heron's formula
- Degree/radian conversion
- 2D and 3D distance formulas
- Midpoint formula
Installation
pip install geomlib-advanced
From source:
git clone https://github.com/007arjungangwar/geomlib.git
cd geomlib
pip install .
Quick Start
from geomlib import (
Circle,
Line3D,
Plane,
Point,
Point3D,
Polygon,
Triangle,
Vector2D,
Vector3D,
section_formula,
)
circle = Circle(Point(0, 0), 5)
print(circle.area())
print(circle.perimeter())
triangle = Triangle(Point(0, 0), Point(3, 0), Point(0, 4))
print(triangle.area())
print(triangle.incenter())
print(triangle.circumradius())
polygon = Polygon([Point(0, 0), Point(4, 0), Point(4, 3), Point(0, 3)])
print(polygon.area())
print(polygon.centroid())
vector = Vector2D(3, 4)
print(vector.magnitude())
print(vector.angle_with(Vector2D(1, 0)))
point = section_formula(Point(0, 0), Point(6, 6), 1, 2)
print(point)
line = Line3D(Point3D(0, 0, 0), Vector3D(1, 1, 1))
plane = Plane.from_point_normal(Point3D(0, 0, 2), Vector3D(0, 0, 1))
print(plane.line_intersection(line))
Curriculum Coverage
The library includes formulas and objects commonly used across school-level and early college geometry:
- Class 10 coordinate geometry: distance, midpoint, section formula, slope, line equations
- Class 10 mensuration: circle, rectangle, square, triangle, cylinder, cone, sphere, cuboid, cube
- Class 11 straight lines and conic sections: line relations, parabola, ellipse, hyperbola
- Class 11 introduction to 3D geometry: 3D points and distance
- Class 12 vectors and 3D geometry: vectors, dot/cross products, lines, planes, angles, distances
API Highlights
from geomlib import Parabola, Hyperbola
parabola = Parabola(Point(0, 0), 2, orientation="up")
print(parabola.focus())
print(parabola.directrix())
hyperbola = Hyperbola(Point(0, 0), 3, 2)
print(hyperbola.eccentricity())
print(hyperbola.asymptotes())
from geomlib import Plane, Point3D, Vector3D
plane = Plane.from_points(
Point3D(0, 0, 0),
Point3D(1, 0, 0),
Point3D(0, 1, 0),
)
print(plane.distance_to_point(Point3D(0, 0, 5)))
Development
Run tests:
python -m unittest discover -s tests
Build locally:
python -m build
License
This project is licensed under the MIT License.
Author
Arjun Singh Gangwar
Project details
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 geomlib_advanced-0.1.0.tar.gz.
File metadata
- Download URL: geomlib_advanced-0.1.0.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7742f677ee67e6f2b9bc6390e2e81a062adca173051d7c390c98f445479a6282
|
|
| MD5 |
f56561144a05b646a61259031d624a82
|
|
| BLAKE2b-256 |
90ca97337854b680109fcfb6c997c4ec50af1b6805c7d0c80f057519738850de
|
File details
Details for the file geomlib_advanced-0.1.0-py3-none-any.whl.
File metadata
- Download URL: geomlib_advanced-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f45dc2b12df013093ae23c72a40cd976fb14d843d087c926b66fa6fb9e431875
|
|
| MD5 |
cd8ff33dbcef96f44cf417a0e28989f7
|
|
| BLAKE2b-256 |
eea55374babea46d5e98e6a2f86379ffd88b5428beb27f2c5ceaadd6b57a9528
|