Module org.dyn4j

Interface LinearSpringJoint

    • Method Detail

      • setSpringEnabled

        void setSpringEnabled​(boolean enabled)
        Sets whether the spring is enabled or not.
        Parameters:
        enabled - true if the spring should be enabled
      • isSpringEnabled

        boolean isSpringEnabled()
        Returns true if the spring is enabled.
        Returns:
        boolean
      • setSpringDamperEnabled

        void setSpringDamperEnabled​(boolean enabled)
        Sets whether the spring's damper is enabled or not.

        NOTE: for the damper to have any effect, the spring must be enabled.

        Parameters:
        enabled - true if the damper should be enabled
        See Also:
        setSpringEnabled(boolean)
      • isSpringDamperEnabled

        boolean isSpringDamperEnabled()
        Returns true if the damper is enabled for the spring.

        NOTE: for the damper to have any effect, the spring must be enabled.

        Returns:
        boolean
        Since:
        4.0.0
        See Also:
        isSpringEnabled()
      • getSpringDampingRatio

        double getSpringDampingRatio()
        Returns the damping ratio for the spring's damper.
        Returns:
        double
      • setSpringDampingRatio

        void setSpringDampingRatio​(double dampingRatio)
        Sets the damping ratio.

        Larger values reduce the oscillation of the spring.

        Parameters:
        dampingRatio - the damping ratio; in the range (0, 1]
        Throws:
        IllegalArgumentException - if damping ratio is less than or equal to zero or greater than 1
      • getSpringFrequency

        double getSpringFrequency()
        Returns the spring frequency.
        Returns:
        double
      • setSpringFrequency

        void setSpringFrequency​(double frequency)
        Sets the spring frequency.

        Larger values increase the stiffness of the spring.

        Calling this method puts the spring into fixed frequency mode. In this mode, the spring stiffness is computed based on the frequency.

        Parameters:
        frequency - the spring frequency in hz; must be greater than zero
        Throws:
        IllegalArgumentException - if frequency is less than or equal to zero
      • getSpringStiffness

        double getSpringStiffness()
        Returns the spring stiffness.
        Returns:
        double
      • setSpringStiffness

        void setSpringStiffness​(double stiffness)
        Sets the spring stiffness.

        Larger values increase the stiffness of the spring.

        Calling this method puts the spring into fixed stiffness mode. In this mode, the spring frequency is computed based on the stiffness.

        Parameters:
        stiffness - the spring stiffness (k); must be greater than zero
        Throws:
        IllegalArgumentException - if stiffness is less than or equal to zero
      • isMaximumSpringForceEnabled

        boolean isMaximumSpringForceEnabled()
        Returns true if the spring force is limited to the maximum.
        Returns:
        boolean
      • setMaximumSpringForceEnabled

        void setMaximumSpringForceEnabled​(boolean enabled)
        Sets whether the spring force is limited to the maximum.
        Parameters:
        enabled - true if the spring force should be limited
      • getMaximumSpringForce

        double getMaximumSpringForce()
        Returns the maximum spring force that will be applied.
        Returns:
        double
      • setMaximumSpringForce

        void setMaximumSpringForce​(double maximum)
        Sets the maximum force the spring can apply.
        Parameters:
        maximum - the maximum force
        Throws:
        IllegalArgumentException - if maximum is less than or equal to zero
      • getSpringForce

        double getSpringForce​(double invdt)
        Returns the force in netwons applied by the spring in the last timestep.
        Parameters:
        invdt - the inverse delta time
        Returns:
        double