Interface PointTranslator

All Known Subinterfaces:
PointTranslatorDecorator
All Known Implementing Classes:
AbstractPointTranslator, BouncyBorders, InfiniteBorders, StickyBorders, StrictBorders, WrapAroundBorders

public interface PointTranslator
Interface for classes that will translate a point by some specified amount.
Author:
Nick Collier
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    init(Dimensions dimensions)
    Initializes this with the given dimensions.
    boolean
    True if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.
    void
    transform(double[] transformedLocation, double... targetLocation)
    Transform the given targetLocation according to this PointTranslator's semantics.
    void
    transform(NdPoint transformedLocation, double... targetLocation)
    Transform the given targetLocation according to this PointTranslator's semantics.
    void
    translate(double[] location, double... displacement)
    Translate the specified location by the specified displacement.
    void
    translate(NdPoint location, double[] newLocation, double... displacement)
    Translate the specified location by the specified displacement.For example, if the location is (3, 4) and the displacement is (1, -2), the new location will be (4, 2).
  • Method Details

    • init

      void init(Dimensions dimensions)
      Initializes this with the given dimensions.
      Parameters:
      dimensions - the dimensions of the space
    • translate

      void translate(double[] location, double... displacement)
      Translate the specified location by the specified displacement. The new location will stored in the location array. For example, if the location is (3, 4) and the displacement is (1, -2), the new location will be (4, 2).
      Parameters:
      location - the current location
      displacement - the amount to translate
    • translate

      void translate(NdPoint location, double[] newLocation, double... displacement)
      Translate the specified location by the specified displacement.For example, if the location is (3, 4) and the displacement is (1, -2), the new location will be (4, 2). The new location will be copied into the newLocation array.
      Parameters:
      location - the current location
      newLocation - this will hold the newLocation after the method has completed
      displacement - the amount to translate
    • transform

      void transform(double[] transformedLocation, double... targetLocation)
      Transform the given targetLocation according to this PointTranslator's semantics. The new transformed coordinates will be placed in the transformedTargetLocation.
      Parameters:
      transformedLocation - the coordinates once they have been transformed by this GridPointTranslator
      targetLocation - the new target location whose coordinates will be transformed
      Throws:
      SpatialException - if the transform is invalid. For example, if the new location is outside of the grid.
    • transform

      void transform(NdPoint transformedLocation, double... targetLocation)
      Transform the given targetLocation according to this PointTranslator's semantics. The new transformed coordinates will be placed in the transformedTargetLocation.
      Parameters:
      transformedLocation - the coordinates once they have been transformed by this GridPointTranslator
      targetLocation - the new target transformedLocation whose coordinates will be transformed
      Throws:
      SpatialException - if the transform is invalid. For example, if the new transformedLocation is outside of the grid.
    • isPeriodic

      boolean isPeriodic()
      True if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.
      Returns:
      true if this translator is periodic, otherwise false.