[Solved] convert circle into heart 2d android [closed]


MathWorld had a great heart shaped function; http://mathworld.wolfram.com/HeartCurve.html

Basically you have to do something like this in your code;

float fraction = (float) this.currentStep / (float) this.steps;

–>

float t = this.currentStep * 2.0 * Math.PI / (float) this.steps;

this.x = 16.0 * Math.pow(Math.sin(t), 3.0));
this.y = 13.0 * Math.cos(t) - 5.0 * Math.cos(2.0 * t) -
          2.0 * Math.cos(3.0 * t) - Math.cos(4.0 * t);

Hope this helps, I’m writing this blindly so bear with me if there’s some mistakes. For radius you might want to do something like this;

this.x *= radius / 16.0;
this.y *= radius / 16.0;

1

solved convert circle into heart 2d android [closed]