Core math
Glome.Core uses double precision. Positions on are unit vectors in , tangents at satisfy , and angles are in radians (metric arc length is ). Core library overview
D2 and D4
Section titled “D2 and D4”D2(double X, double Y) is a readonly record struct supporting + and scalar *. D4(double X, double Y, double Z, double W) is a readonly record struct supporting +, -, *, / operators, indexer this[0..3], and static unit axes D4.Right (+X), Up (+Y), Back (+Z), Pole (+W).
| Member | Meaning |
|---|---|
Dot(D4 b) / Length |
Euclidean dot product and norm in |
Reject(D4 unit) |
Orthogonal component |
Unit() |
Normalized vector |
AngleTo(D4 unit) |
Geodesic angle |
static Hodge(a, b, c) |
Oriented normal orthogonal to a, b, c (Hodge(Right, Up, Back) == Pole) |
ArcRay, S3Frame, and WalkPose
Section titled “ArcRay, S3Frame, and WalkPose”ArcRay(D4 P, D4 D): great circle withAt(t) = p cos t + d sin t,Tangent(t) = d cos t - p sin t, andFirstRoot(a, b, lo)for the first root of .S3Frame(D4 Right, D4 Up, D4 Back, D4 P): orthonormal oriented frame (Identity = (Right, Up, Back, Pole)).
S3Frame member |
Behavior |
|---|---|
Local(x, y, z) |
Combine local tangent axes |
ExpMap(p, tangent) |
Travel from p along tangent by its norm in radians |
LogMap(p, q) |
Shortest tangent vector from p to q (undefined at antipode ) |
Travel(dir, angle) / Travel(dir, angle, ref needle) |
Geodesic step with parallel transport of all axes (and optional needle) |
Yaw / Pitch / Roll |
Local axis-plane rotations in radians |
OnEquator(polar, bearing) |
Frame on (0 → +Z, → +X; polar == π yields -D4.Pole) |
Orthonormalized() |
Gram–Schmidt cleanup restoring Back via oriented Hodge dual |
WalkPose(S3Frame Ground, double Pitch, double Elevation = 0):Eye(radius, eyeHeight)lifts vertically by(Elevation + eyeHeight) / radiusalongD4.Upand appliesPitch;LookingAt(...)aims at a target point.
S3ChartMath
Section titled “S3ChartMath”| Method | Behavior |
|---|---|
CentralProjection(chart, radius, offset, out scale) |
Projects tangent offset (m): , returns with |
Apply(frame, q) / Compose(a, b) / Transpose(f) |
4×4 orthonormal frame matrix operations |
Project(center, point, radius, out metres) |
Log-map into local XYZ metres; returns false when angle |
Lift(center, metres, radius) |
Inverse of Project via ExpMap |
Encode(frame) / Decode(double[8]) |
Convert between S3Frame and canonical double-quaternion (qL, qR) |
GeodesicTriangle, SphericalCap, and BakedGeometry
Section titled “GeodesicTriangle, SphericalCap, and BakedGeometry”ChartVertex.Project(chart, radius, offset, normal, uv)builds projectedChartVertex(V, K, Uv, Normal).GeodesicTriangle(a, b, c, material, surface, traversal)precomputesPlane,Dual0..2, and boundingSphericalCap.TraversalFlagscombinesCullBack = 0,CullFront = 1,TwoSided = 2(CullMask = 3) withCutout = 4.CapBvhBuilder.Build(triangles)(and overload withIList<T> owners) builds a flattenedCapNode[]tree and permutes triangles (and owners) in place.BakedGeometry.Trace(ray, bruteForce = false, lo = RayStart, hi = null, ignoredTriangle = -1, filter = null, includeEquator = true):RayStart = 1e-5rad; returnsRayHit(HitKind, Triangle, T, Uv).- Default
hiis when equatorial ground is enabled withoutgroundMask, otherwise . - Equal-angle ties prefer triangles over ground, then lower triangle index.
S3CollisionWorld and S3MotorCore
Section titled “S3CollisionWorld and S3MotorCore”CollisionProxy(chart, radius, transform, halfExtents, ProxyShape, walkableTop = false)represents a projected solidBoxorCylinder(walkableTopenables support on local+Y).S3CollisionWorld: exposesRadius,EquatorialGroundEnabled,ProxyCount,HasElevation,SupportHeight(ground, ceiling),ReplaceProxy(id, proxy),SweepSphere(ray, arc, bodyRadius, out first, out normal),ClearPlacement, and slidingMove(subarcs ).S3MotorCore(radius, arrival, BodyProfile, collision): tracks walking/flight (Flying,Camera,Pitch),SetWorld,Visit,ToggleFlight,FlyTo,ClearPlacement,Look(walking pitch clamped to[-1.54, 1.54]rad), andMove. Walkable decks use0.45 mstep-up and9.81 m/s²gravity; pass elapsedsecondstoMoveeven with zero horizontal input so falling integrates smoothly.
S3AcousticPath
Section titled “S3AcousticPath”S3AcousticPath.Resolve(listener, source, radius, localFallback = null) returns (LocalDirection, DirectDistance, ComplementaryDistance) with distances and in opposite directions (±LocalDirection), falling back to localFallback ?? D4.Up at coincidence or the antipode. Spatial audio guide