ontology.physics

## Class GridPhysics

- java.lang.Object
- - ontology.physics.GridPhysics

- All Implemented Interfaces:
    Physics
  Direct Known Subclasses:
    ContinuousPhysics

      public class GridPhysics
      extends java.lang.Object
      implements Physics

  Created with IntelliJ IDEA. User: Diego Date: 17/10/13 Time: 11:21 This is a Java port from Tom Schaul's VGDL - https://github.com/schaul/py-vgdl

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.awt.Dimension` | `gridsize` Size of the grid.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GridPhysics()` Default constructor, gridsize will be 10x10
    `GridPhysics(java.awt.Dimension gridsize)` Constructor of the physics, specifying the gridsize

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activeMovement(VGDLSprite sprite, Vector2d action, double speed)`
    `double` | `distance(java.awt.Rectangle r1, java.awt.Rectangle r2)` Hamming distance between two rectangles.
    `void` | `passiveMovement(VGDLSprite sprite)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### gridsize

          public java.awt.Dimension gridsize

      Size of the grid.

  - ### Constructor Detail

    - #### GridPhysics

          public GridPhysics()

      Default constructor, gridsize will be 10x10

    - #### GridPhysics

          public GridPhysics(java.awt.Dimension gridsize)

      Constructor of the physics, specifying the gridsize
      Parameters:
        `gridsize` - Size of the grid.

  - ### Method Detail

    - #### passiveMovement

          public void passiveMovement(VGDLSprite sprite)

      Specified by:
        `passiveMovement` in interface `Physics`

    - #### activeMovement

          public void activeMovement(VGDLSprite sprite,
                            Vector2d action,
                            double speed)

      Specified by:
        `activeMovement` in interface `Physics`

    - #### distance

          public double distance(java.awt.Rectangle r1,
                        java.awt.Rectangle r2)

      Hamming distance between two rectangles.
      Specified by:
        `distance` in interface `Physics`
      Parameters:
        `r1` - rectangle 1
        `r2` - rectangle 2
      Returns:
        Hamming distance between the top-left corner of the rectangles.