Skip to content

Transform vector calculus into stunning 3D visualizations. An educational tool for students and educators to explore vector fields interactively in the browser.

License

Notifications You must be signed in to change notification settings

NguyenLe15325/Vector-field-visualizer-Three.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌊 3D Vector Field Visualizer

An interactive, web-based Three.js application for visualizing mathematical vector fields in stunning 3D space.


Note: This project was developed with assistance from AI models (Gemini and Claude) and refined through hands-on experimentation and iteration to create an intuitive learning tool for vector field visualization.

Vector Field Visualization

✨ Overview

Transform abstract mathematical equations into mesmerizing visual experiences. This powerful visualizer brings vector calculus to life through real-time 3D rendering, making complex mathematical concepts intuitive and engaging.

🎯 Key Features

Interactive 3D Controls

  • Drag to rotate and explore from any angle
  • Scroll to zoom in and out
  • Coordinate System: R=X (Red), G=Y (Green), B=Z (Blue)

Rich Prebuilt Examples

Explore 11 carefully crafted vector field patterns:

  1. Simple Rotation (Z-Axis) - Classic rotational flow
  2. Linear Expansion (Source/Sink) - Radial divergence patterns
  3. Shearing Flow (X-Z plane) - Parallel flow deformation
  4. Attractor (Cube edges) - Convergent field patterns
  5. Dynamic Swirl (Time-dependent) - Animated rotating fields
  6. Spiral Vortex to Center - Rotation combined with sink
  7. Central Attraction (Harmonic Oscillator) - Wave-like patterns
  8. Spherical Outflow (Central Source) - 3D radial expansion
  9. 3D Helix (Tornado) - Helical flow patterns
  10. Hyperbolic Saddle Point - Classic saddle topology
  11. Sinusoidal Standing Wave - Periodic wave patterns

Vector Field Input Panel

Custom Vector Fields

Define your own vector fields using mathematical expressions:

  • vx: X-component function (e.g., Math.sin(ny + time * 0.5) * 2)
  • vy: Y-component function (e.g., Math.cos(nx + time * 0.5) * 2)
  • vz: Z-component function (e.g., Math.sin(nz + time * 0.5) * 1.5)

Available Variables:

  • x, y, z - Raw position coordinates
  • nx, ny, nz - Normalized position coordinates
  • time - For creating dynamic, time-evolving fields

Prebuilt Examples Dropdown

🚀 Quick Start

Simply visit the live demo - no installation or setup required! The visualizer runs entirely in your browser.

🎨 How to Use

  1. Launch the visualizer in your browser
  2. Choose a prebuilt example from the dropdown menu, or
  3. Create your own field by entering custom vector component functions
  4. Click "Apply Field" to visualize
  5. Interact with the 3D view using mouse controls

🛠️ Built With

  • Three.js (r128) - Powerful 3D graphics library
  • WebGL - Hardware-accelerated rendering
  • Vanilla JavaScript - Lightweight and performant
  • Modern CSS - Sleek, responsive UI design

💡 Use Cases

Perfect for:

  • 📚 Students - Learn vector calculus visually
  • 👨‍🏫 Educators - Demonstrate complex concepts in lectures
  • 🔬 Researchers - Prototype and explore field behaviors
  • 🎨 Artists - Create generative mathematical art
  • 🧠 Curious Minds - Discover the beauty of mathematics

🌟 Why Vector Fields Matter

Vector fields are fundamental to understanding:

  • Fluid Dynamics - Air and water flow patterns
  • Electromagnetism - Electric and magnetic fields
  • Physics - Force fields and particle motion
  • Engineering - Heat transfer and stress analysis
  • Computer Graphics - Procedural generation and effects

🎓 Educational Value

This visualizer makes abstract mathematical concepts tangible:

  • See how equations translate to spatial patterns
  • Understand divergence, curl, and flow intuitively
  • Experiment with parameters and observe real-time changes
  • Develop geometric intuition for multivariable calculus

📸 Gallery

Explore the variety of patterns you can create, from simple rotations to complex time-dependent dynamics. Each preset demonstrates different mathematical principles and behaviors.

🤝 Contributing

Contributions are welcome! Feel free to:

  • Add new prebuilt examples
  • Improve visualization performance
  • Enhance the UI/UX
  • Add new features (particle tracing, streamlines, etc.)
  • Fix bugs or improve documentation

📝 License

This project is open source and available under the MIT License.

🔗 Live Demo

👉 Try it now!

Experience the visualizer directly in your browser - no installation required!


Made with ❤️ and mathematics

If you find this useful, please consider giving it a ⭐!

About

Transform vector calculus into stunning 3D visualizations. An educational tool for students and educators to explore vector fields interactively in the browser.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published