Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

View project on GitHub Star

Api - PointGraph Class

A graph of items which may be located on the same points.

Type parameters

  • T

Hierarchy

  • PointGraph

Index

Constructors

constructor

Properties

graph

graph: object

Map of unique points by x, then y, to a point id. This will remain intact even after merging.

Type declaration

  • [x: number]: object
    • [y: number]: number

index

index: object

Index of points by id.

Type declaration

insertedCount

insertedCount: number

Number of points inserted

merged

merged: object

Map of point ids which once existed but have been merged into another id due to close proximity.

Type declaration

  • [pointId: number]: number

values

values: T[]

List of values inserted at points.

Methods

forEachPoint

  • forEachPoint(cb: function): void

getElementAtPoint

getIdOfPoint

  • getIdOfPoint(p: IPoint): number

insertValue

  • insertValue(value: T): number

insertValueIdAtPoint

  • insertValueIdAtPoint(valueId: number, p: IPoint): object

mergeNearestSinglePoints

  • mergeNearestSinglePoints(withinDistance: number): void
  • Finds all points which have only one value associated. Then, merge to the nearest other point within this set. Call this after inserting values.

    Parameters

    • withinDistance: number

      Distance to consider points equal.

    Returns void

mergePoints

  • mergePoints(withinDistance: number): void

reset

  • reset(): void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc