   return [inner, control1, control2]
 
 starWithCircularTipsPoints = (innerRadius, straightPercentage) ->
-  outer = outerPoints()
-  inner = innerPoints(innerRadius)
-  [intermediate1, intermediate2] = calculateIntermediatePointsComingAndGoing(inner, outer, straightPercentage)
-
+  [outer, inner, intermediate1, intermediate2] = innerAndIntermediatePoints(innerRadius, straightPercentage)
   radius = calculateRadius(intermediate1[0], outer[0], intermediate2[0])
 
-  return [
-    inner.map(pointAsString)
-    intermediate1.map(pointAsString)
-    intermediate2.map(pointAsString)
-    radius
-  ]
+  return [inner, intermediate1, intermediate2, radius]
 
 starWithCubicTipsPoints = (innerRadius, straightPercentage, controlPercentage) ->
   outer = outerPoints()

  outer = outerPoints()
  inner = innerPoints(innerRadius)

  return [
    outer.map(pointAsString)
    inner.map(pointAsString)
  ]

linearStarPoints = innerStarPoints
quadraticStarPoints = innerStarPoints


## Math functions for calculating star shapes

class Point
  constructor: (@x, @y) ->

  toString: () ->
    "#{@x},#{@y}"

polarToCartesian = (angle, distance) ->
  x = Math.cos(angle) * distance
  y = Math.sin(angle) * distance
  new Point(x, y)

addPoints = ([point1, point2]) ->
  new Point(point1.x + point2.x, point1.y + point2.y)

calculateDistance = (point1, point2) ->
  Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2))
