Welcome to the Physics Simulator (internally structured as Physics_Simulator ), a highly interactive and modular desktop application designed to visualize, simulate, and calculate various physics and mathematical phenomena.
From classical mechanics to quantum transitions, this application provides an intuitive graphical playground to help students and enthusiasts explore the laws of nature.
The application is structured around six core thematic physics modules:
- Distance & Displacement: Visualize the difference between scalar distance and vector displacement.
- Speed, Velocity, & Acceleration: Observe real-time motion graphs driven by custom equations.
- Projectile Motion: Simulate trajectories with adjustable launch angles, initial velocities, and gravity.
- Free Fall: Explore gravitational acceleration without air resistance.
-
Hooke's Law & Elasticity: Calculate spring constant (
$k$ ), force ($F$ ), and extension ($x$ ) with interactive spring visualizations. - Momentum Calculator: Simulate elastic and inelastic collisions.
-
Ohm's Law: Analyze the direct relationship between Voltage (
$V$ ), Current ($I$ ), and Resistance ($R$ ). - Circuit Simulators: Construct and analyze both Series and Parallel circuits in real time.
- Kirchhoff's Current Law (KCL): Visualize current distribution at junction nodes.
- Electric Power: Calculate and visualize power dissipation across different components.
- N-Body Simulator: Simulate orbital mechanics and gravitational attraction between multiple cosmic bodies.
- Interactive Gravity Canvas: Adjust planetary masses and velocities to observe real-time orbital paths.
- Vector Addition: Visually add multiple vectors and calculate the resultant vector.
- Dot & Cross Products: Visualize 2D and 3D vector multiplications and their physical geometric meanings.
- Boat & River Simulator: Explore relative velocity and vector drift by navigating a boat across a moving current.
- Bohr Model: Visualize electron orbits, shells, and energy levels.
- Electron Transition: Simulate photon emission and absorption when electrons jump between energy states.
- Rutherford Scattering: Simulate alpha particles firing at a gold foil to observe nuclear scattering.
- Half-Life Simulator: Watch unstable atomic nuclei decay statistically over time.
- Nuclear Fission: Trigger chain reactions and monitor neutron releases.
- Harmonic Motion: Simulate a classic pendulum with customizable length, mass, and gravity.
- Real-time Plotting: View live phase diagrams and energy tracking charts (kinetic vs. potential energy).
The project is built on a clean, modular architecture separating layout presentation, application routing, and physical mathematical modeling.
phy_sim/
├── app/
│ ├── src/main/java/com/physicssim/
│ │ ├── app/ # Main app shell & bootstrap entry point
│ │ ├── components/ # Reusable UI elements (custom buttons, headers, cards)
│ │ ├── features/ # View classes grouped by physics category (UI Layer)
│ │ ├── model/ # Mathematical engine and state models (Logic Layer)
│ │ ├── navigation/ # Controller for handling view swaps
│ │ └── theme/ # Global styling config (AppTheme)
│ └── src/main/resources/css/ # CSS files matching view package structures
- Java Development Kit (JDK): Version 17 or higher is recommended.
Gradle: Handled automatically via the included Gradle Wrapper.
- Build Optimization: Gradle's configuration cache is enabled (
org.gradle.configuration-cache=true) to dramatically speed up consecutive build times.
JVM Settings: The application launches with default memory allocations optimized for desktop environments (-Xms64m / -Xmx64m).
You do not need to install Gradle globally to run this project. You can use the provided Gradle Wrapper scripts.
Open your terminal in the root directory and execute:
# Make the wrapper script executable (if needed)
chmod +x gradlew
# Run the application
./gradlew :app:run
Open Command Prompt (cmd) or PowerShell in the root directory and execute:
gradlew.bat :app:run
- Create a feature branch:
git checkout -b feature/your-feature-name - Commit your changes:
git commit -m "Add some amazing feature" - Push to the branch:
git push origin feature/your-feature-name - Open a Pull Request.