@newkrok/nape-js 3.6.0 → 3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1186,13 +1186,13 @@ declare class Constraint {
1186
1186
  * The impulse applied to `body` by this constraint in the last simulation step,
1187
1187
  * expressed as a {@link Vec3} `(fx, fy, torque)`.
1188
1188
  *
1189
- * @param body - Must be one of the bodies linked to this constraint.
1189
+ * @param _body - Must be one of the bodies linked to this constraint.
1190
1190
  */
1191
1191
  bodyImpulse(_body: Body): Vec3 | null;
1192
1192
  /**
1193
1193
  * Invokes `fn` once for each distinct body linked to this constraint.
1194
1194
  *
1195
- * @param fn - Function to call for each body.
1195
+ * @param _fn - Function to call for each body.
1196
1196
  */
1197
1197
  visitBodies(_fn: (body: Body) => void): void;
1198
1198
  /**
@@ -1214,25 +1214,58 @@ declare class Constraint {
1214
1214
  */
1215
1215
  declare class InteractionFilter {
1216
1216
  static __name__: string[];
1217
+ /**
1218
+ * @param collisionGroup - Collision group bits (default 1).
1219
+ * @param collisionMask - Collision mask bits (default -1, all bits set).
1220
+ * @param sensorGroup - Sensor group bits (default 1).
1221
+ * @param sensorMask - Sensor mask bits (default -1, all bits set).
1222
+ * @param fluidGroup - Fluid group bits (default 1).
1223
+ * @param fluidMask - Fluid mask bits (default -1, all bits set).
1224
+ */
1217
1225
  constructor(collisionGroup?: number, collisionMask?: number, sensorGroup?: number, sensorMask?: number, fluidGroup?: number, fluidMask?: number);
1226
+ /** Bit-mask identifying which collision group(s) this shape belongs to. */
1218
1227
  get collisionGroup(): number;
1219
1228
  set collisionGroup(value: number);
1229
+ /** Bit-mask of collision groups this shape will collide with. */
1220
1230
  get collisionMask(): number;
1221
1231
  set collisionMask(value: number);
1232
+ /** Bit-mask identifying which sensor group(s) this shape belongs to. */
1222
1233
  get sensorGroup(): number;
1223
1234
  set sensorGroup(value: number);
1235
+ /** Bit-mask of sensor groups this shape will sense. */
1224
1236
  get sensorMask(): number;
1225
1237
  set sensorMask(value: number);
1238
+ /** Bit-mask identifying which fluid group(s) this shape belongs to. */
1226
1239
  get fluidGroup(): number;
1227
1240
  set fluidGroup(value: number);
1241
+ /** Bit-mask of fluid groups this shape will interact with as a fluid. */
1228
1242
  get fluidMask(): number;
1229
1243
  set fluidMask(value: number);
1244
+ /** Arbitrary user data attached to this filter. */
1230
1245
  get userData(): Record<string, unknown>;
1246
+ /** Read-only list of shapes currently using this filter. */
1231
1247
  get shapes(): any;
1248
+ /**
1249
+ * Test whether two filters allow collision interaction.
1250
+ * @param filter - The other filter to test against.
1251
+ * @returns `true` if the two filters' group/mask bits permit collision.
1252
+ */
1232
1253
  shouldCollide(filter: InteractionFilter): boolean;
1254
+ /**
1255
+ * Test whether two filters allow sensor interaction.
1256
+ * @param filter - The other filter to test against.
1257
+ * @returns `true` if the two filters' group/mask bits permit sensing.
1258
+ */
1233
1259
  shouldSense(filter: InteractionFilter): boolean;
1260
+ /**
1261
+ * Test whether two filters allow fluid interaction.
1262
+ * @param filter - The other filter to test against.
1263
+ * @returns `true` if the two filters' group/mask bits permit fluid interaction.
1264
+ */
1234
1265
  shouldFlow(filter: InteractionFilter): boolean;
1266
+ /** Create a copy of this filter with the same group/mask values. */
1235
1267
  copy(): InteractionFilter;
1268
+ /** Return a hex-formatted string representation of all group/mask pairs. */
1236
1269
  toString(): string;
1237
1270
  }
1238
1271
 
@@ -2550,7 +2583,7 @@ declare class Arbiter {
2550
2583
  * Overridden by {@link CollisionArbiter} and {@link FluidArbiter}.
2551
2584
  *
2552
2585
  * @param body - One of the two interacting bodies, or `null` for the combined impulse.
2553
- * @param freshOnly - When `true`, only count fresh (new) contacts. Default `false`.
2586
+ * @param _freshOnly - When `true`, only count fresh (new) contacts. Default `false`.
2554
2587
  */
2555
2588
  totalImpulse(body?: Body | null, _freshOnly?: boolean): Vec3;
2556
2589
  toString(): string;
@@ -3627,6 +3660,194 @@ declare class PulleyJoint extends Constraint {
3627
3660
  visitBodies(lambda: (body: Body) => void): void;
3628
3661
  }
3629
3662
 
3663
+ /**
3664
+ * ZPP_Constraint — Internal base class for all constraints / joints.
3665
+ *
3666
+ * Manages activation/deactivation, callback types, space integration,
3667
+ * and provides stubs for solver methods overridden by joint subclasses.
3668
+ *
3669
+ * Converted from nape-compiled.js lines 21424–21827.
3670
+ */
3671
+ declare class ZPP_Constraint {
3672
+ static __name__: string[];
3673
+ /**
3674
+ * Namespace references, set by the compiled module after import.
3675
+ * _nape = the `nape` public namespace (for CbTypeIterator in copyto)
3676
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_CbSet, etc.)
3677
+ */
3678
+ static _nape: any;
3679
+ static _zpp: any;
3680
+ outer: any;
3681
+ id: number;
3682
+ userData: any;
3683
+ compound: any;
3684
+ space: any;
3685
+ active: boolean;
3686
+ stiff: boolean;
3687
+ frequency: number;
3688
+ damping: number;
3689
+ maxForce: number;
3690
+ maxError: number;
3691
+ breakUnderForce: boolean;
3692
+ breakUnderError: boolean;
3693
+ removeOnBreak: boolean;
3694
+ component: any;
3695
+ ignore: boolean;
3696
+ __velocity: boolean;
3697
+ cbTypes: any;
3698
+ cbSet: any;
3699
+ wrap_cbTypes: any;
3700
+ pre_dt: number;
3701
+ __class__: any;
3702
+ constructor();
3703
+ /**
3704
+ * Initialise base constraint fields.
3705
+ * Extracted into a separate method because compiled joint subclasses
3706
+ * call `ZPP_Constraint.call(this)` — ES classes can't be invoked that
3707
+ * way, so the compiled wrapper delegates to this method instead.
3708
+ */
3709
+ _initBase(): void;
3710
+ clear(): void;
3711
+ activeBodies(): void;
3712
+ inactiveBodies(): void;
3713
+ clearcache(): void;
3714
+ validate(): void;
3715
+ wake_connected(): void;
3716
+ forest(): void;
3717
+ broken(): void;
3718
+ warmStart(): void;
3719
+ draw(_g: any): void;
3720
+ pair_exists(_id: any, _di: any): boolean;
3721
+ preStep(_dt: number): boolean;
3722
+ applyImpulseVel(): boolean;
3723
+ applyImpulsePos(): boolean;
3724
+ copy(_dict?: any, _todo?: any): any;
3725
+ immutable_midstep(name: string): void;
3726
+ setupcbTypes(): void;
3727
+ immutable_cbTypes(): void;
3728
+ wrap_cbTypes_subber(pcb: any): void;
3729
+ wrap_cbTypes_adder(cb: any): boolean;
3730
+ insert_cbtype(cb: any): void;
3731
+ alloc_cbSet(): void;
3732
+ dealloc_cbSet(): void;
3733
+ activate(): void;
3734
+ deactivate(): void;
3735
+ addedToSpace(): void;
3736
+ removedFromSpace(): void;
3737
+ activeInSpace(): void;
3738
+ inactiveOrOutSpace(): void;
3739
+ wake(): void;
3740
+ copyto(ret: any): void;
3741
+ static _findRoot(comp: any): any;
3742
+ static _unionComponents(a: any, b: any): void;
3743
+ }
3744
+
3745
+ /**
3746
+ * ZPP_UserBody — pairs a body with a reference count for user constraints.
3747
+ *
3748
+ * Converted from nape-compiled.js lines 28038–28054.
3749
+ */
3750
+ declare class ZPP_UserBody {
3751
+ static __name__: string[];
3752
+ cnt: number;
3753
+ body: any;
3754
+ constructor(cnt: number, body: any);
3755
+ }
3756
+
3757
+ /**
3758
+ * ZPP_UserConstraint — Internal N-DOF user-defined constraint with Cholesky decomposition.
3759
+ *
3760
+ * A generic constraint where the user supplies callbacks for effective mass,
3761
+ * velocity/position errors, impulse application, and clamping. The solver
3762
+ * factorises the effective-mass matrix via Cholesky (solve/transform) and
3763
+ * drives the constraint each step through warmStart / applyImpulseVel /
3764
+ * applyImpulsePos.
3765
+ *
3766
+ * Converted from nape-compiled.js lines 27368–28037.
3767
+ */
3768
+
3769
+ declare class ZPP_UserConstraint extends ZPP_Constraint {
3770
+ static __name__: string[];
3771
+ static __super__: typeof ZPP_Constraint;
3772
+ outer_zn: any;
3773
+ bodies: ZPP_UserBody[];
3774
+ dim: number;
3775
+ jAcc: number[];
3776
+ bias: number[];
3777
+ stepped: boolean;
3778
+ L: number[];
3779
+ y: number[];
3780
+ soft: number;
3781
+ gamma: number;
3782
+ velonly: boolean;
3783
+ jMax: number;
3784
+ Keff: number[];
3785
+ vec3: any;
3786
+ J: number[];
3787
+ jOld: number[];
3788
+ __class__: any;
3789
+ constructor(dim: number, velonly: boolean);
3790
+ bindVec2_invalidate(_: any): void;
3791
+ addBody(b: any): void;
3792
+ remBody(b: any): boolean;
3793
+ bodyImpulse(b: any): any;
3794
+ activeBodies(): void;
3795
+ inactiveBodies(): void;
3796
+ copy(_dict: any, _todo: any): any;
3797
+ validate(): void;
3798
+ wake_connected(): void;
3799
+ forest(): void;
3800
+ pair_exists(id: number, di: number): boolean;
3801
+ broken(): void;
3802
+ clearcache(): void;
3803
+ lsq(v: number[]): number;
3804
+ _clamp(v: number[], max: number): void;
3805
+ solve(m: number[]): number[];
3806
+ transform(L: number[], x: number[]): void;
3807
+ preStep(dt: number): boolean;
3808
+ warmStart(): void;
3809
+ applyImpulseVel(): boolean;
3810
+ applyImpulsePos(): boolean;
3811
+ draw(g: any): void;
3812
+ }
3813
+
3814
+ /**
3815
+ * Base class for user-defined N-DOF constraints.
3816
+ *
3817
+ * Fully modernized — uses ZPP_UserConstraint directly (extracted to TypeScript).
3818
+ * Subclass and override the abstract callback methods to define custom constraints.
3819
+ */
3820
+ declare abstract class UserConstraint extends Constraint {
3821
+ zpp_inner: ZPP_UserConstraint;
3822
+ constructor(dimensions: number, velocityOnly?: boolean);
3823
+ __bindVec2(): Vec2;
3824
+ /** Create a copy of this constraint. Must be overridden. */
3825
+ __copy(): UserConstraint;
3826
+ /** Called when the constraint breaks. Optional override. */
3827
+ __broken(): void;
3828
+ /** Called to validate the constraint. Optional override. */
3829
+ __validate(): void;
3830
+ /** Draw debug visualization. Optional override. */
3831
+ __draw(_debug: any): void;
3832
+ /** Prepare the constraint for solving. Optional override. */
3833
+ __prepare(): void;
3834
+ /** Compute positional error. Must be overridden for non-velocity-only constraints. */
3835
+ __position(_err: number[]): void;
3836
+ /** Compute velocity error. Must be overridden. */
3837
+ __velocity(_err: number[]): void;
3838
+ /** Compute effective mass matrix (upper triangle). Must be overridden. */
3839
+ __eff_mass(_eff: number[]): void;
3840
+ /** Clamp accumulated impulse. Optional override. */
3841
+ __clamp(_jAcc: number[]): void;
3842
+ /** Apply impulse to a body. Must be overridden. */
3843
+ __impulse(_imp: number[], _body: Body, _out: any): void;
3844
+ impulse(): MatMN;
3845
+ bodyImpulse(body: Body): Vec3;
3846
+ visitBodies(lambda: (body: Body) => void): void;
3847
+ __invalidate(): void;
3848
+ __registerBody(oldBody: Body | null, newBody: Body | null): Body | null;
3849
+ }
3850
+
3630
3851
  declare const VERSION: string;
3631
3852
 
3632
- export { AABB, AngleJoint, Arbiter, ArbiterType, Body, BodyCallback, BodyListener, BodyType, Broadphase, Callback, CbEvent, CbType, Circle, CollisionArbiter, Compound, Constraint, ConstraintCallback, ConstraintListener, Contact, ConvexResult, DistanceJoint, Edge, FluidArbiter, FluidProperties, Geom, GeomPoly, GravMassMode, InertiaMode, InteractionCallback, InteractionFilter, InteractionGroup, InteractionListener, InteractionType, Interactor, LineJoint, Listener, ListenerType, MarchingSquares, MassMode, Mat23, MatMN, Material, MotorJoint, NapeList, OptionType, PivotJoint, Polygon, PreCallback, PreFlag, PreListener, PulleyJoint, Ray, RayResult, Shape, ShapeType, Space, VERSION, ValidationResult, Vec2, Vec3, WeldJoint, Winding };
3853
+ export { AABB, AngleJoint, Arbiter, ArbiterType, Body, BodyCallback, BodyListener, BodyType, Broadphase, Callback, CbEvent, CbType, type CbTypeSet, Circle, CollisionArbiter, Compound, Constraint, ConstraintCallback, ConstraintListener, Contact, ConvexResult, DistanceJoint, Edge, FluidArbiter, FluidProperties, Geom, GeomPoly, GravMassMode, InertiaMode, InteractionCallback, InteractionFilter, InteractionGroup, InteractionListener, InteractionType, Interactor, LineJoint, Listener, ListenerType, MarchingSquares, MassMode, Mat23, MatMN, Material, MotorJoint, NapeList, OptionType, PivotJoint, Polygon, PreCallback, PreFlag, PreListener, PulleyJoint, Ray, RayResult, Shape, ShapeType, Space, UserConstraint, VERSION, ValidationResult, Vec2, Vec3, WeldJoint, Winding };
package/dist/index.d.ts CHANGED
@@ -1186,13 +1186,13 @@ declare class Constraint {
1186
1186
  * The impulse applied to `body` by this constraint in the last simulation step,
1187
1187
  * expressed as a {@link Vec3} `(fx, fy, torque)`.
1188
1188
  *
1189
- * @param body - Must be one of the bodies linked to this constraint.
1189
+ * @param _body - Must be one of the bodies linked to this constraint.
1190
1190
  */
1191
1191
  bodyImpulse(_body: Body): Vec3 | null;
1192
1192
  /**
1193
1193
  * Invokes `fn` once for each distinct body linked to this constraint.
1194
1194
  *
1195
- * @param fn - Function to call for each body.
1195
+ * @param _fn - Function to call for each body.
1196
1196
  */
1197
1197
  visitBodies(_fn: (body: Body) => void): void;
1198
1198
  /**
@@ -1214,25 +1214,58 @@ declare class Constraint {
1214
1214
  */
1215
1215
  declare class InteractionFilter {
1216
1216
  static __name__: string[];
1217
+ /**
1218
+ * @param collisionGroup - Collision group bits (default 1).
1219
+ * @param collisionMask - Collision mask bits (default -1, all bits set).
1220
+ * @param sensorGroup - Sensor group bits (default 1).
1221
+ * @param sensorMask - Sensor mask bits (default -1, all bits set).
1222
+ * @param fluidGroup - Fluid group bits (default 1).
1223
+ * @param fluidMask - Fluid mask bits (default -1, all bits set).
1224
+ */
1217
1225
  constructor(collisionGroup?: number, collisionMask?: number, sensorGroup?: number, sensorMask?: number, fluidGroup?: number, fluidMask?: number);
1226
+ /** Bit-mask identifying which collision group(s) this shape belongs to. */
1218
1227
  get collisionGroup(): number;
1219
1228
  set collisionGroup(value: number);
1229
+ /** Bit-mask of collision groups this shape will collide with. */
1220
1230
  get collisionMask(): number;
1221
1231
  set collisionMask(value: number);
1232
+ /** Bit-mask identifying which sensor group(s) this shape belongs to. */
1222
1233
  get sensorGroup(): number;
1223
1234
  set sensorGroup(value: number);
1235
+ /** Bit-mask of sensor groups this shape will sense. */
1224
1236
  get sensorMask(): number;
1225
1237
  set sensorMask(value: number);
1238
+ /** Bit-mask identifying which fluid group(s) this shape belongs to. */
1226
1239
  get fluidGroup(): number;
1227
1240
  set fluidGroup(value: number);
1241
+ /** Bit-mask of fluid groups this shape will interact with as a fluid. */
1228
1242
  get fluidMask(): number;
1229
1243
  set fluidMask(value: number);
1244
+ /** Arbitrary user data attached to this filter. */
1230
1245
  get userData(): Record<string, unknown>;
1246
+ /** Read-only list of shapes currently using this filter. */
1231
1247
  get shapes(): any;
1248
+ /**
1249
+ * Test whether two filters allow collision interaction.
1250
+ * @param filter - The other filter to test against.
1251
+ * @returns `true` if the two filters' group/mask bits permit collision.
1252
+ */
1232
1253
  shouldCollide(filter: InteractionFilter): boolean;
1254
+ /**
1255
+ * Test whether two filters allow sensor interaction.
1256
+ * @param filter - The other filter to test against.
1257
+ * @returns `true` if the two filters' group/mask bits permit sensing.
1258
+ */
1233
1259
  shouldSense(filter: InteractionFilter): boolean;
1260
+ /**
1261
+ * Test whether two filters allow fluid interaction.
1262
+ * @param filter - The other filter to test against.
1263
+ * @returns `true` if the two filters' group/mask bits permit fluid interaction.
1264
+ */
1234
1265
  shouldFlow(filter: InteractionFilter): boolean;
1266
+ /** Create a copy of this filter with the same group/mask values. */
1235
1267
  copy(): InteractionFilter;
1268
+ /** Return a hex-formatted string representation of all group/mask pairs. */
1236
1269
  toString(): string;
1237
1270
  }
1238
1271
 
@@ -2550,7 +2583,7 @@ declare class Arbiter {
2550
2583
  * Overridden by {@link CollisionArbiter} and {@link FluidArbiter}.
2551
2584
  *
2552
2585
  * @param body - One of the two interacting bodies, or `null` for the combined impulse.
2553
- * @param freshOnly - When `true`, only count fresh (new) contacts. Default `false`.
2586
+ * @param _freshOnly - When `true`, only count fresh (new) contacts. Default `false`.
2554
2587
  */
2555
2588
  totalImpulse(body?: Body | null, _freshOnly?: boolean): Vec3;
2556
2589
  toString(): string;
@@ -3627,6 +3660,194 @@ declare class PulleyJoint extends Constraint {
3627
3660
  visitBodies(lambda: (body: Body) => void): void;
3628
3661
  }
3629
3662
 
3663
+ /**
3664
+ * ZPP_Constraint — Internal base class for all constraints / joints.
3665
+ *
3666
+ * Manages activation/deactivation, callback types, space integration,
3667
+ * and provides stubs for solver methods overridden by joint subclasses.
3668
+ *
3669
+ * Converted from nape-compiled.js lines 21424–21827.
3670
+ */
3671
+ declare class ZPP_Constraint {
3672
+ static __name__: string[];
3673
+ /**
3674
+ * Namespace references, set by the compiled module after import.
3675
+ * _nape = the `nape` public namespace (for CbTypeIterator in copyto)
3676
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_CbSet, etc.)
3677
+ */
3678
+ static _nape: any;
3679
+ static _zpp: any;
3680
+ outer: any;
3681
+ id: number;
3682
+ userData: any;
3683
+ compound: any;
3684
+ space: any;
3685
+ active: boolean;
3686
+ stiff: boolean;
3687
+ frequency: number;
3688
+ damping: number;
3689
+ maxForce: number;
3690
+ maxError: number;
3691
+ breakUnderForce: boolean;
3692
+ breakUnderError: boolean;
3693
+ removeOnBreak: boolean;
3694
+ component: any;
3695
+ ignore: boolean;
3696
+ __velocity: boolean;
3697
+ cbTypes: any;
3698
+ cbSet: any;
3699
+ wrap_cbTypes: any;
3700
+ pre_dt: number;
3701
+ __class__: any;
3702
+ constructor();
3703
+ /**
3704
+ * Initialise base constraint fields.
3705
+ * Extracted into a separate method because compiled joint subclasses
3706
+ * call `ZPP_Constraint.call(this)` — ES classes can't be invoked that
3707
+ * way, so the compiled wrapper delegates to this method instead.
3708
+ */
3709
+ _initBase(): void;
3710
+ clear(): void;
3711
+ activeBodies(): void;
3712
+ inactiveBodies(): void;
3713
+ clearcache(): void;
3714
+ validate(): void;
3715
+ wake_connected(): void;
3716
+ forest(): void;
3717
+ broken(): void;
3718
+ warmStart(): void;
3719
+ draw(_g: any): void;
3720
+ pair_exists(_id: any, _di: any): boolean;
3721
+ preStep(_dt: number): boolean;
3722
+ applyImpulseVel(): boolean;
3723
+ applyImpulsePos(): boolean;
3724
+ copy(_dict?: any, _todo?: any): any;
3725
+ immutable_midstep(name: string): void;
3726
+ setupcbTypes(): void;
3727
+ immutable_cbTypes(): void;
3728
+ wrap_cbTypes_subber(pcb: any): void;
3729
+ wrap_cbTypes_adder(cb: any): boolean;
3730
+ insert_cbtype(cb: any): void;
3731
+ alloc_cbSet(): void;
3732
+ dealloc_cbSet(): void;
3733
+ activate(): void;
3734
+ deactivate(): void;
3735
+ addedToSpace(): void;
3736
+ removedFromSpace(): void;
3737
+ activeInSpace(): void;
3738
+ inactiveOrOutSpace(): void;
3739
+ wake(): void;
3740
+ copyto(ret: any): void;
3741
+ static _findRoot(comp: any): any;
3742
+ static _unionComponents(a: any, b: any): void;
3743
+ }
3744
+
3745
+ /**
3746
+ * ZPP_UserBody — pairs a body with a reference count for user constraints.
3747
+ *
3748
+ * Converted from nape-compiled.js lines 28038–28054.
3749
+ */
3750
+ declare class ZPP_UserBody {
3751
+ static __name__: string[];
3752
+ cnt: number;
3753
+ body: any;
3754
+ constructor(cnt: number, body: any);
3755
+ }
3756
+
3757
+ /**
3758
+ * ZPP_UserConstraint — Internal N-DOF user-defined constraint with Cholesky decomposition.
3759
+ *
3760
+ * A generic constraint where the user supplies callbacks for effective mass,
3761
+ * velocity/position errors, impulse application, and clamping. The solver
3762
+ * factorises the effective-mass matrix via Cholesky (solve/transform) and
3763
+ * drives the constraint each step through warmStart / applyImpulseVel /
3764
+ * applyImpulsePos.
3765
+ *
3766
+ * Converted from nape-compiled.js lines 27368–28037.
3767
+ */
3768
+
3769
+ declare class ZPP_UserConstraint extends ZPP_Constraint {
3770
+ static __name__: string[];
3771
+ static __super__: typeof ZPP_Constraint;
3772
+ outer_zn: any;
3773
+ bodies: ZPP_UserBody[];
3774
+ dim: number;
3775
+ jAcc: number[];
3776
+ bias: number[];
3777
+ stepped: boolean;
3778
+ L: number[];
3779
+ y: number[];
3780
+ soft: number;
3781
+ gamma: number;
3782
+ velonly: boolean;
3783
+ jMax: number;
3784
+ Keff: number[];
3785
+ vec3: any;
3786
+ J: number[];
3787
+ jOld: number[];
3788
+ __class__: any;
3789
+ constructor(dim: number, velonly: boolean);
3790
+ bindVec2_invalidate(_: any): void;
3791
+ addBody(b: any): void;
3792
+ remBody(b: any): boolean;
3793
+ bodyImpulse(b: any): any;
3794
+ activeBodies(): void;
3795
+ inactiveBodies(): void;
3796
+ copy(_dict: any, _todo: any): any;
3797
+ validate(): void;
3798
+ wake_connected(): void;
3799
+ forest(): void;
3800
+ pair_exists(id: number, di: number): boolean;
3801
+ broken(): void;
3802
+ clearcache(): void;
3803
+ lsq(v: number[]): number;
3804
+ _clamp(v: number[], max: number): void;
3805
+ solve(m: number[]): number[];
3806
+ transform(L: number[], x: number[]): void;
3807
+ preStep(dt: number): boolean;
3808
+ warmStart(): void;
3809
+ applyImpulseVel(): boolean;
3810
+ applyImpulsePos(): boolean;
3811
+ draw(g: any): void;
3812
+ }
3813
+
3814
+ /**
3815
+ * Base class for user-defined N-DOF constraints.
3816
+ *
3817
+ * Fully modernized — uses ZPP_UserConstraint directly (extracted to TypeScript).
3818
+ * Subclass and override the abstract callback methods to define custom constraints.
3819
+ */
3820
+ declare abstract class UserConstraint extends Constraint {
3821
+ zpp_inner: ZPP_UserConstraint;
3822
+ constructor(dimensions: number, velocityOnly?: boolean);
3823
+ __bindVec2(): Vec2;
3824
+ /** Create a copy of this constraint. Must be overridden. */
3825
+ __copy(): UserConstraint;
3826
+ /** Called when the constraint breaks. Optional override. */
3827
+ __broken(): void;
3828
+ /** Called to validate the constraint. Optional override. */
3829
+ __validate(): void;
3830
+ /** Draw debug visualization. Optional override. */
3831
+ __draw(_debug: any): void;
3832
+ /** Prepare the constraint for solving. Optional override. */
3833
+ __prepare(): void;
3834
+ /** Compute positional error. Must be overridden for non-velocity-only constraints. */
3835
+ __position(_err: number[]): void;
3836
+ /** Compute velocity error. Must be overridden. */
3837
+ __velocity(_err: number[]): void;
3838
+ /** Compute effective mass matrix (upper triangle). Must be overridden. */
3839
+ __eff_mass(_eff: number[]): void;
3840
+ /** Clamp accumulated impulse. Optional override. */
3841
+ __clamp(_jAcc: number[]): void;
3842
+ /** Apply impulse to a body. Must be overridden. */
3843
+ __impulse(_imp: number[], _body: Body, _out: any): void;
3844
+ impulse(): MatMN;
3845
+ bodyImpulse(body: Body): Vec3;
3846
+ visitBodies(lambda: (body: Body) => void): void;
3847
+ __invalidate(): void;
3848
+ __registerBody(oldBody: Body | null, newBody: Body | null): Body | null;
3849
+ }
3850
+
3630
3851
  declare const VERSION: string;
3631
3852
 
3632
- export { AABB, AngleJoint, Arbiter, ArbiterType, Body, BodyCallback, BodyListener, BodyType, Broadphase, Callback, CbEvent, CbType, Circle, CollisionArbiter, Compound, Constraint, ConstraintCallback, ConstraintListener, Contact, ConvexResult, DistanceJoint, Edge, FluidArbiter, FluidProperties, Geom, GeomPoly, GravMassMode, InertiaMode, InteractionCallback, InteractionFilter, InteractionGroup, InteractionListener, InteractionType, Interactor, LineJoint, Listener, ListenerType, MarchingSquares, MassMode, Mat23, MatMN, Material, MotorJoint, NapeList, OptionType, PivotJoint, Polygon, PreCallback, PreFlag, PreListener, PulleyJoint, Ray, RayResult, Shape, ShapeType, Space, VERSION, ValidationResult, Vec2, Vec3, WeldJoint, Winding };
3853
+ export { AABB, AngleJoint, Arbiter, ArbiterType, Body, BodyCallback, BodyListener, BodyType, Broadphase, Callback, CbEvent, CbType, type CbTypeSet, Circle, CollisionArbiter, Compound, Constraint, ConstraintCallback, ConstraintListener, Contact, ConvexResult, DistanceJoint, Edge, FluidArbiter, FluidProperties, Geom, GeomPoly, GravMassMode, InertiaMode, InteractionCallback, InteractionFilter, InteractionGroup, InteractionListener, InteractionType, Interactor, LineJoint, Listener, ListenerType, MarchingSquares, MassMode, Mat23, MatMN, Material, MotorJoint, NapeList, OptionType, PivotJoint, Polygon, PreCallback, PreFlag, PreListener, PulleyJoint, Ray, RayResult, Shape, ShapeType, Space, UserConstraint, VERSION, ValidationResult, Vec2, Vec3, WeldJoint, Winding };