jmri.jmrix.rps
Class Region

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

@Immutable
public class Region
extends Object

Represent a region in space for the RPS system.

The region is specfied 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.

Author:
Bob Jacobsen Copyright (C) 2007, 2008

Constructor Summary
Region(Point3d[] points)
           
Region(String s)
          Ctor from a string like "(0,0,0);(1,0,0);(1,1,0);(0,1,0)"
 
Method Summary
 boolean equals(Object ro)
           
 Shape getPath()
          Provide Java2D access to the shape of this region.
 int hashCode()
           
 boolean isInside(Point3d p)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Region

public Region(Point3d[] points)

Region

public Region(String s)
Ctor from a string like "(0,0,0);(1,0,0);(1,1,0);(0,1,0)"

Method Detail

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.


toString

public String toString()
Overrides:
toString in class Object

isInside

public boolean isInside(Point3d p)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads