Class Boundary

java.lang.Object
com.JayPi4c.NeuroEvolution.plugins.util.Boundary

public class Boundary extends Object
Class to represent a boundary on the track. Boundaries can be deadly walls, that restrict the area of the track. But they can also be used as checkpoints.
Author:
JayPi4c
  • Constructor Details

    • Boundary

      public Boundary(double x1, double y1, double x2, double y2)
      Creates a new Boundary as a line from (x1, y1) to (x2, y2).
      Parameters:
      x1 - first point x
      y1 - first point y
      x2 - second point x
      y2 - second point y
    • Boundary

      public Boundary(PVector a, PVector b)
      Creates a new Boundary as a line from a to b.
      Parameters:
      a - first point
      b - second point
  • Method Details

    • midPoint

      public PVector midPoint()
      Calculats the middle point of the boundary.
      Returns:
      the middle point
    • createBoundaries

      public static List<Boundary> createBoundaries(List<PVector> points, boolean closed)
      Creates a list of Boundaries from a list of points. The points in the list will be sequentially connected, so the order of the points is important. If the closed flag is set to true, the last point will be connected to the first point.
      Parameters:
      points - the list of points
      closed - whether the list is closed
      Returns:
      the list of connected Boundaries
    • getA

      public PVector getA()
      Getter for the first point.
      Returns:
      the first point
    • getB

      public PVector getB()
      Getter for the second point.
      Returns:
      the second point