mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
39 lines
539 B
TypeScript
39 lines
539 B
TypeScript
import {Param} from "../shapes/param";
|
|
|
|
export class SolverParam {
|
|
|
|
value: number;
|
|
objectParam: Param;
|
|
constant: boolean;
|
|
|
|
/**
|
|
* Jacobian position
|
|
*/
|
|
j: number;
|
|
|
|
constructor(value, objectParam) {
|
|
this.reset(value);
|
|
this.objectParam = objectParam;
|
|
}
|
|
|
|
reset(value) {
|
|
this.set(value);
|
|
this.constant = false;
|
|
this.j = -1;
|
|
}
|
|
|
|
set(value) {
|
|
if (this.constant) return;
|
|
this.value = value;
|
|
}
|
|
|
|
get() {
|
|
return this.value;
|
|
}
|
|
|
|
rollback() {
|
|
this.set(this.objectParam.get());
|
|
}
|
|
|
|
}
|
|
|