FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

SohamJoshi25/Function-Plotter: 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. · GitHub

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

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) Math.sin(W * x + PHI) * A
Cosine Wave (Magenta) Math.cos(W * x + PHI) * A
Tangent Wave Math.tan(W * x + PHI) * A * 0.1
Triangle Wave 2 * A / π * asin(sin(W * x + PHI))
Damped Sine sin(W * x + PHI) * exp(-0.01 * x) * A
Pulse Train (sin(W * x + PHI) > 0 ? 1 : 0) * A
Harmonic Blend (sin(W * x + PHI) + sin(3W * x + PHI)) / 2 * A
Sine of Sine sin(W * x + PHI) * sin(0.8W * x + PHI) * A

🌀 Radial Curves (AppRadial.java)

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

🧮 Parametric Curves (AppParametric.java)

Curve Name Graph Preview Formula (x(t), y(t))
Lissajous Curve x = A·sin(W·t + φ)
y = A·sin(2·W·t)
Parametric Archimedean Spiral x = (t/30)·cos(W·t)
y = (t/30)·sin(W·t)
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) 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
Left Zoom
Left
Center
Bottom

🎛️ 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

2 stars

Watchers

0 watching

Forks

Contributors

Languages


Back | FazBrowse Home | New Git URL