Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.09 KB

README.md

File metadata and controls

54 lines (37 loc) · 1.09 KB

shadowed

shadowed

Table of contents

Interfaces

Functions

Functions

computeShadows

Const computeShadows(bounds, walls, light): Vec2[][]

Computes casted shadows by a light for a given set of walls within specified bounds.

example

computeShadows(
  {
    topLeft: { x: 0, y: 0 },
    bottomRight: { x: 640, y: 360 },
  },
  [{
    a: { x: 20, y: 80 },
    b: { x: 80, y: 30}
  }],
  { x: 100, y: 200 },
);

Parameters

Name Type Description
bounds Bounds A rectangle where the shadows will be contained.
walls Segment2[] Segments that will cast shadows.
light Vec2 Position of the light.

Returns

Vec2[][]

Defined in

computeShadows.ts:39