UNPKG

constraint-solver-js

Version:

2D rigid body constraint solver written in typescript.

35 lines (34 loc) 1.08 kB
import { Matrix } from "mathjs"; import { SolverSolution } from "./solver-solution.js"; export declare class Solver { /** * Minimum error to stop solver */ private stopError; /** * Maximum number of iterations to stop solver */ private maxIterations; /** * Solver timeout (in ms) */ private timeOut; /** * Numerical differentiation delta */ private delta; private diff; /** * Solver constructor * @param stopError - Minimum error to stop solver. * @param maxIterations - Maximum number of iterations to stop solver. * @param timeOut - Solver timeout (in ms) * @param delta Numerical differentiation delta. */ constructor(stopError?: number, maxIterations?: number, timeOut?: number, delta?: number); solve(f: (x: Matrix) => Matrix, x: Matrix): SolverSolution; solveUnderdetermined(f: (x: Matrix) => Matrix, x: Matrix): SolverSolution; solveDetermined(f: (x: Matrix) => Matrix, x: Matrix): SolverSolution; private selectIndices; private sumRows; }