Other than the obnoxious title, this was a really satisfying visual I wanted to share. I’ve been trying to create isosurfaces of fields for a long time, and I finally got something.
E&M Physics Steps:
- Generate a 3D wire
- Approximate the wire’s tangent line
- Use this tangent line to assign a current path
- Solve the n*n*n magnetic flux using the Biot–Savart law (just need an XYZ point in space and the small dWire elements)
3D Steps:
- Use the n*n*n grid in XYZ space
- Use Three.js Marching Cubes from the scalar flux field
- Make isosurfaces at different threshold
A few things aren’t perfect. scaling the cubes has been tricky. I learned a lot by running into errors and having to peek inside the Three.js Marching Cubes code. The grid has to be n by n by n. I made a more robust version (happy to share) that includes interpolation and can work on a i by j by k grid.