Skip to content

junayedahamed/equation_painter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

67 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ˆ equation_painter

Open Source Flutter Package by junayedahamed

A powerful, interactive, and performant Flutter package for visualizing multiple mathematical equations simultaneously with beautiful animations and a fully customizable coordinate system.


Preview

โœจ Features

  • โœ… New: Interactive Panning & Zooming: Drag to pan and pinch to zoom around the coordinate system!
  • โœ… New: Polar Coordinate Support: Visualize equations in polar form r = f(theta).
  • โœ… New: Inequality Visualization: Shading for regions like y >= x or x^2 + y^2 <= 25.
  • โœ… New: Tap & Hover to Inspect: Tap or hover on any curve to see the exact (x, y) or (r, theta) coordinates.
  • โœ… Robust Equation Parsing: Type equations like x^2 + y^2 - 100, sin(2x) - y, pow(x,2) * atan2(y,x) directly. It supports implicit multiplication (2x), constants (pi, e), unit +/- and ~20 built-in math functions.
  • โœ… Coordinate Labels: Show dynamic numbers along the axis to measure your functions.
  • โœ… Customizable Unit Scale: By default, each grid square represents 100 units, but you can adjust this to your specific needs.
  • โœ… Configurable Units: Define how many units each grid square represents.
  • โœ… Dynamic Animations: Beautiful radial, sequential, linearX, or linearY draw mechanics.
  • โœ… High Performance: Highly optimized utilizing Float32List, drawRawPoints and Marching Squares evaluation to preserve silky smooth 60fps framerates.

๐Ÿ“ธ Screenshots

Multiple Curves with Custom Styles and Complex Functions

Sin wave with radial animation

Heart curve

Cos wave with value inspection

Inequality Visualization

๐Ÿš€ Getting Started

Add the package to your pubspec.yaml:

dependencies:
  equation_painter: ^0.1.0+7

๐Ÿ’ก Usage

EquationPainter(
  equations: [
    EquationConfig(
      function: (x, y) => x * x + y * y - 25,
      color: Colors.indigoAccent,
      strokeWidth: 4,
    ),
  ],
  unitsPerSquare: 10,
  interactive: true,
  showGrid: true,
  onPointTapped: (x, y, config) {
    print("Tapped at ($x, $y)");
  },
)

๐Ÿงฎ Enhanced Equation Parsing

You can parse string-based equations directly using EquationParser. It's highly tolerant!

Supported Syntax

  • Variables: x, y
  • Constants: pi (pi), e (e)
  • Operators: +, -, *, /, ^ (power)
  • Implicit Multiplication: 2x, 3(x+y), x(y-1)
  • Functions:
    • Trigonometric: sin, cos, tan, asin, acos, atan, atan2(y, x)
    • Logarithmic & Exponential: log/ln (natural), log2, log10, exp
    • Rounding & Absolute: abs, ceil, floor, round, sign
    • Miscellaneous: sqrt, cbrt (cube root), hypot(a, b), pow(base, exp), min(a, b), max(a, b)
final userEquation = "tan(20x) - tan(15y) + sin(xy) - 10";
final mathFunction = EquationParser.parseOrNull(userEquation); // Returns null if invalid 

if (mathFunction != null) {
  EquationConfig(
    function: mathFunction,
    color: Colors.pinkAccent,
  )
}

โ„๏ธ Advanced Features

  • Customizable Grid Styles: Support for logarithmic scales, dashed lines, and custom colors.
  • Export to Image/SVG: Easily save your visualized equations as high-quality images or SVGs.

๐Ÿ”ญ Future Upgrade Ideas

  • ๐Ÿš€ 3D Equation Visualization: Support for plotting z = f(x, y) in a 3D coordinate system.
  • ๐Ÿš€ Parametric Equation Support: Plot curves defined by equations like x = f(t), y = g(t).
  • ๐Ÿš€ Live Equation Editor: A built-in UI component to type and preview equations in real-time.
  • ๐Ÿš€ Data Series Plotting: Ability to plot discrete data points (scatter plots) alongside continuous equations.
  • ๐Ÿš€ Legend & Tooltips: Add customizable legends and more detailed information tooltips for complex graphs.

โญ Support the Project

If you like this project, please give it a โญ on GitHub and share it with your friends! It really helps me out and motivates me to keep improving it. Thank you for your support! ๐Ÿ™

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


Crafted with โค๏ธ for Mathematicians and Developers.

About

A powerful, interactive, and performant Flutter package for visualizing multiple mathematical equations simultaneously with beautiful animations and a fully customizable coordinate system.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors