Class LineObject

An opaque line object

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

a: Vec2

A vector that is the first point of the line.

Default

new Vec2()
b: Vec2

A vector that is the last point of the line.

Default

new Vec2()
diffuse: number

The intensity of the light penetration in objects.

Default

0.8
points: Vec2[]

An array of Vec points that define the polygon.

Default

[]

Methods

  • Calculate the boundaries of the polygon object.

    Returns Bounds

    An anonymous object with the properties topLeft and bottomRight. The property values are Vec2 objects representing the corners of the boundary.

  • Fill ctx with the shadows projected by the polygon object from the origin point, constrained by the given bounds.

    Parameters

    • context: CanvasRenderingContext2D

      The canvas context onto which the shadows will be cast.

    • origin: Vec2

      A vector that represents the origin for the casted shadows.

    • bounds: Bounds

      An anonymous object with the properties topLeft and bottomRight. The property values are Vec2 objects representing the corners of the boundary.

    Returns void

  • Determine if the given point is inside the polygon.

    Parameters

    • point: Vec2

      The point to be checked.

    Returns boolean

    true if the polygon object contains the given point.

  • Draw the path of the polygon onto the ctx.

    Parameters

    • context: CanvasRenderingContext2D

      The context onto which the path will be drawn.

    Returns void

  • Initializes the points defining the line based on its options.

    Returns void