UNPKG

@numericelements/knot-sequence

Version:

A library for generating and manipulating knot sequences for b-spline curves and surfaces

70 lines 3.07 kB
/** * Represents a knot in a B-spline knot sequence with its location (abscissa) along the axis of reals and its multiplicity. * * @description * The Knot class encapsulates the concept of a knot in a B-spline knot sequence. * The abscissa and/or multiplicity default to Infinity. This is a special value indicating that the abscissa and/or multiplicity * is not yet defined since an abscissa value of 0 or a multiplicity of 0 can be regarded as a valid. * * */ export declare class Knot { protected _abscissa: number; protected _multiplicity: number; /** * Creates a new knot. * * @param abscissa - Position value of the knot along the axis of reals (default: Infinity) * @param multiplicity - Number of times the knot is repeated (default: 1 when abscissa is not Infinity, otherwise Infinity) * @throws {RangeError} If multiplicity is less than 1 * @throws {RangeError} If abscissa is less than 1 * * @example * const knot = new Knot(1.5, 2); // Knot at u=1.5 with multiplicity 2 * const knot = new Knot(1.5); // Knot at u=1.5 with multiplicity that defaults to 1 * const knot = new Knot(); // Knot at default value (Infinity) with multiplicity that defaults to Infinity */ constructor(abscissa?: number, multiplicity?: number); /** * Gets the abscissa (position) value of the knot * @returns The abscissa value along the axis of reals */ get abscissa(): number; /** * Gets the multiplicity (number of repetitions) of the knot * @returns The multiplicity value */ get multiplicity(): number; /** * Sets the abscissa (position) value of the knot * @param abscissa - The new abscissa value to set * @throws {RangeError} If abscissa equals DEFAULT_KNOT_ABSCISSA_VALUE */ set abscissa(abscissa: number); /** * Sets the multiplicity (number of repetitions) of the knot * @param multiplicity - The new multiplicity value to set * @throws {RangeError} If multiplicity is less than 1 */ set multiplicity(multiplicity: number); /** * Increases the knot multiplicity by the specified increment * @param increment - The value to increase multiplicity by (default: 1) * @throws {RangeError} If increment is less than 1 */ incrementMultiplicity(increment?: number): void; /** * Decreases the knot multiplicity by the specified decrement * @param decrement - The value to decrease multiplicity by (default: 1) * @throws {RangeError} If decrement is less than 1 or if resulting multiplicity would be less than 1 */ decrementMultiplicity(decrement?: number): void; /** * Throws a RangeError with formatted error message * @param functionName - Name of the function where error occurred * @param message - The error message to display * @throws {RangeError} With formatted error message */ protected throwRangeErrorMessage(functionName: string, message: string): void; } //# sourceMappingURL=Knot.d.ts.map