Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.7 KB

README.md

File metadata and controls

36 lines (24 loc) · 1.7 KB

Complex Plane Plotter

Output a plot of a function from ℂ to ℂ.

Hue of a pixel represents the argument and brightness represents the modulus.

How to use it

int[] pixels = Plotter.plot(f, width, height, x start, y start, x end, y end, coloring)

  • f must be a lambda expression with the function you want to plot (i.e. z -> Complex.ln(z))

  • width, height: dimensions of the output image

  • x start/end: real interval of the function

  • y start/end: imaginary interval

  • coloring: You can combine the two with | operator.

    • 0b01 / Plotter.CONTOURLINES: draw contour lines at integer powers of 2
    • 0b10 / Plotter.ARGLINES: draw white lines at regular arguments intervals

Plain image

Contour lines

Argument lines

Both

Example of usage:

Plotter.plot(z -> Complex.mul(z,Complex.cos(z)), 800, 800, -4, -4, 4, 4, 0b11); 

 

Output:

Plotter.plot() returns an int raster with the image

In the main class there's a method to convert it into a BufferedImage

Dependencies

You need my complex numbers library to run this program: Complex Numbers Library