
// Heart.java
// Robert Sedgewick and Kevin Wayne
// Slightly reformatted by Andrew Davison, Nov. 2022

// https://introcs.cs.princeton.edu/java/15inout/Heart.java.html

/* Draw a pink heart (a filled diamond plus two filled circles).

   Usage:
     > compile Heart.java
     > run Heart
*/

public class Heart
{
  public static void main(String[] args)
  {
    StdDraw.setXscale(-1.5, +1.5);
    StdDraw.setYscale(-1.5, +1.5);
    StdDraw.setPenColor(StdDraw.PINK);

    // draw diamond
    double[] xs = { -1,  0, 1, 0 };
    double[] ys = {  0, -1, 0, 1 };
    StdDraw.filledPolygon(xs, ys);

    // circles
    StdDraw.filledCircle(+0.5, 0.5, 1 / Math.sqrt(2));
    StdDraw.filledCircle(-0.5, 0.5, 1 / Math.sqrt(2));
  } /* main */


}  // end of Heart class
