import { VecN } from '../math/vecn.js'; import { TransformN } from '../math/transform.js'; import type { HomogeneousProjection } from '../projection/types.js'; import { type SourceCellReferenceN } from './source-reference.js'; /** * An oriented coordinate on one current source 1-cell. * * `parameter = 0` names the reference's first vertex and `parameter = 1` * names its second. The coordinate retains topology identity rather than a * snapshot of the endpoint positions, so evaluation follows later geometry * edits while the source-cell reference remains current. */ export interface SourceEdgeCoordinateN { readonly kind: 'source-edge-coordinate'; readonly reference: SourceCellReferenceN; readonly parameter: number; } export interface SourceEdgeProjectionN { readonly coordinate: SourceEdgeCoordinateN; readonly point: VecN; /** Squared Euclidean distance from the query point to the closed segment. */ readonly squaredDistance: number; /** Parameter on the supporting line before clamping to the source segment. */ readonly unclampedParameter: number; } export interface SourceEdgeCoordinateOptions { /** Clamp finite parameters to the closed source segment. Default `true`. */ readonly clamp?: boolean; } export interface SourceEdgeProjectionFitOptions { /** Source-local to ambient transform applied before projection. */ readonly transform?: TransformN; /** Scale-relative exact-target and degeneracy tolerance. Default `1e-9`. */ readonly tolerance?: number; } export type SourceEdgeProjectionFitFailureReason = 'invalid-projection-vertex' | 'invalid-homogeneous-denominator' | 'degenerate-projected-edge' | 'singular-source-weights'; export interface AvailableSourceEdgeProjectionFitN { /** Exact when the target lies on the projected segment; least-squares otherwise. */ readonly kind: 'exact' | 'least-squares'; readonly coordinate: SourceEdgeCoordinateN; /** Evaluated source-local point on the current edge. */ readonly point: VecN; /** Source point after the optional ambient transform. */ readonly ambientPoint: VecN; readonly targetPoint: readonly [number, number, number]; /** Closest point on the projected source segment. */ readonly representationPoint: readonly [number, number, number]; /** Affine parameter on the rendered segment before perspective correction. */ readonly representationParameter: number; /** Supporting-line parameter before clamping to the rendered segment. */ readonly unclampedRepresentationParameter: number; readonly endpointClamped: boolean; /** Distance from the requested representation point to the realized one. */ readonly representationResidual: number; /** Forward projection error of the recovered source coordinate. */ readonly roundTripResidual: number; readonly minAbsQ: number; } export interface UnavailableSourceEdgeProjectionFitN { readonly kind: 'unavailable'; readonly reason: SourceEdgeProjectionFitFailureReason; readonly details: Readonly>; } export type SourceEdgeProjectionFitN = AvailableSourceEdgeProjectionFitN | UnavailableSourceEdgeProjectionFitN; /** Create a validated, oriented coordinate on a current source edge. */ export declare function createSourceEdgeCoordinateN(reference: SourceCellReferenceN, parameter: number, options?: SourceEdgeCoordinateOptions): SourceEdgeCoordinateN; /** Evaluate a source-edge coordinate against the edge's current positions. */ export declare function evaluateSourceEdgeCoordinateN(coordinate: SourceEdgeCoordinateN): VecN; /** * Project an ambient point onto the closed source segment in Float64. * * This is an explicit interaction policy, not an inverse projection: the * caller has already selected the source edge whose one-dimensional freedom * resolves the otherwise underdetermined representation-space edit. */ export declare function projectPointToSourceEdgeN(reference: SourceCellReferenceN, point: ArrayLike): SourceEdgeProjectionN; /** * Fit a representation-space target to one explicitly selected source edge. * * The homogeneous image of an N-D line is a line in R3. The target is first * projected onto that rendered segment in ordinary R3; its affine segment * parameter is then converted to the perspective-correct source parameter. * An exact result means the requested target was already on the segment. * Otherwise the result is an explicitly labelled least-squares policy. */ export declare function fitSourceEdgeCoordinateToProjectionN(reference: SourceCellReferenceN, projection: HomogeneousProjection, targetPoint: ArrayLike, options?: SourceEdgeProjectionFitOptions): SourceEdgeProjectionFitN; //# sourceMappingURL=source-edge-coordinate.d.ts.map