Kotlin - Heart equation : i'm trying to position 100 hundred particles in a heart shape.
The particles are circles and have a x and y position in the pane.

[![This is what happens][1]][1]


  [1]: https://i.stack.imgur.com/s49Ja.png


    for (p in ps) {
                    val index = ps.indexOf(p).toDouble()
                    var x = 16 * Math.pow(Math.sin(index * angle.toDouble()), 3.0)
                    //var y = Math.sqrt(Math.cos(index)) * Math.cos(400 * index) + Math.sqrt(Math.abs(index) - 0.4) * Math.pow((4 - index * index), 0.1)
                    var y = (13 * Math.cos(index * angle.toDouble()))
                    -(5 * Math.cos(2 * index * angle.toDouble()))
                    -(2 * Math.cos(3 * index * angle.toDouble()))
                    -(Math.cos(4 * index * angle.toDouble()))

                    p.layoutX = startX + x
                    p.layoutY = startY + y
                }

p = particle

ps = particles (list)

I have no idea what i did wrong with the equation implementation.
I also tried to use Math.toRadians in cos, sin since i read that they require that i order to work.

Thank you very much.

