Module org.dyn4j

Interface Joint<T extends PhysicsBody>

    • Field Detail

      • SPRING_MODE_FREQUENCY

        static final int SPRING_MODE_FREQUENCY
        Mode indicating that the current frequency should be used to calculate the spring stiffness
        See Also:
        Constant Field Values
      • SPRING_MODE_STIFFNESS

        static final int SPRING_MODE_STIFFNESS
        Mode indicating that the current stiffness should be used to calculate the spring frequency
        See Also:
        Constant Field Values
    • Method Detail

      • getBodies

        List<T> getBodies()
        Returns an unmodifiable list of bodies involved in this joint.
        Returns:
        List<T>
      • getBodyCount

        int getBodyCount()
        Returns the number of bodies involved in this joint.
        Returns:
        int
      • getBody

        T getBody​(int index)
        Returns the body at the given index.
        Parameters:
        index - the index
        Returns:
        T
        Throws:
        IndexOutOfBoundsException - when index is greater than or equal to getBodyCount()
      • getBodyIterator

        Iterator<T> getBodyIterator()
        Returns an iterator for the bodies involved in this joint.

        NOTE: The iterator is read-only and will throw if methods like remove are used.

        Returns:
        Iterator<T>
      • isMember

        boolean isMember​(CollisionBody<?> body)
        Returns true if the given body is a member of this joint.
        Parameters:
        body - the body
        Returns:
        boolean
      • initializeConstraints

        void initializeConstraints​(TimeStep step,
                                   Settings settings)
        Performs any initialization of the velocity and position constraints.
        Parameters:
        step - the time step information
        settings - the current world settings
      • solveVelocityConstraints

        void solveVelocityConstraints​(TimeStep step,
                                      Settings settings)
        Solves the velocity constraints.
        Parameters:
        step - the time step information
        settings - the current world settings
      • solvePositionConstraints

        boolean solvePositionConstraints​(TimeStep step,
                                         Settings settings)
        Solves the position constraints.
        Parameters:
        step - the time step information
        settings - the current world settings
        Returns:
        boolean true if the position constraints were solved
      • getReactionForce

        Vector2 getReactionForce​(double invdt)
        Returns the force applied to the PhysicsBodys in order to satisfy the constraint in newtons.
        Parameters:
        invdt - the inverse delta time
        Returns:
        Vector2
      • getReactionTorque

        double getReactionTorque​(double invdt)
        Returns the torque applied to the PhysicsBodys in order to satisfy the constraint in newton-meters.
        Parameters:
        invdt - the inverse delta time
        Returns:
        double
      • isEnabled

        boolean isEnabled()
        Returns true if this Joint is enabled.

        A joint is only enabled if all joined PhysicsBodys are enabled.

        Returns:
        boolean
      • isCollisionAllowed

        boolean isCollisionAllowed()
        Returns true if collision between the joined PhysicsBodys is allowed.
        Returns:
        boolean
      • setCollisionAllowed

        void setCollisionAllowed​(boolean flag)
        Sets whether collision is allowed between the joined PhysicsBodys.
        Parameters:
        flag - true if collisions are allowed