Module org.dyn4j

Class Containment

  • All Implemented Interfaces:
    Copyable<Containment>

    public class Containment
    extends Object
    implements Copyable<Containment>
    Represents the Containment of one Convex shape in another.

    Since the containment test is pair-wise, we can detect whether A is contained by B or B is contained by A in the same detection cycle.
    NOTE: The first shape in the detection test is considered A and the second shape is B.

    Since:
    4.2.1
    Version:
    4.2.1
    Author:
    William Bittle
    • Field Detail

      • aContainedInB

        protected boolean aContainedInB
        True if A is contained in B
      • bContainedInA

        protected boolean bContainedInA
        True if B is contained in A
    • Constructor Detail

      • Containment

        public Containment()
        Default constructor.
      • Containment

        protected Containment​(boolean aContainedInB,
                              boolean bContainedInA)
        Full constructor.
        Parameters:
        aContainedInB - true if A is contained in B
        bContainedInA - true if B is contained in A
    • Method Detail

      • clear

        public void clear()
        Clears the separation information.
      • copy

        public void copy​(Containment containment)
        Copies (deep) the given Containment information to this Containment.
        Parameters:
        containment - the containment to copy
      • isAContainedInB

        public boolean isAContainedInB()
        Returns true if A is contained in B.
        Returns:
        boolean
      • setAContainedInB

        public void setAContainedInB​(boolean flag)
        Sets if A is contained in B.
        Parameters:
        flag - true if A is contained in B
      • isBContainedInA

        public boolean isBContainedInA()
        Returns true if B is contained in A.
        Returns:
        boolean
      • setBContainedInA

        public void setBContainedInA​(boolean flag)
        Sets if B is contained in A.
        Parameters:
        flag - true if B is contained in A