Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

UniquePython/e-field-visualizer

Repository files navigation

Electric Field Visualizer

An interactive 2D electric field visualizer built in C using raylib. Place positive and negative point charges on a grid and watch the field update in real time — visualized as a heatmap and vector arrows.

Screenshots

Single dipole (opposite charges) Dipole

Two dipoles — unlike poles facing Unlike poles

Two dipoles — like poles facing Like poles

How it works

Each grid cell stores a charge value. Every frame, the electric field vector at each cell is computed by summing the Coulomb contributions from all non-zero charges:

$$ E = \frac {q} {r^2} $$

direction = unit vector from charge to point

Field magnitude is normalized across the grid and mapped to a black -> yellow heatmap.

Controls

Input Action
Left click Place positive charge (+1)
Right click Place negative charge (−1)
Click existing charge Remove it
R Clear all charges

Usage

Requires raylib installed on your system.

git clone https://github.com/UniquePython/e-field-visualizer
cd e-field-visualizer
make > /dev/null && bin/e-field-visualizer

Dependencies

  • raylib — graphics and input
  • Standard C: math.h, stdlib.h, string.h, stdbool.h, time.h

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors