Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface INeighborhood<P, T>

Type parameters

  • P

  • T

Hierarchy

  • IReset
    • INeighborhood

Implemented by

Index

Properties

Readonly dist

dist: IDistance<P>

The distance metric used by this neighborhood

Readonly radius

radius: number

The neighborhood's original radius (Eucledian metric)

Readonly target

target: P

The neighborhood's target position / centroid

Methods

consider

  • consider(pos: P, val: T): number
  • Computes distance metric between pos and this neighborhood's target pos. If result distance is <= current radius, adds val to neighborhood and shrinks neighborhood radius to new distance. Returns distance metric.

    Parameters

    • pos: P
    • val: T

    Returns number

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
    • Optional eucledian: boolean

    Returns boolean

reset

  • Returns INeighborhood<P, T>

Generated using TypeDoc