Package net.imglib2

Class KDTreeNode<T>

    • Field Detail

      • n

        protected final int n
        number of dimensions of the space (that is, k).
      • pos

        protected final double[] pos
        coordinates of the node.
      • splitDimension

        protected final int splitDimension
        dimension along which this node divides the space.
      • left

        public final KDTreeNode<T> left
        Left child of this node. All nodes x in the left subtree have x.pos[splitDimension] <= this.pos[splitDimension].
      • right

        public final KDTreeNode<T> right
        Right child of this node. All nodes x in the right subtree have x.pos[splitDimension] >= this.pos[splitDimension].
    • Constructor Detail

      • KDTreeNode

        public KDTreeNode​(RealLocalizable position,
                          int dimension,
                          KDTreeNode<T> left,
                          KDTreeNode<T> right)
        Parameters:
        position - coordinates of this node
        dimension - dimension along which this node divides the space
        left - left child node
        right - right child node
      • KDTreeNode

        protected KDTreeNode​(KDTreeNode<T> node)
    • Method Detail

      • getSplitDimension

        public final int getSplitDimension()
        Get the dimension along which this node divides the space.
        Returns:
        splitting dimension.
      • getSplitCoordinate

        public final double getSplitCoordinate()
        Get the position along getSplitDimension() where this node divides the space.
        Returns:
        splitting position.
      • localize

        public final void localize​(float[] position)
        Description copied from interface: RealLocalizable
        Write the current position into the passed array.
        Specified by:
        localize in interface RealLocalizable
        Parameters:
        position - receives current position
      • localize

        public final void localize​(double[] position)
        Description copied from interface: RealLocalizable
        Write the current position into the passed array.
        Specified by:
        localize in interface RealLocalizable
        Parameters:
        position - receives current position
      • getFloatPosition

        public final float getFloatPosition​(int d)
        Description copied from interface: RealLocalizable
        Return the current position in a given dimension.
        Specified by:
        getFloatPosition in interface RealLocalizable
        Parameters:
        d - dimension
        Returns:
        dimension of current position
      • getDoublePosition

        public final double getDoublePosition​(int d)
        Description copied from interface: RealLocalizable
        Return the current position in a given dimension.
        Specified by:
        getDoublePosition in interface RealLocalizable
        Parameters:
        d - dimension
        Returns:
        dimension of current position
      • copy

        public abstract KDTreeNode<T> copy()
        Specified by:
        copy in interface Sampler<T>
        Returns:
        - A new 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)
      • squDistanceTo

        public final float squDistanceTo​(float[] p)
        Compute the squared distance from p to this node.
      • squDistanceTo

        public final double squDistanceTo​(double[] p)
        Compute the squared distance from p to this node.
      • squDistanceTo

        public final double squDistanceTo​(RealLocalizable p)
        Compute the squared distance from p to this node.