Vector Field Simulation

🧭 Understanding the Vector Field

πŸ”„ What’s Being Simulated?

This simulation displays a rotational vector fieldβ€”a mathematical representation of direction and magnitude across space. Here, particles are influenced by a central point, creating a swirl-like behavior.

Such vector fields are often seen in:

  • πŸŒ€ Fluid flow (e.g., whirlpools, eddies)
  • πŸŒͺ Rotating force fields (like magnetic or vortex fields)
  • 🌌 Celestial mechanics (gravitational gradients)

πŸ“ Mathematical Basis

Vector at point (x, y) is defined as:

F(x, y) = (-dy / r, dx / r)

This creates a perpendicular rotational effect around the center by rotating the radial vector by 90Β°. The magnitude is normalized and scaled for visibility.

  • dx = x βˆ’ centerX
  • dy = y βˆ’ centerY
  • r = √(dxΒ² + dyΒ²)

Each particle samples the field at its location and moves slightly in that direction, creating natural, circular motion.