curveΒΆ

class curve

A curve is a curve with a set of keys and tangents

Members

Constructors:

curve result create ( ) Create an empty curve

Methods:

nil addkey ( number x , number y ) Add a key into a curve
nil copy ( curve source ) Copy a curve content into another
number index createorsetkey ( number x , number y ) Create/set a key
nil deletekey ( number index ) Delete a key
number flags getflags ( ) Get the curve flags
number count getkeycount ( ) Get the number of keys of the curve
number flags getkeyflags ( number index ) Get the key flags
number,number min,max getkeylimit ( number index ) Get the key limit, on the left and right sides
number,number x,y getkeypos ( number index ) Get a key coordinates
number,number,number,number px,py,nx,ny getkeytanpos ( number index ) Get the key tangent positions
number y getvalue ( number x ) Evaluate a curve at a given x
boolean exist haskey ( number x ) Tell if there is a key at x
nil setflags ( number flags , number|nil mask ) Set the curve flags
nil setkeyflags ( number index , number flags , number|nil mask ) Set the key flags
nil setkeypos ( number index , number x , number y ) Set a key coordinates
nil setkeytanpos ( number index , number px , number py , number nx , number ny ) Set the key tangent positions

Documentation

nil addkey ( number x , number y )

Add a key into a curve

Arguments:

  • x The x coordinate of the key
  • y The y coordinate of the key


nil copy ( curve source )

Copy a curve content into another

Arguments:

  • source The source curve to copy


number index createorsetkey ( number x , number y )

Create/set a key

Arguments:

  • x the x coordinate of the key to set
  • y the y coordinate of the key to set

Return:

  • index the 1-based index of the key


nil deletekey ( number index )

Delete a key

Arguments:

  • index the 1-based index of the key to delete


number flags getflags ( )

Get the curve flags

Return:

  • flags the flags of the curve


number count getkeycount ( )

Get the number of keys of the curve

Return:

  • count the number of keys


number flags getkeyflags ( number index )

Get the key flags

Arguments:

  • index the 1-based index of the key

Return:

  • flags the flags of the key


number,number min,max getkeylimit ( number index )

Get the key limit, on the left and right sides

Arguments:

  • index the 1-based index of the key

Return:

  • min,max the left and right limits of the key


number,number x,y getkeypos ( number index )

Get a key coordinates

Arguments:

  • index the 1-based index of the key in the curve

Return:

  • x,y the x,y coordinates of the key


number,number,number,number px,py,nx,ny getkeytanpos ( number index )

Get the key tangent positions

Arguments:

  • index the 1-based index of the key

Return:

  • px,py,nx,ny the previous x,y and next x,y coordinates of the key tangents


number y getvalue ( number x )

Evaluate a curve at a given x

Arguments:

  • x the x position to evaluate the curve at

Return:

  • y the evaluated y value of the curve at x


boolean exist haskey ( number x )

Tell if there is a key at x

Arguments:

  • x the x coordinate of the key to set

Return:

  • exist true if the key exists


nil setflags ( number flags , number|nil mask )

Set the curve flags

Arguments:

  • flags the flags to set
  • mask the mask of flags to set (or nil to reset all flags)


nil setkeyflags ( number index , number flags , number|nil mask )

Set the key flags

Arguments:

  • index the 1-based index of the key
  • flags the flags of the key to set
  • mask the mask of flags to set (or nil to reset all flags)


nil setkeypos ( number index , number x , number y )

Set a key coordinates

Arguments:

  • index the 1-based index of the key in the curve
  • x the x coordinate of the key to set
  • y the y coordinate of the key to set


nil setkeytanpos ( number index , number px , number py , number nx , number ny )

Set the key tangent positions

Arguments:

  • index the 1-based index of the key
  • px the x coordinate of the previous tangent position
  • py the y coordinate of the previous tangent position
  • nx the x coordinate of the next tangent position
  • ny the y coordinate of the next tangent position