uses p5js to calculate the magnetic field around a dipole magnet.
Pretty simple, uses this equation
B=(μ0/4π)(m×r^/∣r∣^3)
where:
μ0 is the permeability of free space.
m is the magnetic moment of the dipole, given by the product of the pole strength (m) and the distance between the poles (d): m=m⋅d.
r^ is the unit vector pointing from the location of the magnetic dipole to the point in space where the magnetic field is being calculated.
∣r∣ is the distance from the magnetic dipole to the point in space.