Questions tagged [physics]

Refers to real-world physics. For simulation of physics in games use the [game-physics] tag instead, for questions using an existing physics engine use [physics-engine]. Physics is a science that studies the interactions of energy and matter. Questions with this tag concern the simulation or implementation of real-world physics concepts in programming.

The physics tag should be used for questions about how physics can be simulated or implemented in programming. Please ask questions about physics in a non-programming context on the Physics site. Also consider that questions specific to a simplified or approximate physics engine for use in games might receive better answers if asked on Game Development.

3476 questions
10
votes
8 answers

Datatypes for physics

I'm currently designing a program that will involve some physics (nothing too fancy, a few balls crashing to each other) What's the most exact datatype I can use to represent position (without a feeling of discrete jumps) in c#? Also, what's the…
juan
  • 80,295
  • 52
  • 162
  • 195
10
votes
15 answers

how to calculate a negative acceleration?

I'm implementing the scrolling behaviour of a touch screen UI but I'm too tired in the moment to wrap my mind around some supposedly trivial piece of math: y (distance/velocity) |******** | ****** | **** | *** | …
x4u
  • 13,877
  • 6
  • 48
  • 58
10
votes
2 answers

How to make my python integration faster?

Hi i want to integrate a function from 0 to several different upper limits (around 1000). I have written a piece of code to do this using a for loop and appending each value to an empty array. However i realise i could make the code faster by doing…
blablabla
  • 304
  • 1
  • 8
  • 18
10
votes
1 answer

Simulating a spring/damper system in Yampa

I'm trying to use Yampa for some basic system simulation like I'd do in Simulink. In this case I want to simulate a spring and damper system, introduced by this simulink tutorial. I've written the following signal functions to represent the…
Daniel Buckmaster
  • 7,108
  • 6
  • 39
  • 57
10
votes
2 answers

Solving Billiard Shot Impulse Trajectory

I'm using bullet to make a pool simulator and need to accurately simulate shots that are humanly possible. To find the impulse to apply to the cue ball I use the locations of the object ball, pocket center and cue ball. (source: poolplayers.com)…
tkefauver
  • 491
  • 5
  • 19
10
votes
3 answers

How to fix circle and rectangle overlap in collision response?

Since in the digital world a real collision almost never happens, we will always have a situation where the "colliding" circle overlaps the rectangle. How to put back the circle in the situation where it collides perfectly with the rectangle…
VanDir
  • 1,980
  • 3
  • 23
  • 41
10
votes
3 answers

Position resizable circles near each other

I am working on this browser-based experiment where i am given N specific circles (let's say they have a unique picture in them) and need to position them together, leaving as little space between them as possible. It doesn't have to be arranged in…
user151496
  • 1,849
  • 24
  • 38
10
votes
2 answers

Calculating inertia for a multi-shape rigid body

I figured someone probably asked this question before but I wasn't able to find an answer. I'm writing a physics library for my game engine (2d, currently in actionscript3, but easily translatable to C based languages). I'm having problems finding a…
Laurens
  • 101
  • 1
  • 6
10
votes
1 answer

Is there a JavaScript physics library that works with HTML elements such as divs rather than in canvas?

I am working on a simple stack for a game where players move numbered pieces around to keep track of how close they are to finishing collecting a winning hand of pieces. Currently I went with jQuery UI's draggable and droppable. It is good for…
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
10
votes
2 answers

Using GPU to speed up BigInteger calculations

I am almost done with an algorithm that processes some very large integers (around the order of 2 raised to the power 100,000,000). This takes a couple of hours of highly-parallel code on a 16 core server with more than adequate memory since the…
Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
10
votes
2 answers

Comparing a saved movement with other movement with Kinect

I need to develop an application where a user (physiotherapist) will perform a movement in front of the Kinect, I'll write the data movement in the database and then the patient will try to imitate this motion. The system will calculate the…
Ewerton
  • 4,046
  • 4
  • 30
  • 56
9
votes
2 answers

Simple Javascript Physics Engine

Is there a simple JavaScript physics engine available that can handle some simple 3D scenarios. I'm aware of the Box2D implementation but I don't think that can do what I need. In essence I want to simulate the behavior of a ball as it interacts…
ConfusedNoob
  • 9,826
  • 14
  • 64
  • 85
9
votes
3 answers

Gravity with air-time, acceleration and speed gaining

I am trying to accomplish a gravity, where airtime is included, and also acceleration.I have tried using usual gravity, which looks something like this: velocity += gravity * dt; position += velocity * dt; This would probably work good enough for…
Basic
  • 193
  • 1
  • 2
  • 14
9
votes
3 answers

Simulate "Newton's law of universal gravitation" using Box2D

I want to simulate Newton's law of universal gravitation using Box2D. I went through the manual but couldn't find a way to do this. Basically what I want to do is place several objects in space (zero gravity) and simulate the movement. Any tips?
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185
9
votes
4 answers

Python physics library?

Are there any good up-to-date physics libraries for Python that are for Linux? I'm just getting into Python using PyGame, but PyGame's lack of a physics library isn't cool. I spent about two hours trying to find a good physics library but it's like…
Elliot Bonneville
  • 51,872
  • 23
  • 96
  • 123