dist/svg.pathmorphing.js
function toBeziere(val){
  var retVal = [val]

  switch(val[0]){
    case 'M': // special handling for M
      this.pos = this.start = [val[1], val[2]]
      return retVal
    case 'L':
      val[5] = val[3] = val[1]
      val[6] = val[4] = val[2]
      val[1] = this.pos[0]
      val[2] = this.pos[1]
      break
    case 'Q':
      val[6] = val[4]
      val[5] = val[3]
      val[4] = val[4] * 1/3 + val[2] * 2/3
      val[3] = val[3] * 1/3 + val[1] * 2/3
      val[2] = this.pos[1] * 1/3 + val[2] * 2/3
      val[1] = this.pos[0] * 1/3 + val[1] * 2/3
      break
    case 'A':
      retVal = arcToBeziere(this.pos, val)
      val = retVal[0]
      break
  }

  val[0] = 'C'
  this.pos = [val[5], val[6]]
  this.reflection = [2 * val[5] - val[3], 2 * val[6] - val[4]]

  return retVal

}
function toBeziere(val){
  var retVal = [val]

  switch(val[0]){
    case 'M': // special handling for M
      this.pos = this.start = [val[1], val[2]]
      return retVal
    case 'L':
      val[5] = val[3] = val[1]
      val[6] = val[4] = val[2]
      val[1] = this.pos[0]
      val[2] = this.pos[1]
      break
    case 'Q':
      val[6] = val[4]
      val[5] = val[3]
      val[4] = val[4] * 1/3 + val[2] * 2/3
      val[3] = val[3] * 1/3 + val[1] * 2/3
      val[2] = this.pos[1] * 1/3 + val[2] * 2/3
      val[1] = this.pos[0] * 1/3 + val[1] * 2/3
      break
    case 'A':
      retVal = arcToBeziere(this.pos, val)
      val = retVal[0]
      break
  }

  val[0] = 'C'
  this.pos = [val[5], val[6]]
  this.reflection = [2 * val[5] - val[3], 2 * val[6] - val[4]]

  return retVal

}
function toBeziere ( val ) { var retVal = [ val ] switch ( val [ 0 ] ) { case 'M' : // special handling for M this . pos = this . start = [ val [ 1 ] , val [ 2 ] ] return retVal case 'L' : val [ 5 ] = val [ 3 ] = val [ 1 ] val [ 6 ] = val [ 4 ] = val [ 2 ] val [ 1 ] = this . pos [ 0 ] val [ 2 ] = this . pos [ 1 ] break case 'Q' : val [ 6 ] = val [ 4 ] val [ 5 ] = val [ 3 ] val [ 4 ] = val [ 4 ] * 1 / 3 + val [ 2 ] * 2 / 3 val [ 3 ] = val [ 3 ] * 1 / 3 + val [ 1 ] * 2 / 3 val [ 2 ] = this . pos [ 1 ] * 1 / 3 + val [ 2 ] * 2 / 3 val [ 1 ] = this . pos [ 0 ] * 1 / 3 + val [ 1 ] * 2 / 3 break case 'A' : retVal = arcToBeziere ( this . pos , val ) val = retVal [ 0 ] break } val [ 0 ] = 'C' this . pos = [ val [ 5 ] , val [ 6 ] ] this . reflection = [ 2 * val [ 5 ] - val [ 3 ] , 2 * val [ 6 ] - val [ 4 ] ] return retVal }
converts all types to cubic beziere
converts all types to cubic beziere