cz.cuni.amis.pogamut.defcon.utils.quadtree
Class QuadTreeNode

Package class diagram package QuadTreeNode
java.lang.Object
  extended by cz.cuni.amis.pogamut.defcon.utils.quadtree.QuadTreeNode

public class QuadTreeNode
extends Object

Node for a QuadTree.

Author:
Radek 'Black_Hand' Pibil

Constructor Summary
QuadTreeNode(QuadTree quadTree, double x1, double y1, double x2, double y2, QuadTreeNode parent, List<List<Location>> subList)
          Constructor for a tree node.
 
Method Summary
 Location getCenter()
          Retrieves a point [ (x1 + x2) / 2, (y1 + y2) / 2 ].
 QuadTreeNode getFirst()
          Returns the upper left child node.
 QuadTreeNode getFourth()
          Returns the lower right child node.
 QuadTreeNode[] getNodes()
          Returns an array containing all nodes (if there are any).
 QuadTreeNode getParent()
          Returns the parent node of this node
 QuadTreeNode getSecond()
          Returns the upper right child node.
 double getSize()
          Returns the width of this node.
 QuadTreeNode getThird()
          Returns the lower left child node.
 double getX1()
           
 double getX2()
           
 double getY1()
           
 double getY2()
           
 boolean isLabeled()
          All nodes through which a line passes are labeled.
 void setLabel(boolean value)
          Use for you own purposes.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuadTreeNode

public QuadTreeNode(QuadTree quadTree,
                    double x1,
                    double y1,
                    double x2,
                    double y2,
                    QuadTreeNode parent,
                    List<List<Location>> subList)
Constructor for a tree node. Suitable only inside QuadTree code

Parameters:
quadTree - parent tree
x1 - upper left x coord
y1 - upper left y coord
x2 - lower right x coord
y2 - lower right y coord
parent - parent node
subList - list of lists of vertices that constitute a line crossing through this nodes rectangle
Method Detail

getX1

public final double getX1()

getX2

public final double getX2()

getY1

public final double getY1()

getY2

public final double getY2()

getCenter

public Location getCenter()
Retrieves a point [ (x1 + x2) / 2, (y1 + y2) / 2 ].

Returns:
center point of this node

getFirst

public final QuadTreeNode getFirst()
Returns the upper left child node. If it exists, otherwise throws an exception.

Returns:
upper left child node

getSecond

public final QuadTreeNode getSecond()
Returns the upper right child node. If it exists, otherwise throws an exception.

Returns:
upper right child node

getThird

public final QuadTreeNode getThird()
Returns the lower left child node. If it exists, otherwise throws an exception.

Returns:
lower left child node

getFourth

public final QuadTreeNode getFourth()
Returns the lower right child node. If it exists, otherwise throws an exception.

Returns:
lower right child node

getNodes

public final QuadTreeNode[] getNodes()
Returns an array containing all nodes (if there are any). Nodes are in the following order [ ul, ur, ll, lr ]

Returns:
array of child nodes

getParent

public final QuadTreeNode getParent()
Returns the parent node of this node

Returns:
parent node

toString

public String toString()
Overrides:
toString in class Object

isLabeled

public final boolean isLabeled()
All nodes through which a line passes are labeled. Other nodes can be labeled by user.

Returns:
is node labeled

setLabel

public final void setLabel(boolean value)
Use for you own purposes. Perhaps, you want to label the whole inside of the polygon?

Parameters:
value - set to true or false

getSize

public double getSize()
Returns the width of this node.

Returns:
width


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.