UNPKG

toosoon-utils

Version:
88 lines (87 loc) 2.81 kB
import type { Point3 } from '../../types'; import { Vector3 } from '../geometry'; import Curve from './Curve'; /** * Utility class for manipulating 3D lines * * @exports * @class LineCurve3 * @extends Curve */ export default class LineCurve3 extends Curve<Vector3> { readonly type: string; /** * X-axis coordinate of the start point */ x1: number; /** * Y-axis coordinate of the start point */ y1: number; /** * Z-axis coordinate of the start point */ z1: number; /** * X-axis coordinate of the end point */ x2: number; /** * Y-axis coordinate of the end point */ y2: number; /** * Z-axis coordinate of the end point */ z2: number; /** * @param {number} x1 X-axis coordinate of the start point * @param {number} y1 Y-axis coordinate of the start point * @param {number} z1 Z-axis coordinate of the start point * @param {number} x2 X-axis coordinate of the end point * @param {number} y2 Y-axis coordinate of the end point * @param {number} z2 Z-axis coordinate of the end point */ constructor(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number); /** * Interpolate a point on this curve * * @param {number} t Normalized time value to interpolate * @returns {Vector3} Interpolated coordinates on this curve */ getPoint(t: number): Vector3; /** * Interpolate a point on this curve * * @param {number} u Normalized position value to interpolate * @returns {Vector3} Interpolated coordinates on this curve */ getPointAt(u: number): Vector3; /** * Compute an unit vector tangent for a given normalized time value * * @param {number} t Normalized time value * @returns {Vector3} Tangent vector */ getTangent(t?: number): Vector3; /** * Compute an unit vector tangent for a given normalized position value * * @param {number} u Normalized position value * @returns {Vector3} Tangent vector */ getTangentAt(u?: number): Vector3; /** * Interpolate a point on a 3D line * * @param {number} t Normalized time value to interpolate * @param {number} x1 X-axis coordinate of the start point * @param {number} y1 Y-axis coordinate of the start point * @param {number} z1 Z-axis coordinate of the start point * @param {number} x2 X-axis coordinate of the end point * @param {number} y2 Y-axis coordinate of the end point * @param {number} z2 Z-axis coordinate of the end point * @returns {Point3} Interpolated coordinates on the line */ static interpolate(t: number, x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): Point3; }