Class SimpleMBR

  • All Implemented Interfaces:
    Serializable, MBR

    public class SimpleMBR
    extends Object
    implements MBR
    An implementation of MBRND that keeps a double array with the max and min values

    Please note that you should not normally use this class when PRTree wants a MBR since this will actually use a lot of extra memory.

    See Also:
    Serialized Form
    • Constructor Detail

      • SimpleMBR

        public SimpleMBR​(double... values)
        Create a new SimpleMBR using the given double values for max and min. Note that the values should be stored as min, max, min, max.
        Parameters:
        values - the min and max values for each dimension.
      • SimpleMBR

        public SimpleMBR​(T t,
                         MBRConverter<T> converter)
        Create a new SimpleMBR from a given object and a MBRConverter
        Type Parameters:
        T - The type of object being indexed
        Parameters:
        t - the object to create the bounding box for
        converter - the actual MBRConverter to use
    • Method Detail

      • getDimensions

        public int getDimensions()
        Specified by:
        getDimensions in interface MBR
        Returns:
        the number of dimensions this bounding box has
      • getMin

        public double getMin​(int axis)
        Description copied from interface: MBR
        Get the minimum value for the given axis
        Specified by:
        getMin in interface MBR
        Parameters:
        axis - the axis to use
        Returns:
        the min value
      • getMax

        public double getMax​(int axis)
        Description copied from interface: MBR
        Get the maximum value for the given axis
        Specified by:
        getMax in interface MBR
        Parameters:
        axis - the axis to use
        Returns:
        the x max value
      • union

        public MBR union​(MBR mbr)
        Description copied from interface: MBR
        Return a new MBR that is the union of this mbr and the other
        Specified by:
        union in interface MBR
        Parameters:
        mbr - the MBR to create a union with
        Returns:
        the new MBR
      • intersects

        public boolean intersects​(MBR other)
        Description copied from interface: MBR
        Check if the other MBR intersects this one
        Specified by:
        intersects in interface MBR
        Parameters:
        other - the MBR to check against
        Returns:
        true if the given MBR intersects with this MBR
      • intersects

        public <T> boolean intersects​(T t,
                                      MBRConverter<T> converter)
        Description copied from interface: MBR
        Check if this MBR intersects the rectangle given by the object and the MBRConverter.
        Specified by:
        intersects in interface MBR
        Type Parameters:
        T - the object type
        Parameters:
        t - a rectangular object
        converter - the MBRConverter
        Returns:
        true if the given MBR intersects with the given object