Package jsim.forces

Class DragForce

java.lang.Object
jsim.forces.DragForce
All Implemented Interfaces:
ForceGenerator

public final class DragForce extends Object implements ForceGenerator
Velocity-proportional linear drag applied to a single body.

Models aerodynamic drag as F_drag = −b · v (linear model). For a more accurate quadratic model (F ∝ v²), extend this class or write a custom ForceGenerator.

Angular drag is applied similarly: τ_drag = −b_rot · ω.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DragForce(RigidBody body, double linearDamping, double angularDamping)
    Create a drag force applied to the given body.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(double dt)
    Apply forces/torques to whichever bodies this generator influences.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DragForce

      public DragForce(RigidBody body, double linearDamping, double angularDamping)
      Create a drag force applied to the given body.
      Parameters:
      body - the body to damp
      linearDamping - linear drag coefficient (N·s/m)
      angularDamping - rotational drag coefficient (N·m·s/rad)
  • Method Details

    • apply

      public void apply(double dt)
      Description copied from interface: ForceGenerator
      Apply forces/torques to whichever bodies this generator influences.
      Specified by:
      apply in interface ForceGenerator
      Parameters:
      dt - the fixed simulation timestep in seconds