Class CollisionGridUtil

java.lang.Object
com.fs.starfarer.api.util.CollisionGridUtil
All Implemented Interfaces:
CollisionGridAPI

public class CollisionGridUtil extends Object implements CollisionGridAPI
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected int
     
    protected List<Object>[][]
     
    protected float
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CollisionGridUtil(float minX, float maxX, float minY, float maxY, float cellSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addObject(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight)
    Adds the object to every bucket that the area overlaps.
    protected void
    addToBucket(int cellX, int cellY, Object object)
     
    getCheckIterator(org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight)
    Returns an iterator for all the objects in this grid that are in the specified area.
    protected void
    removeFromBucket(int cellX, int cellY, Object object)
     
    void
    removeObject(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight)
    Removes the object from every bucket that the area overlaps.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • cellSize

      protected float cellSize
    • buckets

      protected List<Object>[][] buckets
    • width

      protected int width
    • height

      protected int height
    • leftOf

      protected int leftOf
    • rightOf

      protected int rightOf
    • below

      protected int below
    • above

      protected int above
  • Constructor Details

    • CollisionGridUtil

      public CollisionGridUtil(float minX, float maxX, float minY, float maxY, float cellSize)
  • Method Details

    • addObject

      public void addObject(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight)
      Description copied from interface: CollisionGridAPI
      Adds the object to every bucket that the area overlaps.
      Specified by:
      addObject in interface CollisionGridAPI
    • removeObject

      public void removeObject(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight)
      Description copied from interface: CollisionGridAPI
      Removes the object from every bucket that the area overlaps.
      Specified by:
      removeObject in interface CollisionGridAPI
    • addToBucket

      protected void addToBucket(int cellX, int cellY, Object object)
    • removeFromBucket

      protected void removeFromBucket(int cellX, int cellY, Object object)
    • getCheckIterator

      public Iterator<Object> getCheckIterator(org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight)
      Description copied from interface: CollisionGridAPI
      Returns an iterator for all the objects in this grid that are in the specified area.
      Specified by:
      getCheckIterator in interface CollisionGridAPI
      Returns: