Split

<script src="./point_src/split-v2"></script>

Split a point, line or curve into many smaller points.

const p = new Point({radius: 100})
let points = p.split(4)

Lines and curves share one split(count, options) signature:

// both ends included
curve.split(20)                          
// ends excluded
curve.split(20, { inner: true })         
// equal arc-length spacing
curve.split(20, { even: true })          
// a point every 10 units
curve.split({ every: 10 })               
// lerp radius/rotation a -> b
curve.split(20, { hinted: true })        
// face a point
curve.split(20, { lookAt: point })       
// rotate each point (radians)
curve.split(20, { angle: Math.PI / 2 })

A bare number as the second argument is treated as angle.

Meta Data
title Split
dependencies ()
unused_keys ()
unknown_keys ('files',)
files ['', 'functions/clamp.js']
filepath_exists True
path split-v2
filepath split-v2.js
clean_files ('functions/clamp.js',)

  • VariableDeclaration
    const

    splitToPointList

    =
    function ( point , count , radius , rotation , angle =undefined )

    splitToPointList(point, count).pen.indicators(ctx)

    p1.rotation = rotation || point.rotation

  • VariableDeclaration
    const

    lerp

    =
    ( x , y , a ) =>
  • VariableDeclaration
    const

    animatedSegmentOffset

    =
    function ( delta , speed , segmentSize , scale =0.005 )

    Keep animation inside one segment width/angle to avoid hard clipping pops.

  • VariableDeclaration
    const

    EMPTY_SPLIT_OPTIONS

    =
    CallExpression
  • VariableDeclaration
    const

    splitArgs

    =
    function ( count , options )

    Normalise split(count, options) arguments. Accepts split({ every: 10 }) and the legacy split(count, angle).

  • VariableDeclaration
    const

    splitFractions

    =
    function ( count , inner )

    Linear 0..1 fractions along a path for count points. Ends are included unless inner; a single point sits at the middle.

  • VariableDeclaration
    const

    everyFractions

    =
    function ( total , every , inner )

    Fractions for a point every every units along a total length.

  • FunctionDeclaration
    function

    bLerp

    (
    a , b , t
    )
    dict_keys(['kind', 'word', 'generator', 'expression', 'async', 'params', 'id', 'pos', 'type'])
  • FunctionDeclaration
    function

    lerpV2

    (
    a , b , t
    )
    dict_keys(['kind', 'word', 'generator', 'expression', 'async', 'params', 'id', 'pos', 'type'])
  • FunctionDeclaration
    function

    get_bezier_point

    (
    p0 , p1 , p2 , p3 , t
    )
    dict_keys(['kind', 'word', 'generator', 'expression', 'async', 'params', 'id', 'pos', 'type'])
  • FunctionDeclaration
    function

    get_bezier_derivative

    (
    p0 , p1 , p2 , p3 , t
    )
    dict_keys(['kind', 'word', 'generator', 'expression', 'async', 'params', 'id', 'pos', 'type'])
  • ClassDeclaration
    class comments:

    Cumulative chord lengths at samples evenly spaced t values, used to map an arc-length distance back to t. Reused across frames; update() only resamples when the control points or sample count change.

    • constructor

      constructor

      (
      )
      from BezierArcTable
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Cumulative chord lengths at samples evenly spaced t values, used to map an arc-length distance back to t. Reused across frames; update() only resamples when the control points or sample count change.

    • method

      update

      (
      p0 , p1 , p2 , p3 , samples
      )
      from BezierArcTable
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    • method

      tAt

      (
      distance
      )
      from BezierArcTable
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      t for an arc-length distance. Queries are expected in ascending order; call rewind() before a new walk.

    • method

      rewind

      (
      )
      from BezierArcTable
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])
    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • VariableDeclaration
    const

    lerpRadius

    =
    function ( a , b , v )

    Process the width from the first to the last of a line.

  • VariableDeclaration
    const

    radiusManual

    =
    function ( a , b , i )
  • ClassDeclaration
    class comments:

    Buildin split functionality for a pointlist.

    • method

      segment

      (
      index , count = 10
      )
      from PointListSplit
      dict_keys(['kind', 'word', 'static', 'computed', 'is_symbol', 'value', 'type', 'comments', 'pos', 'class_name'])

      Buildin split functionality for a pointlist.

      Split a segment

    dict_keys(['kind', 'word', 'parentName', 'type', 'body', 'comments', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])
  • ExpressionStatement

    :

    dict_keys(['type', 'expression', 'pos'])