@dangermonk/dda-ray
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

step based Digital Differential Analyzer (DDA) algorithm

#Install

npm i @dangermonk/dda-ray

#Use

initialize a ray from floating point grid coordinates

import { DDARay } from "./index";

const position = {
    x: 2.5, 
    y: 4.2 
};

const vector = {
    x: 2, 
    y: 3
}

const ray = new DDARay(position, vector);

iterate through the grid from the starting point:

ray.nextCell();     // returns the next cell the ray is intersecting with

ray.nextPoint();    // returns the next grid intersection point between cells

ray.next();         // returns point and cell

Readme

Keywords

Package Sidebar

Install

npm i @dangermonk/dda-ray

Weekly Downloads

1

Version

2.1.0

License

ISC

Unpacked Size

4.67 kB

Total Files

4

Last publish

Collaborators

  • dangermonk