videx-3d
Version:
React 3D component library designed for sub surface visualizations in the browser
60 lines (59 loc) • 2.75 kB
TypeScript
import { PositionLog } from '../data/types/PositionLog';
import { Curve3D } from '../geometries/curve/curve-3d';
import { Vec2, Vec3 } from '../types/common';
/**
* Interface for defining a trajectory. This can be used to work with wellbore trajectories,
* where the measured top, termination point and length are known. The measured length should
* be used when calculating positions of data given in MD, so that the position on the curve is
* given by:
*
* @example
* const pos = (md - trajectory.measuredTop) / trajectory.measuredLength
*
* @remarks
* Avoid using the calculated length of the curve for this purpose, as this may potentially be less precise/consistant.
* The `getPointAtDepth` function in this interface is calculated as in the above example when created using the `getTrajectory` function.
*
* @see {@link getTrajectory}
* @see {@link Curve3D}
*/
export interface Trajectory {
id: string | number;
measuredLength: number;
measuredTop: number;
measuredBottom: number;
curve: Curve3D;
getPointAtDepth: (md: number, clamped?: boolean) => Vec3 | null;
getPositionAtDepth: (md: number, clamped?: boolean) => number | null;
}
export type ProjectedTrajectory = {
positions: Vec2[];
length: number;
top: number;
bottom: number;
} | null;
/**
* Creates an instance conforming to the `Trajectory` interface, given an id and a position log normalized to MSL depths.
*
* @see {@link Trajectory}
*/
export declare function getTrajectory(id: string, poslogMsl: PositionLog | null): Trajectory | null;
/**
* Simplifies a linear 2d curve by comparing direction changes to a threshold value.
* @param array input array
* @param accessor accessor to array coordinate element
* @param threshold threshold value (default 1e-7)
* @returns T[] array of same type as input array
*/
export declare function simplifyCurve2D<T>(array: Array<T>, accessor?: (e: T) => Vec2, threshold?: number): T[];
/**
* Generate a equaly spaced trajectory along XZ plane from a linear 3d curve
* where the distance between coordinates corresponds to stepSize.
* @param path 3d curve
* @param stepSize distance between corrdinates in output trajectory
* @param extension optional extension of original path (extrapolation)
* @param minSize a minimum size of the output. If less, points will be extrapolated in both ends
* @param defaultExtensionAngle if there is not enough deviation in the input path to determine an extrapolation angle, this angle will be used (default: 0 radians)
* @returns 2d curve along the XZ plane
*/
export declare function getProjectedTrajectory(path: Vec3[], stepSize: number, extension?: number, minSize?: number, defaultExtensionAngle?: number): ProjectedTrajectory;