Structures
The following structures are available globally.
-
Represents a 2D arc of a circle as a center, radius, and start+sweep angles.
See moreDeclaration
Swift
public struct CircleArc2<Vector> : GeometricType, CustomStringConvertible where Vector : Vector2Realextension CircleArc2: LineIntersectableTypeextension CircleArc2: Equatable where Vector: Equatableextension CircleArc2: Hashable where Vector: Hashable -
Represents a 2D edge inset as relative inset values for each of the four edges of a rectangular 2D perimeter.
See moreDeclaration
Swift
public struct EdgeInsets2<Vector> where Vector : Vector2Typeextension EdgeInsets2: Equatable where Vector: Equatable, Scalar: Equatableextension EdgeInsets2: Hashable where Vector: Hashable, Scalar: Hashableextension EdgeInsets2: Encodable where Vector: Encodable, Scalar: Encodableextension EdgeInsets2: Decodable where Vector: Decodable, Scalar: Decodable -
Describes the result of a line-line intersection query on two
Line2FloatingPoint.See moreSeealso
intersection(with:)Declaration
Swift
public struct LineIntersectionResult<Vector> where Vector : VectorFloatingPointextension LineIntersectionResult: Equatable where Vector: Equatableextension LineIntersectionResult: Hashable where Vector: Hashable -
A two-component vector type
See moreDeclaration
Swift
public struct Vector2<Scalar> : Vector2Typeextension Vector2: Equatable where Scalar: Equatableextension Vector2: Hashable where Scalar: Hashableextension Vector2: Encodable where Scalar: Encodableextension Vector2: Decodable where Scalar: Decodableextension Vector2: VectorComparable where Scalar: Comparableextension Vector2: AdditiveArithmetic where Scalar: AdditiveArithmeticextension Vector2: VectorAdditive where Scalar: AdditiveArithmeticextension Vector2: Vector2Additive where Scalar: AdditiveArithmeticextension Vector2: VectorMultiplicative where Scalar: Numericextension Vector2: Vector2Multiplicative where Scalar: Numericextension Vector2: VectorSigned where Scalar: SignedNumeric & Comparableextension Vector2: Vector2Signed where Scalar: SignedNumeric & Comparableextension Vector2: VectorDivisible where Scalar: DivisibleArithmeticextension Vector2: VectorFloatingPoint where Scalar: DivisibleArithmetic & FloatingPointextension Vector2: SignedDistanceMeasurableType where Scalar: DivisibleArithmetic & FloatingPointextension Vector2: Vector2FloatingPoint where Scalar: DivisibleArithmetic & FloatingPointextension Vector2: VectorReal where Scalar: DivisibleArithmetic & Realextension Vector2: Vector2Real where Scalar: DivisibleArithmetic & Real -
Declaration
Swift
public struct Cylinder3<Vector> : GeometricType where Vector : Vector3Typeextension Cylinder3: Equatable where Vector: Equatable, Scalar: Equatableextension Cylinder3: Hashable where Vector: Hashable, Scalar: Hashableextension Cylinder3: BoundableType where Vector: Vector3FloatingPointextension Cylinder3: VolumetricType where Vector: Vector3FloatingPointextension Cylinder3: PointProjectableType where Vector: Vector3FloatingPointextension Cylinder3: SignedDistanceMeasurableType where Vector: VectorFloatingPointextension Cylinder3: Convex3Type where Vector: Vector3Real -
Represents a 3-dimensional flat disk as a center point, normal, and radius.
A disk can be interpreted as a clipped plane, where the only points contained within the plane are the ones
See more<=radiusdistance from the center.Declaration
Swift
public struct Disk3<Vector> : GeometricType where Vector : Vector3FloatingPointextension Disk3: BoundableTypeextension Disk3: PointProjectableTypeextension Disk3: SignedDistanceMeasurableTypeextension Disk3: LineIntersectablePlaneTypeextension Disk3: Equatable where Vector: Equatableextension Disk3: Hashable where Vector: Hashable -
Coordinates on a sphere projective space.
See moreDeclaration
Swift
public struct SphereCoordinates<Scalar> : Equatable where Scalar : Real -
A point-normal plane with a separate up and right vector used to control projection on the axis of the plane and compute the local X and Y axis.
See moreDeclaration
Swift
public struct ProjectivePointNormalPlane3<Vector> : PointProjectablePlaneType where Vector : Vector3FloatingPointextension ProjectivePointNormalPlane3: ProjectiveSpaceextension ProjectivePointNormalPlane3: PlaneProjectiveSpaceextension ProjectivePointNormalPlane3: Equatable where Vector: Equatableextension ProjectivePointNormalPlane3: Hashable where Vector: Hashable -
Represents a three dimensional torus shape as a center point, an axis of rotation around that center point, and two radii describing the radius of a circle, and the radius of the axis of rotation of the circle around the center point of the torus.
See moreDeclaration
Swift
public struct Torus3<Vector> : GeometricType where Vector : Vector3FloatingPointextension Torus3: BoundableTypeextension Torus3: VolumetricTypeextension Torus3: PointProjectableTypeextension Torus3: Equatable where Vector: Equatable, Scalar: Equatableextension Torus3: Hashable where Vector: Hashable, Scalar: Hashableextension Torus3: SignedDistanceMeasurableType where Vector.Scalar: Real -
A three-component vector type
See moreDeclaration
Swift
public struct Vector3<Scalar> : Vector3Typeextension Vector3: Equatable where Scalar: Equatableextension Vector3: Hashable where Scalar: Hashableextension Vector3: Encodable where Scalar: Encodableextension Vector3: Decodable where Scalar: Decodableextension Vector3: VectorComparable where Scalar: Comparableextension Vector3: AdditiveArithmetic where Scalar: AdditiveArithmeticextension Vector3: VectorAdditive where Scalar: AdditiveArithmeticextension Vector3: VectorMultiplicative where Scalar: Numericextension Vector3: Vector3Additive where Scalar: AdditiveArithmeticextension Vector3: Vector3Multiplicative where Scalar: Numericextension Vector3: VectorSigned where Scalar: SignedNumeric & Comparableextension Vector3: VectorDivisible where Scalar: DivisibleArithmeticextension Vector3: VectorFloatingPoint where Scalar: DivisibleArithmetic & FloatingPointextension Vector3: SignedDistanceMeasurableType where Scalar: DivisibleArithmetic & FloatingPointextension Vector3: Vector3FloatingPoint where Scalar: DivisibleArithmetic & FloatingPointextension Vector3: VectorReal where Scalar: DivisibleArithmetic & Realextension Vector3: Vector3Real where Scalar: DivisibleArithmetic & Real -
A four-component vector type
See moreDeclaration
Swift
public struct Vector4<Scalar> : Vector4Typeextension Vector4: Equatable where Scalar: Equatableextension Vector4: Hashable where Scalar: Hashableextension Vector4: Encodable where Scalar: Encodableextension Vector4: Decodable where Scalar: Decodableextension Vector4: VectorComparable where Scalar: Comparableextension Vector4: AdditiveArithmetic where Scalar: AdditiveArithmeticextension Vector4: VectorAdditive where Scalar: AdditiveArithmeticextension Vector4: VectorMultiplicative where Scalar: Numericextension Vector4: Vector4Additive where Scalar: AdditiveArithmeticextension Vector4: VectorSigned where Scalar: SignedNumeric & Comparableextension Vector4: VectorDivisible where Scalar: DivisibleArithmeticextension Vector4: VectorFloatingPoint where Scalar: DivisibleArithmetic & FloatingPointextension Vector4: SignedDistanceMeasurableType where Scalar: DivisibleArithmetic & FloatingPointextension Vector4: Vector4FloatingPoint where Scalar: DivisibleArithmetic & FloatingPointextension Vector4: VectorReal where Scalar: DivisibleArithmetic & Real -
A standardized representation of an angle.
See moreDeclaration
Swift
public struct Angle<Scalar> : Hashable, CustomStringConvertible where Scalar : ElementaryFunctions, Scalar : FloatingPointextension Angle: AdditiveArithmeticextension Angle: Numericextension Angle: Encodable where Scalar: Encodableextension Angle: Decodable where Scalar: Decodable -
A pair of angle + angle range values that can be used to test inclusivity of
See moreAngle<Scalar>values.Declaration
Swift
public struct AngleSweep<Scalar> : Hashable where Scalar : ElementaryFunctions, Scalar : FloatingPoint -
Represents an axis-aligned bounding box with two N-dimensional vectors that describe the minimal and maximal coordinates of the box’s opposite corners.
See moreDeclaration
Swift
public struct AABB<Vector> : GeometricType where Vector : VectorTypeextension AABB: BoundableTypeextension AABB: Equatable where Vector: Equatable, Scalar: Equatableextension AABB: Hashable where Vector: Hashable, Scalar: Hashableextension AABB: Encodable where Vector: Encodable, Scalar: Encodableextension AABB: Decodable where Vector: Decodable, Scalar: Decodableextension AABB: VolumetricType where Vector: VectorComparableextension AABB: SelfIntersectableRectangleType where Vector: VectorAdditive & VectorComparableextension AABB: RectangleType & ConstructableRectangleType & AdditiveRectangleType where Vector: VectorAdditiveextension AABB: DivisibleRectangleType where Vector: VectorDivisible & VectorComparableextension AABB: ConvexType where Vector: VectorFloatingPointextension AABB: SignedDistanceMeasurableType where Vector: VectorFloatingPoint -
Represents an N-dimensional geometric ray which projects a line from a starting point in a specified direction to infinity.
See moreDeclaration
Swift
public struct DirectionalRay<Vector> : GeometricType where Vector : VectorFloatingPointextension DirectionalRay: LineTypeextension DirectionalRay: Equatable where Vector: Equatable, Scalar: Equatableextension DirectionalRay: Hashable where Vector: Hashable, Scalar: Hashableextension DirectionalRay: Encodable where Vector: Encodable, Scalar: Encodableextension DirectionalRay: Decodable where Vector: Decodable, Scalar: Decodableextension DirectionalRay: LineAdditive where Vector: VectorAdditiveextension DirectionalRay: LineMultiplicative where Vector: VectorMultiplicativeextension DirectionalRay: LineSigned where Vector: VectorSignedextension DirectionalRay: LineFloatingPoint & PointProjectableType & SignedDistanceMeasurableType where Vector: VectorFloatingPointextension DirectionalRay: LineReal where Vector: VectorReal -
Represents an N-dimensional ellipsoid as a center with an N-dimensional radii vector which describes the axis of the ellipsoid.
See moreDeclaration
Swift
public struct Ellipsoid<Vector> : GeometricType where Vector : VectorTypeextension Ellipsoid: Equatable where Vector: Equatable, Scalar: Equatableextension Ellipsoid: Hashable where Vector: Hashable, Scalar: Hashableextension Ellipsoid: Encodable where Vector: Encodable, Scalar: Encodableextension Ellipsoid: Decodable where Vector: Decodable, Scalar: Decodableextension Ellipsoid: BoundableType where Vector: VectorAdditiveextension Ellipsoid: VolumetricType where Vector: VectorRealextension Ellipsoid: ConvexType where Vector: VectorReal -
Represents a hyperplane with a point and a normal.
The dimensions of the surface of the hyperplane have a codimension of 1 with respect to its ambient space; in 2D, a hyperplane equates to a line, in 3D it equates to a flat 2D plane, in 4D to a 3D volume, etc.
Hyperplanes divides the space it is contained within, producing an infinitely-spanning volume of space bound at a specific point and angle relative to its ambient space.
See moreDeclaration
Swift
public struct Hyperplane<Vector> : GeometricType, CustomStringConvertible where Vector : VectorFloatingPointextension Hyperplane: PlaneTypeextension Hyperplane: PointProjectablePlaneTypeextension Hyperplane: LineIntersectablePlaneTypeextension Hyperplane: ConvexTypeextension Hyperplane: VolumetricTypeextension Hyperplane: Equatable where Vector: Equatableextension Hyperplane: Hashable where Vector: Hashable -
Represents a geometric line as a pair of start and end N-dimensional vectors which describe the two points an infinite line crosses.
See moreDeclaration
Swift
public struct Line<Vector> : LineType where Vector : VectorTypeextension Line: Equatable where Vector: Equatable, Scalar: Equatableextension Line: Hashable where Vector: Hashable, Scalar: Hashableextension Line: Encodable where Vector: Encodable, Scalar: Encodableextension Line: Decodable where Vector: Decodable, Scalar: Decodableextension Line: LineAdditive where Vector: VectorAdditiveextension Line: LineMultiplicative where Vector: VectorMultiplicativeextension Line: LineDivisible where Vector: VectorDivisibleextension Line: LineSigned where Vector: VectorSignedextension Line: LineFloatingPoint & PointProjectableType & SignedDistanceMeasurableType where Vector: VectorFloatingPointextension Line: LineReal where Vector: VectorReal -
The result of a
See moreLineIntersectableType-line intersection test.Declaration
Swift
public struct LineIntersection<Vector> where Vector : VectorFloatingPointextension LineIntersection: Equatable where Vector: Equatableextension LineIntersection: Hashable where Vector: Hashable -
Represents a point along with a normal on the surface of a geometry, and an absolute magnitude associated with a line that intersected with that point.
See moreDeclaration
Swift
public struct LineIntersectionPointNormal<Vector> : GeometricType, CustomStringConvertible where Vector : VectorFloatingPointextension LineIntersectionPointNormal: Equatable where Vector: Equatableextension LineIntersectionPointNormal: Hashable where Vector: Hashableextension LineIntersectionPointNormal: PlaneType where Vector: VectorFloatingPoint -
Represents a line polygon as a series of connected N-dimensional vertices.
A 2-dimensional line polygon defines a closed polygon, while in higher dimensions it is simply a list of line segments where the ends meet at the vertices.
See moreDeclaration
Swift
public struct LinePolygon<Vector> : GeometricType where Vector : VectorTypeextension LinePolygon: Equatable where Vector: Equatable, Scalar: Equatableextension LinePolygon: Hashable where Vector: Hashable, Scalar: Hashableextension LinePolygon: Encodable where Vector: Encodable, Scalar: Encodableextension LinePolygon: Decodable where Vector: Decodable, Scalar: Decodableextension LinePolygon: BoundableType where Vector: VectorAdditive & VectorComparable -
Represents a line segment as a pair of start and end N-dimensional vectors which describe a closed interval.
See moreDeclaration
Swift
public struct LineSegment<Vector> : LineType, CustomStringConvertible where Vector : VectorTypeextension LineSegment: Equatable where Vector: Equatable, Scalar: Equatableextension LineSegment: Hashable where Vector: Hashable, Scalar: Hashableextension LineSegment: Encodable where Vector: Encodable, Scalar: Encodableextension LineSegment: Decodable where Vector: Decodable, Scalar: Decodableextension LineSegment: BoundableType where Vector: VectorComparableextension LineSegment: LineAdditive where Vector: VectorAdditiveextension LineSegment: LineMultiplicative where Vector: VectorMultiplicativeextension LineSegment: LineSigned where Vector: VectorSignedextension LineSegment: LineDivisible where Vector: VectorDivisibleextension LineSegment: LineFloatingPoint & PointProjectableType & SignedDistanceMeasurableType where Vector: VectorFloatingPointextension LineSegment: LineReal where Vector: VectorReal -
Represents an N-dimensional capsule (A Stadium in 2D, and a Capsule in 3D), where all points that are less than
See moreradiusdistance away from a line are considered within the geometry.Declaration
Swift
public struct NCapsule<Vector> : GeometricType where Vector : VectorTypeextension NCapsule: Equatable where Vector: Equatable, Scalar: Equatableextension NCapsule: Hashable where Vector: Hashable, Scalar: Hashableextension NCapsule: BoundableType where Vector: VectorAdditive & VectorComparableextension NCapsule: VolumetricType where Vector: VectorFloatingPointextension NCapsule: PointProjectableType where Vector: VectorFloatingPoint -
Represents an N-dimensional rectangle with a vector describing its origin and a size vector that describes the span of the rectangle.
See moreDeclaration
Swift
public struct NRectangle<Vector> : ConstructableRectangleType where Vector : VectorTypeextension NRectangle: Equatable where Vector: Equatable, Scalar: Equatableextension NRectangle: Hashable where Vector: Hashable, Scalar: Hashableextension NRectangle: Encodable where Vector: Encodable, Scalar: Encodableextension NRectangle: Decodable where Vector: Decodable, Scalar: Decodableextension NRectangle: AdditiveRectangleType where Vector: VectorAdditiveextension NRectangle: BoundableType where Vector: VectorAdditiveextension NRectangle: VolumetricType where Vector: VectorAdditive & VectorComparableextension NRectangle: SelfIntersectableRectangleType where Vector: VectorAdditive & VectorComparableextension NRectangle: DivisibleRectangleType where Vector: VectorDivisible & VectorComparableextension NRectangle: ConvexType where Vector: VectorFloatingPointextension NRectangle: SignedDistanceMeasurableType where Vector: VectorFloatingPoint -
Represents an N-dimensional sphere with a center point and a radius.
See moreDeclaration
Swift
public struct NSphere<Vector> : GeometricType, CustomStringConvertible where Vector : VectorTypeextension NSphere: Equatable where Vector: Equatable, Scalar: Equatableextension NSphere: Hashable where Vector: Hashable, Scalar: Hashableextension NSphere: Encodable where Vector: Encodable, Scalar: Encodableextension NSphere: Decodable where Vector: Decodable, Scalar: Decodableextension NSphere: BoundableType where Vector: VectorAdditiveextension NSphere: SignedDistanceMeasurableType where Vector: VectorFloatingPointextension NSphere: ConvexType & PointProjectableType where Vector: VectorFloatingPoint -
Represents an N-dimensional square with an origin point and a scalar value for the side length of each edge.
See moreDeclaration
Swift
public struct NSquare<Vector> : GeometricType where Vector : VectorTypeextension NSquare: Equatable where Vector: Equatable, Scalar: Equatableextension NSquare: Hashable where Vector: Hashable, Scalar: Hashableextension NSquare: RectangleType & BoundableType where Vector: VectorAdditiveextension NSquare: VolumetricType where Vector: VectorAdditive & VectorComparableextension NSquare: ConvexType where Vector: VectorFloatingPointextension NSquare: SignedDistanceMeasurableType where Vector: VectorFloatingPoint -
A point-cloud container for discrete sets of points in space.
See moreDeclaration
Swift
public struct PointCloud<Vector> where Vector : VectorType -
Represents a point along with a normal on the surface of a geometry.
This point-normal pair type has more lax constraints compared to
See morePointNormalPlane.Declaration
Swift
public struct PointNormal<Vector> : GeometricType, CustomStringConvertible where Vector : VectorFloatingPointextension PointNormal: Equatable where Vector: Equatableextension PointNormal: Hashable where Vector: Hashableextension PointNormal: PlaneType where Vector: VectorFloatingPoint -
Represents an infinite plane with a point and a normal.
In 2D, a plane equates to a line, while in 3D and higher dimensions it equates to a flat 2D plane.
See moreDeclaration
Swift
public struct PointNormalPlane<Vector> : GeometricType, CustomStringConvertible where Vector : VectorFloatingPointextension PointNormalPlane: PlaneTypeextension PointNormalPlane: PointProjectablePlaneTypeextension PointNormalPlane: LineIntersectablePlaneTypeextension PointNormalPlane: Equatable where Vector: Equatableextension PointNormalPlane: Hashable where Vector: Hashable -
Wraps a vector and ensures that assignments are always stored as a unit vector.
If a vector with
See more.length == 0is attempted to be stored, a zero-valued vector is assigned instead andisValidreturnsfalseuntil a new valid vector is supplied.Declaration
Swift
@propertyWrapper public struct UnitVector<Vector> where Vector : VectorFloatingPointextension UnitVector: Equatable where Vector: Equatable, Vector.Scalar: Equatableextension UnitVector: Hashable where Vector: Hashable, Vector.Scalar: Hashableextension UnitVector: Encodable where Vector: Encodable, Vector.Scalar: Encodableextension UnitVector: Decodable where Vector: Decodable, Vector.Scalar: Decodable -
Represents an N-dimensional geometric ray line which has a starting point and crosses a secondary point before projecting to infinity.
See moreDeclaration
Swift
public struct Ray<Vector> : GeometricType where Vector : VectorTypeextension Ray: LineTypeextension Ray: Equatable where Vector: Equatable, Scalar: Equatableextension Ray: Hashable where Vector: Hashable, Scalar: Hashableextension Ray: Encodable where Vector: Encodable, Scalar: Encodableextension Ray: Decodable where Vector: Decodable, Scalar: Decodableextension Ray: LineAdditive where Vector: VectorAdditiveextension Ray: LineMultiplicative where Vector: VectorMultiplicativeextension Ray: LineDivisible where Vector: VectorDivisibleextension Ray: LineSigned where Vector: VectorSignedextension Ray: LineFloatingPoint & PointProjectableType & SignedDistanceMeasurableType where Vector: VectorFloatingPointextension Ray: LineReal where Vector: VectorReal -
Represents an N-dimensional rounded rectangle with a rectangle and radius for each axis.
See moreDeclaration
Swift
public struct RoundNRectangle<Vector> : GeometricType where Vector : VectorTypeextension RoundNRectangle: Equatable where Vector: Equatable, Scalar: Equatableextension RoundNRectangle: Hashable where Vector: Hashable, Scalar: Hashableextension RoundNRectangle: Encodable where Vector: Encodable, Scalar: Encodableextension RoundNRectangle: Decodable where Vector: Decodable, Scalar: Decodableextension RoundNRectangle: BoundableType where Vector: VectorAdditive -
Represents a [triangle] as a trio of N-dimensional vectors which describe a 2-dimensional enclosed surface on an euclidean space.
See moreDeclaration
Swift
public struct Triangle<Vector> : GeometricType where Vector : VectorTypeextension Triangle: BoundableType where Vector: VectorComparable -
Plain 2-row 2-column Matrix with real components.
See moreDeclaration
Swift
public struct Matrix2x2<Scalar> : SquareMatrixType, CustomStringConvertible where Scalar : DivisibleArithmetic, Scalar : Real -
Plain 3-row 2-column Matrix for 2D affine transformations with floating-point components.
See moreDeclaration
Swift
public struct Matrix3x2<Scalar> : Hashable, CustomStringConvertible where Scalar : ElementaryFunctions, Scalar : FloatingPointextension Matrix3x2: Encodable where Scalar: Encodableextension Matrix3x2: Decodable where Scalar: Decodable -
Plain 3-row 3-column Matrix with real components.
See moreDeclaration
Swift
public struct Matrix3x3<Scalar> : SquareMatrixType, CustomStringConvertible where Scalar : DivisibleArithmetic, Scalar : Real -
Plain 4-row 4-column Matrix with real components.
See moreDeclaration
Swift
public struct Matrix4x4<Scalar> : SquareMatrixType, CustomStringConvertible where Scalar : DivisibleArithmetic, Scalar : Real
Structures Reference