Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SohamJoshi25/Function-Plotter

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎨 Function Plotter

A Java-based application to visualize mathematical curves in Cartesian and Polar (Radial) coordinate systems. The app uses sliders for real-time control over parameters like Amplitude (A), Frequency (W), and Phase Shift (PHI).


📷 Previews

📈 Cartesian Curves (AppCartesian.java)

Curve Name Graph Preview Formula Used
Sine Wave (Blue) Sine Math.sin(W * x + PHI) * A
Cosine Wave (Magenta) Cosine Math.cos(W * x + PHI) * A
Tangent Wave Tangent Math.tan(W * x + PHI) * A * 0.1
Triangle Wave Triangle 2 * A / π * asin(sin(W * x + PHI))
Damped Sine Damped sin(W * x + PHI) * exp(-0.01 * x) * A
Pulse Train Pulse (sin(W * x + PHI) > 0 ? 1 : 0) * A
Harmonic Blend Harmonic (sin(W * x + PHI) + sin(3W * x + PHI)) / 2 * A
Sine of Sine SineOfSine sin(W * x + PHI) * sin(0.8W * x + PHI) * A

🌀 Radial Curves (AppRadial.java)

Curve Name Graph Preview Formula (r = ...)
Cardiod Cardiod (1 - sin(θ)) * 100
Infinity (Lemniscate) Infinity sqrt(10000 * cos(2θ))
Rose Curve Rose 100 * cos(4θ)
Archimedean Spiral Archimedean 10 + 10 * θ
Fermat Spiral Fermat 10 * sqrt(θ)
Epicycloid Epicycloid 100 * (1 - cos(3θ))
Logarithmic Spiral Log 10 * e^(0.15 * θ)

🧮 Parametric Curves (AppParametric.java)

Curve Name Graph Preview Formula (x(t), y(t))
Lissajous Curve Lissajous x = A·sin(W·t + φ)
y = A·sin(2·W·t)
Parametric Archimedean Spiral Archimedean x = (t/30)·cos(W·t)
y = (t/30)·sin(W·t)
Hypotrochoid Hypotrochoid x = (A - 20)·cos(W·t) + 40·cos(((A - 20)/20)·W·t)
y = (A - 20)·sin(W·t) - 40·sin(((A - 20)/20)·W·t)
Helix (3D) Helix (3D) x = A·cos(W·t)
y = A·sin(W·t)
z = t

♾️ Mandelbrot Fractal (AppFractal.java)

  • c = x + iy (a point in the complex plane)
  • z₀ = 0
  • Recurrence: zₙ₊₁ = zₙ² + c
Location Preview
Overview mandelbrot 1
Left Zoom mandelbrot 2
Left mandelbrot 3
Center mandelbrot 4
Bottom mandelbrot 5

🎛️ Controls

The app provides interactive sliders to dynamically update curves:

Example Usage in Code

    int function(float x){
        A = sliderA.getValue();
        W = sliderW.getValue()/1000.0;
        PHI = sliderPHI.getValue()/100.0;
        return (int)(Math.sin(W * x + PHI) * A); // Sine Wave
    }

    public AppCartesian(){

        points = new ArrayList<>();
        new Timer(sliderDelay.getValue(), e -> {
            x += (float)(sliderStep.getValue()/10f);        
add ->      points.add(new Point((int)x,function(x),(int)size,Color.BLUE));
            repaint();
        }).start();
    }

About

A Simple Proof of concept of a function plotter written in java. Initially was implemented in C++ during Computer Graphics Practical Exam then ported to java.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.