T
- value type.public abstract class KDTreeNode<T> extends Object implements RealLocalizable, Sampler<T>
RealLocalizable
interface.
It provides the value via Sampler.get()
.Modifier and Type | Field and Description |
---|---|
KDTreeNode<T> |
left
Left child of this node.
|
protected int |
n
number of dimensions of the space (that is, k).
|
protected double[] |
pos
coordinates of the node.
|
KDTreeNode<T> |
right
Right child of this node.
|
protected int |
splitDimension
dimension along which this node divides the space.
|
Modifier | Constructor and Description |
---|---|
protected |
KDTreeNode(KDTreeNode<T> node) |
|
KDTreeNode(RealLocalizable position,
int dimension,
KDTreeNode<T> left,
KDTreeNode<T> right) |
Modifier and Type | Method and Description |
---|---|
abstract KDTreeNode<T> |
copy() |
double |
getDoublePosition(int d)
Return the current position in a given dimension.
|
float |
getFloatPosition(int d)
Return the current position in a given dimension.
|
double |
getSplitCoordinate()
Get the position along
getSplitDimension() where this
node divides the space. |
int |
getSplitDimension()
Get the dimension along which this node divides the space.
|
void |
localize(double[] position)
Write the current position into the passed array.
|
void |
localize(float[] position)
Write the current position into the passed array.
|
int |
numDimensions()
Gets the space's number of dimensions.
|
double |
squDistanceTo(double[] p)
Compute the squared distance from p to this node.
|
float |
squDistanceTo(float[] p)
Compute the squared distance from p to this node.
|
double |
squDistanceTo(RealLocalizable p)
Compute the squared distance from p to this node.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
localize, positionAsDoubleArray, positionAsRealPoint
protected final int n
protected final double[] pos
protected final int splitDimension
public final KDTreeNode<T> left
x.pos[splitDimension] <= this.pos[splitDimension]
.public final KDTreeNode<T> right
x.pos[splitDimension] >= this.pos[splitDimension]
.public KDTreeNode(RealLocalizable position, int dimension, KDTreeNode<T> left, KDTreeNode<T> right)
position
- coordinates of this nodedimension
- dimension along which this node divides the spaceleft
- left child noderight
- right child nodeprotected KDTreeNode(KDTreeNode<T> node)
public final int getSplitDimension()
public final double getSplitCoordinate()
getSplitDimension()
where this
node divides the space.public final int numDimensions()
EuclideanSpace
numDimensions
in interface EuclideanSpace
public final void localize(float[] position)
RealLocalizable
localize
in interface RealLocalizable
position
- receives current positionpublic final void localize(double[] position)
RealLocalizable
localize
in interface RealLocalizable
position
- receives current positionpublic final float getFloatPosition(int d)
RealLocalizable
getFloatPosition
in interface RealLocalizable
d
- dimensionpublic final double getDoublePosition(int d)
RealLocalizable
getDoublePosition
in interface RealLocalizable
d
- dimensionpublic abstract KDTreeNode<T> copy()
copy
in interface Sampler<T>
Sampler
in the same state accessing the same
values.
It does NOT copy T, just the state of the Sampler
.
Otherwise use T.copy() if available.
Sampler.copy().get() == Sampler.get(), i.e. both hold the same
value, not necessarily the same instance (this is the case for an
ArrayCursor
for example)public final float squDistanceTo(float[] p)
public final double squDistanceTo(double[] p)
public final double squDistanceTo(RealLocalizable p)
Copyright © 2015–2022 ImgLib2. All rights reserved.