Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Nearest<D, T>

A INeighborhood implementation for nearest neighbor queries around a given target location, initial query radius and IDistance metric to determine proximity.

Type parameters

  • D

    spatial position for distance metric

  • T

    indexed value

Hierarchy

  • Nearest

Implements

Index

Constructors

constructor

  • new Nearest<D, T>(dist: IDistance<D>, target: D, radius?: number): Nearest<D, T>

Properties

Protected _currR

_currR: number

Readonly dist

dist: IDistance<D>

The distance metric used by this neighborhood

Readonly radius

radius: number

The neighborhood's original radius (Eucledian metric)

Readonly target

target: D

The neighborhood's target position / centroid

Optional value

value: T

Methods

consider

  • consider(pos: D, val: T): number

deref

  • Returns current nearest neighbor result tuple ([dist, val]) or undefined, if no such result exists (yet).

    Returns undefined | Neighbor<T>

includesDistance

  • includesDistance(d: number, eucledian?: boolean): boolean
  • Returns true, if distance d is <= current radius of this neighborhood. If eucledian is true (default: true), then d will first be converted into the metric used by this neighborhood using IDistance.to, otherwise it is expected to be already in that metric space.

    Parameters

    • d: number
    • eucledian: boolean = true

    Returns boolean

reset

Generated using TypeDoc