# Swiftpack.co - LuizZak/Geometria as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
LuizZak/Geometria 0.0.2
Swift geometry-related types and algorithms
⭐️ 4
🕓 2 weeks ago
.package(url: "https://github.com/LuizZak/Geometria.git", from: "0.0.2")

# Geometria A collection of definitions and algorithms for working with 2- and 3- dimensional geometries in Swift.

(README.md is still in construction.)

### Type definitions

N-dimensional
Primitive Illustration Geometria type Remarks
Axis-aligned bounding-box AABB.swift Defined as two point vectors describing the minimal and maximal coordinates contained within the AABB.
Ray (unit vector direction) DirectionalRay.swift Defined as a starting point vector and a unit vector describing the direction of the ray.
Conceptually it extends to infinity in only one of its two ends (pointed to by its direction unit vector).
N-dimensional Ellipsoid Ellipsoid.swift Defined as a center point vector and an axis vector.
Hyperplane Hyperplane.swift Defined as a point vector on the plane and a unit vector orthogonal to the hyperplane's surface. Defines a split between two half-spaces of the space it is contained within. Is considered a convex, volumetric space that can be intersected against lines and contain points.
Line Line.swift Defined as a pair of point vectors on the line. Conceptually it extends to infinity at both ends.
Line segment LineSegment.swift Defined as start and end point vectors on the line. Conceptually it is contained only within the limits of start <-> end.
N-dimensional capsule NCapsule.swift Defined as a line segment containing two point vectors describing the span of the capsule's body, and a scalar radius that defines the maximal distance to the line segment points must be to be considered as contained within the capsule.
Specializes as a Stadium in 2D and Capsule in 3D.
Hyperrectangle NRectangle.swift Defined as an origin (top-left in two dimensions) point vector and an N-dimensional size vector.
N-sphere NSphere.swift Defined as a center point vector and a scalar radius.
N-dimensional cube (Hypercube) NSquare.swift Generalized for any dimension.
Defined as an origin point (top-left in two dimensions) and a scalar value that describes the span of the cube, in each dimension.
Forms a square in 2D, and a cube in 3D.
Plane PointNormalPlane.swift Defined as a point vector on the plane and a unit vector orthogonal to the plane's surface.
Ray (two-point) Ray.swift Defined as a pair of points start and b describing the two points the ray crosses before projecting to infinity.
Similar in definition to a line and line segment, but extends in one direction to infinity.
Triangle Triangle.swift Defined as a set of three point vectors.

### GitHub

 link Stars: 4 Last commit: Yesterday Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics