Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BresenhamService

Hierarchy

  • BresenhamService

Index

Methods

bresenhamsLineAlgorithm

  • bresenhamsLineAlgorithm(p1: Point, p2: Point, touches1: function, touches2: function): Line
  • Performs Bresenham's Line Algorithm (Bresenham 1965)

    The algorithm draws a line from p1 to p2, which have an associated shape. The algorithm tries estimates the line which draws the thought line from p1 to p2 while never touching their associated shapes.

    Parameters

    • p1: Point

      The starting point

    • p2: Point

      The ending point

    • touches1: function

      Callback to check if shape 1 is touched by X and Y coordinates

        • (x: number, y: number): boolean
        • Parameters

          • x: number
          • y: number

          Returns boolean

    • touches2: function

      Callback to check if shape 2 is touched by X and Y coordinates

        • (x: number, y: number): boolean
        • Parameters

          • x: number
          • y: number

          Returns boolean

    Returns Line

    The line from shape 1 to shape 2

connect

connectConnectorWithConnector

connectConnectorWithPoint

connectPointWithConnector

connectPointWithPoint

waylines

  • Iterates over all lines which are part of an edge Where the edge gets painted on

    Parameters

    • edge: Edge<any>

      The edge which gets painted

    Returns LineStroke

    A line stroke connecting all the points along the edge

Generated using TypeDoc