|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--Geometry.Region
Defines a named zone of a two-dimensional footprint (e.g., front, back) to be associated around an ObjectInference in the Reasoner and a Toy in the Sandbox. A topology is automatically generated to produce random numbers based on a bell distribution over the geometry of the region.
Slice,
RegionBounds,
Topology| Field Summary | |
static float |
DEFAULT_HORIZON
|
private boolean |
m_is_committed
|
private boolean |
m_is_front_oriented_otherwise_north
|
private int[][] |
m_region
|
private RegionBounds |
m_region_bounds
|
private float |
m_region_horizon
|
private java.lang.String |
m_region_name
|
private Topology |
m_topology
|
static char |
MODE_ADD
|
static char |
MODE_INTERSECT
|
static char |
MODE_SUBTRACT
|
static int |
NUM_RINGS
|
static int |
NUM_SECTORS
|
static float |
REGION_SECTOR_AZIMUTH_STEP
|
static float |
TOPOLOGY_SECTOR_AZIMUTH_STEP
|
| Constructor Summary | |
Region(java.lang.String name)
Creates a new, empty Region, which is a collection of occupied cells in a projection composed of rings and sectors. |
|
Region(java.lang.String name,
java.lang.String slice_definitions)
Creates a new Region, which is a collection of the specified cells in a projection composed of rings and sectors. |
|
| Method Summary | |
void |
addSlice(Slice slice)
Adds a Slice to this region. |
void |
addSlice(Slice slice,
char mode)
Adds a Slice according to a logical mode. |
void |
addSlices(java.lang.String slice_definitions)
Adds a set of Slices to this region according to logical modes. |
void |
clear()
Clears all occupied cells in the region. |
Region |
commit(float distribution_decay_rate,
float horizon,
boolean is_front_oriented)
Completes the transaction of adding slices to this region and results in the creation and population of the random topology based on the geometry. |
protected void |
commit(Region region1,
Region region2,
float horizon,
boolean is_front_oriented)
Performs the same action as commit(float, float), but on a new region created from the logical join of two existing regions with defined topologies. |
boolean |
containsPosition(ObjectInference object_inference,
Position position)
Returns whether a position is within this region. |
private void |
determineRegionBounds()
Calculates the outermost volume a region occupies in terms of a start and end value for its rings and sectors. |
RegionBounds |
getBounds()
Returns the outermost volume a region occupies in terms of a start and end value for its rings and sectors. |
float |
getHorizon()
Returns how far this region extends across the world. |
Position |
getInverseRandomPosition(ObjectInference source_object_inference,
ObjectInference target_object_inference)
Returns a random position within the region. |
Region |
getLogicalEquivalence(Region region)
Returns the equivalence (exclusive OR) of two regions and their topologies. |
Region |
getLogicalIntersection(Region region)
Returns the intersection of two regions and their topologies. |
Region |
getLogicalUnion(Region region)
Returns the union of two regions and their topologies. |
java.lang.String |
getName()
Returns the name of this region. |
static int |
getNextSector(int sector)
Returns the next geometry sector number. |
static RegionCoordinate |
getPolarFromCartesian(double x,
double y)
Returns a polar coordinate from a cartesian one. |
static int |
getPreviousSector(int sector)
Returns the previous geometry sector number. |
Position |
getRandomPosition(ObjectInference object_inference)
Returns a random position within the region. |
Topology |
getTopology()
Returns the topology of the region. |
RegionCoordinate |
getTranslatedCoordinate(Position position,
ObjectInference object_inference)
Returns the ring and sector best corresponding to a position. |
Position |
getTranslatedPosition(RegionCoordinate topology_coordinate,
ObjectInference object_inference,
boolean use_topology_otherwise_geometry_coordinates,
boolean is_offset)
Returns the position corresponding to a ring and sector. |
boolean |
isCellOccupied(int ring,
int sector)
Returns whether a cell is occupied within the projection. |
boolean |
isFrontOriented()
Gets the region orientation, which forces the first sector always to point toward either the front of the object this region is associated with or toward north. |
boolean |
isValidCoordinate(float ring,
float sector)
Returns whether a cell is part of a valid projection. |
boolean |
isValidCoordinate(RegionCoordinate coordinate)
Returns whether a cell is part of a valid projection. |
boolean |
overlapsRegion(ObjectInference object_inference1,
ObjectInference object_inference2,
Region region2)
Returns whether a region overlaps this region. |
protected void |
setCellOccupied(int ring,
int sector)
Sets whether a cell is occupied within the projection. |
java.lang.String |
toString()
Returns a string representation of this object. |
java.lang.String |
toString(boolean list_cells)
Returns a string representation of this object. |
private void |
verifyIsCommitted()
Verifies that a commit has been performed on the region to prevent inappropriate access to certain methods. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int NUM_RINGS
public static final int NUM_SECTORS
public static final char MODE_ADD
public static final char MODE_SUBTRACT
public static final char MODE_INTERSECT
public static final float REGION_SECTOR_AZIMUTH_STEP
public static final float TOPOLOGY_SECTOR_AZIMUTH_STEP
public static final float DEFAULT_HORIZON
private float m_region_horizon
private java.lang.String m_region_name
private Topology m_topology
private int[][] m_region
private boolean m_is_committed
private RegionBounds m_region_bounds
private boolean m_is_front_oriented_otherwise_north
| Constructor Detail |
public Region(java.lang.String name)
Note: due to assumptions in the way the random topology is inferred, only continuous wedge-shaped and toroidal regions are supported fully. Other shapes will produce valid regions, but the topology will be incorrect. See Topology.createDistribution() for details.
name - - the region nameaddSlice(Geometry.Slice),
addSlices(java.lang.String)
public Region(java.lang.String name,
java.lang.String slice_definitions)
throws java.lang.Exception
name - - the region nameslice_definitions - - the mode-delimited slice definitions
java.lang.Exception - - if any slice cannot be addedSlice,
addSlices(java.lang.String)| Method Detail |
public void addSlice(Slice slice)
throws java.lang.Exception
slice - - the slice
java.lang.Exception - - if the slice cannot be added
public void addSlices(java.lang.String slice_definitions)
throws java.lang.Exception
+ = Add slice (union) - = Subtract slice (difference) ^ = Intersect sliceA space delimiter is also treated as an add.
The expression is parsed in left-associative manner.
slice_definitions - - the set of slices; e.g., a14a03hh^b15c02hh+d16e01hh
java.lang.Exception - - if any of the slice definitions is invalidSlice
public void addSlice(Slice slice,
char mode)
throws java.lang.Exception
slice - - the slicemode - - the mode
java.lang.Exception - - if the mode is invalidMODE_ADD,
MODE_SUBTRACT,
MODE_INTERSECTpublic void clear()
public Region commit(float distribution_decay_rate,
float horizon,
boolean is_front_oriented)
Many Region methods are unavailable until this is called. No slices can be added afterwards.
distribution_decay_rate - - the slope adjustment for automatically calculating probability distributionshorizon - - how far this region extends across the worldis_front_oriented - - whether the first sector always to point toward the front of the object this region is
associated with or toward north
Topology.Topology(Geometry.Region, Geometry.Topology, Geometry.Topology),
isFrontOriented()
protected void commit(Region region1,
Region region2,
float horizon,
boolean is_front_oriented)
region1 - - the first region contributing to the joinregion2 - - the second region contributing to the joinhorizon - - how far this region extends across the worldis_front_oriented - - whether the first sector always to point toward the front of the object this region is
associated with or toward northgetLogicalIntersection(Geometry.Region),
getLogicalUnion(Geometry.Region),
getLogicalEquivalence(Geometry.Region),
isFrontOriented()
public boolean containsPosition(ObjectInference object_inference,
Position position)
This method is not available until commit() is called.
object_inference - - the object the region is associated withposition - - the position
private void determineRegionBounds()
This method is not available until commit() is called.
public RegionBounds getBounds()
This method is not available until commit() is called.
public float getHorizon()
public Position getInverseRandomPosition(ObjectInference source_object_inference,
ObjectInference target_object_inference)
This method is not available until commit() is called.
source_object_inference - - the source object inference with unknown positiontarget_object_inference - - the target object inference with known position
getRandomPosition(Reasoner.ObjectInference)public Region getLogicalEquivalence(Region region)
This method is not available until commit() is called.
region - - the region
getLogicalIntersection(Geometry.Region),
getLogicalUnion(Geometry.Region)public Region getLogicalIntersection(Region region)
This method is not available until commit() is called.
region - - the region
getLogicalEquivalence(Geometry.Region),
getLogicalUnion(Geometry.Region)public Region getLogicalUnion(Region region)
This method is not available until commit() is called.
region - - the region
getLogicalIntersection(Geometry.Region),
getLogicalUnion(Geometry.Region)public java.lang.String getName()
public static int getNextSector(int sector)
sector - - the sector
public static RegionCoordinate getPolarFromCartesian(double x,
double y)
x - - the x coordinatey - - the y coordinate
public static int getPreviousSector(int sector)
sector - - the sector
public Position getRandomPosition(ObjectInference object_inference)
This method is not available until commit() is called.
object_inference - - the object the region is associated with
getInverseRandomPosition(Reasoner.ObjectInference, Reasoner.ObjectInference)public Topology getTopology()
This method is not available until commit() is called.
public RegionCoordinate getTranslatedCoordinate(Position position,
ObjectInference object_inference)
position - - the positionobject_inference - - the object the region is associated with
getTranslatedPosition(Geometry.RegionCoordinate, Reasoner.ObjectInference, boolean, boolean)
public Position getTranslatedPosition(RegionCoordinate topology_coordinate,
ObjectInference object_inference,
boolean use_topology_otherwise_geometry_coordinates,
boolean is_offset)
topology_coordinate - - the ring and sector from the topologyobject_inference - - the object the region is associated withuse_topology_otherwise_geometry_coordinates - - which coordinate system to useis_offset - - whether to offset the returned position by half a topology cell for
better alignment in a topology mesh
getTranslatedCoordinate(Renderer.Position, Reasoner.ObjectInference)
public boolean isCellOccupied(int ring,
int sector)
This method is not available until commit() is called.
ring - - the ring of the cell to checksector - - the sector of the cell to check
public boolean isFrontOriented()
public boolean isValidCoordinate(float ring,
float sector)
ring - - the ring to checksector - - the sector to check
public boolean isValidCoordinate(RegionCoordinate coordinate)
coordinate - - the coordinate to check
public boolean overlapsRegion(ObjectInference object_inference1,
ObjectInference object_inference2,
Region region2)
This method is not available until commit() is called.
object_inference1 - - the object inference this region is associated withobject_inference2 - - the object inference region2 is associated withregion2 - - the region to check against this one
protected void setCellOccupied(int ring,
int sector)
ring - - the ring of the cell to occupysector - - the sector of the cell to occupypublic java.lang.String toString()
toString in class java.lang.ObjectSupport.toPrettyString(java.lang.String),
toString(boolean)public java.lang.String toString(boolean list_cells)
list_cells - - whether each cell should be listed
Support.toPrettyString(java.lang.String)private void verifyIsCommitted()
commit(float, float, boolean)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||