|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.kdtree.TwoDNode
algs.model.kdtree.HorizontalNode
public class HorizontalNode
Represents a node in the KD-tree that partitions the space by means of a vertical line at the given y-coordinate.
This class is intended as a simpler, optimized implementation of DimensionalNode
for two dimensional KD trees.
Ancestors via the left son are those points which are above the point represented by this node. Ancestors via the right son are those points which are below the point represented by this node.
Field Summary |
---|
Fields inherited from class algs.model.kdtree.TwoDNode |
---|
coord, point |
Constructor Summary | |
---|---|
HorizontalNode(IPoint point)
Y-coordinate is taken from the point. |
Method Summary | |
---|---|
TwoDNode |
construct(IPoint value)
This method constructs the node of the appropriate class based upon the vertical property of this node. |
protected boolean |
inAboveRange(IRectangle r)
Helper method for search algorithm, implemented in the Horizontal and Vertical subclasses. |
protected boolean |
inBelowRange(IRectangle r)
Helper method for search algorithm, implemented in the Horizontal and Vertical subclasses. |
boolean |
isBelow(IPoint point)
Returns whether the point is below the line represented by this node. |
boolean |
isVertical()
Determines whether node splits plane vertically |
protected void |
split(TwoDNode child,
boolean above)
Manipulates child node's region accordingly, based on our own. |
Methods inherited from class algs.model.kdtree.TwoDNode |
---|
getAbove, getBelow, getRegion, search, search, setAbove, setBelow, specialUpdateRectangle, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HorizontalNode(IPoint point)
point
- Point being stored.Method Detail |
---|
public boolean isVertical()
TwoDNode
isVertical
in class TwoDNode
TwoDNode.isVertical()
public TwoDNode construct(IPoint value)
In short, this acts as a factory for the nodes in the next level of the tree.
construct
in class TwoDNode
value
- point to be added to the TwoDTree.
protected void split(TwoDNode child, boolean above)
TwoDNode
For VerticalNode
, below is clear. For HorizontalNode
, a true value
for below is interpreted as being left.
split
in class TwoDNode
child
- child node to be affected by splitabove
- Determines whether to return left- or bottom- sideTwoDNode.split(TwoDNode, boolean)
protected boolean inBelowRange(IRectangle r)
TwoDNode
inBelowRange
in class TwoDNode
r
- query rectangleTwoDNode.inBelowRange(IRectangle)
protected boolean inAboveRange(IRectangle r)
TwoDNode
inAboveRange
in class TwoDNode
r
- query rectangleTwoDNode.inAboveRange(IRectangle)
public boolean isBelow(IPoint point)
TwoDNode
For vertical nodes, below is clear. For horizontal nodes, a true value for below is interpreted as being left.
isBelow
in class TwoDNode
TwoDNode.isBelow(IPoint)
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |