Class Region

java.lang.Object
jmri.jmrix.rps.Region

@Immutable public class Region extends Object
Represent a region in space for the RPS system.

The region is specified by a right-handed set of points.

Regions are immutable once created.

This initial implementation of a Region is inherently 2-dimensional, deferring use of the 3rd (Z) dimension to a later implementation. It uses a Java2D GeneralPath to handle the inside/outside calculations.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) GeneralPath
     
    (package private) final javax.vecmath.Point3d[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ctor from a string like "(0,0,0);(1,0,0);(1,1,0);(0,1,0)" .
    Region(javax.vecmath.Point3d[] points)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Provide Java2D access to the shape of this region.
    int
     
    (package private) void
    initPath(javax.vecmath.Point3d[] points)
     
    boolean
    isInside(javax.vecmath.Point3d p)
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Region

      public Region(javax.vecmath.Point3d[] points)
    • Region

      public Region(String s)
      Ctor from a string like "(0,0,0);(1,0,0);(1,1,0);(0,1,0)" .
      Parameters:
      s - construction string.
  • Method Details

    • getPath

      public Shape getPath()
      Provide Java2D access to the shape of this region.

      This should provide a copy of the GeneralPath path, to keep the underlying object immutable, but by returning a Shape type hopefully we achieve the same result with a little better performance. Please don't assume you can cast and modify this.

      Returns:
      the path.
    • initPath

      void initPath(javax.vecmath.Point3d[] points)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isInside

      public boolean isInside(javax.vecmath.Point3d p)
    • equals

      public boolean equals(Object ro)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object