Simplify your geometry-related tasks with this versatile Julia package. providing tools for defining shapes of N-dimension and performing essential calculations in real-time.
Important
This package prioritizes simplicity, ease of use, and real-time performance. There may be a trade-off in terms of precision in certain geometric calculations. For use cases requiring high-precision results (e.g., scientific simulations, engineering), it's recommended to use specialized, precision-focused geometry packages.
using Pkg; Pkg.add(url="https://github.com/cyber-amr/Shapes.jl")
All code licensed under the MIT license.
AbstractTransformation{D}
├── Transformation{D}
├── Translation{D}
├── Rotation{D}
└── Scaling{D}
Linear{D,T}
├── Line{D,T}
├── LineSegment{D,T}
└── Ray{D,T}
Shape{D}
├── PrimitiveShape{D}
│ ├── NSphere{D}
│ └── Polytope{D}
│ ├── ArbitraryPolytope{D} - a raw vertices type for exporting purposes
│ ├── ConvexPolytope{D, S} - S = number of sides
│ └── ConcavePolytope{D, S} - S = number of sides
└── ComplexShape{D}
├── BendedShape{D}
├── TwistedShape{D}
├── AbstractExtrudedShape{D, Linear|Shape}
│ ├── ExtrudedShape{D, Linear|Shape} - Can represent Cylinder and Prism like shapes
│ └── TaperExtrudedShape{D, Linear|Shape} - type of ExtrudedShape but for Cone and Pyramid like shapes
└── CompositeShape{D, Shape, Shape}
├── UnionShape{D, Shape, Shape}
├── IntersectShape{D, Shape, Shape}
├── SubtractShape{D, Shape, Shape}
└── DifferenceShape{D, Shape, Shape}
Space{D}
├── InfiniteSpace{D}
└── ShapedSpace{D, Linear{D}|Shape{D}}
Boolean
├── union(Linear|Shape, Linear|Shape) - alias `∪`
├── intersect(Linear|Shape, Linear|Shape) - alias `∩`
├── subtract(Linear|Shape, Linear|Shape)
└── difference(Linear|Shape, Linear|Shape)
Transformations
├── translate(Linear|Shape, Translation)
├── rotate(Linear|Shape, Rotation)
├── scale(Linear|Shape, Scaling)
├── extrude(Linear|Shape, Vector, [Taper])
├── bend(Linear|Shape, Vector)
├── twist(Linear|Shape, Vector)
├── reflect(Linear|Shape, Shape)
└── shear(Linear|Shape, Shape)
Mesurements
├── volume(Shape)
├── surface(Shape)
├── area(Shape{2})
├── perimeter(Shape{2})
├── distance(Linear) - Euclidean length
├── distance²(Point, Point)
├── distance(Point, Point)
└── normalize(Vector)
Queries
├── iscontaining(Linear|Shape, Linear|Shape)
├── isintersecting(Linear|Shape, Linear|Shape)
├── isoverlapping(Linear|Shape, Linear|Shape)
├── isdistant(Linear|Shape, Linear|Shape)
├── isdegenerate(Linear|Shape)
├── iscollinear(Linear, Linear)
├── iscollinear(Vector, Vector)
├── iscollinear(Point, Point, Point)
├── isparallel(Linear, Linear)
├── isconvex(Shape)
├── isregular(Shape)
├── isclockwise(Shape{2})
├── closestpoint(Linear|Shape, Vector)
├── projection(Linear|Shape, Vector)
├── centroid(Linear|Shape)
└── normal(Linear|Shape)
Bounding volumes
├── convexhull(Shape)
├── boundingbox(Shape)
└── boundingsphere(Linear|Shape)
Tessellation and Simplification
├── simplify(Shape, tolerance)
├── decompose(CompositeShape; recursive=false)
├── tessellate(Shape, resolution)
└── voxelize(Linear|Shape, resolution) - pixelize(Shape{2}, resolution)
Space
├── ShortestPath(Space, Point|Linear|Shape, Point|Linear|Shape)
├── collisions(Space)
├── isvisible(Space, Point|Linear|Shape, Point|Linear|Shape)
└── visibilitygraph(Space)