Questions tagged [physics]
Physics is a science that studies the interactions of energy and matter. The physics tag should be used for questions about how physics can be simulated or implemented in programming.
151
questions
6
votes
3
answers
248
views
Calculate next position and velocity after "bounce"
Intro and code
I have the following function that calculates an object's "next" position and velocity (in 1 dimension) given a boundary [0, max].
...
6
votes
1
answer
484
views
Pong Game in JS
I am new to game development and took on the task to create a Pong replica due to my curiosity and interest in the field. I decided to write it in JavaScript because the game is not too labor ...
32
votes
7
answers
7k
views
Car crash reaction time
In physics class we are doing an investigation thing. Some of the numbers might seem plucked out of thin air but they aren't. The maths is right(I think) I just want some feedback on the code.
...
3
votes
2
answers
670
views
Simulating a system of moving points
This is an update of the code from my previous question.
I'm simulating a system of particles which interact with each other and move and rotate due to the interaction. There are 2000 particles in ...
1
vote
2
answers
404
views
Simulation of interacting particles [closed]
I'm simulating a system of particles which interact with each other and move and rotate due to the interaction. There are 2000 particles in total but each particle interacts with other particles and ...
2
votes
2
answers
3k
views
Simulating motion of particles
Description
The code does particle simulation. In this code, some particles take steps with a certain distribution length. if particles go beyond a curve, the code put them back.
Code
...
2
votes
3
answers
4k
views
Calculating work using dot product in C++
Write a C++ program fulfilling the following task: The user should enter the 3 dimensional force vector F and a 3 dimensional length vector s. The force is assumed to be constant. The program then ...
2
votes
1
answer
594
views
Cross product to find Lorentz force in C++
User enters velocity vector \$v\$, charge \$q\$ of particle and magnetic field vector \$B\$ and the code prints the Lorentz force \$F = q * (v * B)\$
...
10
votes
3
answers
1k
views
Feynmann lifeguard riddle graphical representation
Physicist Richard Feynman though of a very interesting riddle:
Imagine you are a lifeguard at the side of the beach and there is a child drowning in the water. (You must cross both sand and water to ...
1
vote
1
answer
274
views
Closed particle system simulation in vanilla Javascript
I have ported my simulation from Java to vanilla Javascript. The most important aim was to keep the sum of all energies constant. I have this:
simulation.js
...
4
votes
3
answers
2k
views
Simulating a closed particle system in Java
I have this program that simulates a closed particle system. Closed in this context means that the sum of all energies is constant. My primary concern is code itself, yet I would like to hear comments ...
2
votes
1
answer
65
views
NodeJS module to calculate linear motion
I am on the process of changing jobs, so I would like to get an idea of what I do wrong in order to improve.
For this, I have created a small node module. It's very simple; it calculates linear ...
7
votes
1
answer
635
views
Metaballs and Gravity game;
For past two days I made my first OpenGL project, I know, It's fixed pipeline, but my focus was on gravity algorithm, so, tell what do you think, and how can I make it faster?
main.cpp
...
2
votes
1
answer
3k
views
2D Physics Simulation (game-like)
My program is meant to simulate 2D physics(hopefully 3D as well in the future), namely classical mechanics and eventually electromagnetism. Currently it simulates projectile motion by firing a ...
2
votes
2
answers
6k
views
My first Physics Engine C++
I have made my first physics engine for simulating circles in a plane.
Let me know what you think about it.
...