Plot functions in C#, Part 3

[Plot functions]

This is the third example that shows how to plot functions that draw hearts. This time the function is:



The following examples also draw heart-shaped functions. See the first for an explanation of how the programs work.

The difference is that this example uses the function shown above. The following code shows how it implements the function in code.

// The function.
private float HeartFunc(float x, float y)
{
    double a = x * x;
    double b = 5.0 * y / 4.0 - Math.Sqrt(Math.Abs(x));
    return (float)(a * a + b * b - 1);
}

See the earlier example for more details.


Download Example   Follow me on Twitter   RSS feed   Donate




This entry was posted in algorithms, drawing, graphics, mathematics and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *