public class WeightedClosestCorner extends java.lang.Object implements Algorithm
Constructor and Description |
---|
WeightedClosestCorner() |
Modifier and Type | Method and Description |
---|---|
private double |
centerSideDistance(Direction dir,
Bounds cur,
Bounds tgt)
Computes the side distance from current center to target center.
|
private int |
compare1D(Bounds a,
Bounds b) |
private int |
compare1D(Bounds a,
Bounds b,
Direction dir) |
private double |
cornerSideDistance(Direction dir,
Bounds cur,
Bounds tgt)
Computes the side distance between the closest corners of the current
and target.
|
private boolean |
isOnAxis(Direction dir,
Bounds cur,
Bounds tgt) |
private double |
outDistance(Direction dir,
Bounds cur,
Bounds tgt)
Compute the out-distance to the near edge of the target in the
traversal direction.
|
Node |
select(Node node,
Direction dir,
TraversalContext context)
Traverse from owner, in direction dir.
|
Node |
selectFirst(TraversalContext context)
Return the first traversable node for the specified context (root).
|
Node |
selectLast(TraversalContext context)
Return the last traversable node for the specified context (root).
|
private int |
trav1D(Bounds origin,
Direction dir,
java.util.List<Node> targets,
TraversalContext context) |
private int |
trav2D(Bounds origin,
Direction dir,
java.util.List<Node> targets,
TraversalContext context) |
int |
traverse(Bounds origin,
Direction dir,
java.util.List<Node> targets,
TraversalContext context) |
private double outDistance(Direction dir, Bounds cur, Bounds tgt)
private double centerSideDistance(Direction dir, Bounds cur, Bounds tgt)
private double cornerSideDistance(Direction dir, Bounds cur, Bounds tgt)
public Node select(Node node, Direction dir, TraversalContext context)
Algorithm
public Node selectFirst(TraversalContext context)
Algorithm
selectFirst
in interface Algorithm
context
- the context that contains the rootpublic Node selectLast(TraversalContext context)
Algorithm
selectLast
in interface Algorithm
context
- the context that contains the rootpublic int traverse(Bounds origin, Direction dir, java.util.List<Node> targets, TraversalContext context)
private int trav2D(Bounds origin, Direction dir, java.util.List<Node> targets, TraversalContext context)
private int trav1D(Bounds origin, Direction dir, java.util.List<Node> targets, TraversalContext context)