Module org.dyn4j

Class Penetration


  • public class Penetration
    extends java.lang.Object
    Represents a Penetration of one Convex Shape into another.

    The penetration normal should always be a normalized vector that points from the first Convex Shape to the second.

    Since:
    1.0.0
    Version:
    3.0.2
    Author:
    William Bittle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double depth
      The penetration amount on this axis
      protected Vector2 normal
      The normalized axis of projection
    • Constructor Summary

      Constructors 
      Constructor Description
      Penetration()
      Default constructor.
      Penetration​(Vector2 normal, double depth)
      Full constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears the penetration information.
      double getDepth()
      Returns the penetration depth.
      Vector2 getNormal()
      Returns the penetration normal.
      void setDepth​(double depth)
      Sets the penetration depth.
      void setNormal​(Vector2 normal)
      Sets the penetration normal.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • normal

        protected Vector2 normal
        The normalized axis of projection
      • depth

        protected double depth
        The penetration amount on this axis
    • Constructor Detail

      • Penetration

        public Penetration()
        Default constructor.
      • Penetration

        public Penetration​(Vector2 normal,
                           double depth)
        Full constructor.
        Parameters:
        normal - the penetration normal from Convex1 to Convex2
        depth - the penetration depth
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • clear

        public void clear()
        Clears the penetration information.
      • getNormal

        public Vector2 getNormal()
        Returns the penetration normal.
        Returns:
        Vector2
      • getDepth

        public double getDepth()
        Returns the penetration depth.
        Returns:
        double
      • setNormal

        public void setNormal​(Vector2 normal)
        Sets the penetration normal.

        Must be normalized.

        Parameters:
        normal - the penetration normal
      • setDepth

        public void setDepth​(double depth)
        Sets the penetration depth.
        Parameters:
        depth - the penetration depth