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
1
vote
0 answers

Is there any way to convert from decibles (light intensity) or candelas to an RGB value?

What I am trying to do: I am trying to simulate a lighting effect shown in the dropbox video link below. It's an HVF-ii machine during a glaucoma test. After the initialization (yellow lights), the test begins, showing white lights around the…
7alman
  • 157
  • 2
  • 3
  • 11
1
vote
0 answers

Dealing with simultaneous collisions in N-body sim

I have written an 2d N-body simulation in Python which allows collisions between the bodies. A body is modeled as a circle whose area is proportional to its mass. Each time the sim advances by one time-step, I identify which bodies have overlapping…
math_lover
  • 886
  • 7
  • 20
1
vote
3 answers

determining the starting speed for an accelerated animation (in flash/actionscript but it's a math question)

This question burns my brain. I have an object on a plane, but for the sake of simplicity let's work just on a single dimension, thus the object has a starting position xs. I know the ending position xe. The object has to move from starting to…
vulkanino
  • 9,074
  • 7
  • 44
  • 71
1
vote
0 answers

C Physics engine

I am working on a fabric simulator at low level, I have done some work and at this point there are some points where I would appreciate help. The input of the program is a DRF file. This is a format used in sewing machines to indicate the needles…
Charles
  • 98
  • 8
1
vote
0 answers

How to create a "Simple Harmonic Oscillation" on scroll event using Javascript

Currently I have a element on the page. I would like that object to oscillate left and right similar to the one in the example give below. However, I would like to bind the oscillation with the browser window scroll…
Rahul Dagli
  • 4,301
  • 15
  • 47
  • 85
1
vote
1 answer

Decelerate while moving in direction

Here's a quick description of what some of the methods you'll see do: this.bounds: Returns the ship's bounds (a rectangle) this.bounds.getCenter(): Returns a Vector2d representing the center of the ship's bounds. getVelocity(): A Vector2d which…
MCMastery
  • 3,099
  • 2
  • 20
  • 43
1
vote
1 answer

When and when not to use CoreAnimation

When programming for the iPhone, when is it best to use CoreAnimation over another API (and vice-versa)? OpenGL has a more generic range of features (being as low-level as it is). CoreAnimation is a lot easier to get set up, and it has features like…
vedosity
  • 720
  • 4
  • 15
1
vote
0 answers

Collision detection in Swift 3

I am trying to make an explosion occur when the Player and the Enemy collide. At the moment I am having problems with detecting the collision between the Player and the Enemy. I have tried various different ways and looked at various different…
Yes
  • 43
  • 4
1
vote
1 answer

Collecting large amounts of data efficiently

I have a program that creates a solar system, integrates until a close encounter between adjacent planets occur (or until 10e+9 years), then writes two data points to a file. The try and except acts as a flag when planets get too close. This process…
dlsj
  • 41
  • 9
1
vote
0 answers

SpriteKit Physics Joins Crash

I'm making a boxing game where each boxer is made up of sprite nodes attached using physics joints. The game works well but very rarely when I run a long automated test (chaos monkey style) the joints get tangled up, tear and the game crashes. Here…
Alex
  • 23
  • 2
1
vote
1 answer

How can I wrap objects so they are separate types that cannot interact?

I'm dealing with a lot of coordinate data, think predefined library types struct Point3d { double x,y,z; }; and the like from Eigen and OpenCV. Now, the coordinates of each point are expressed in some frame of reference. I'd like the type system…
1
vote
1 answer

Wave interference: adding two waves with opposite phases + using FFT - MATLAB problems

I have two main questions, but starting from the beginning: I wanted to know how FFT (fast Fourier transform) works on real examples. I created two sinusoidal waves (for example Wave1 = 5 Hz and Wave2 = 15 Hz amplitude), then I added those two and…
BloodyMary
  • 173
  • 13
1
vote
0 answers

I need the right Pixel Per Meter Ratio implementation using JBox2D - Not Using LibGDX

I'm building a game engine and I've added jbox2d. I'm struggling to implement the correct way of using PPM. I have 3 important classes where all the magic happens. Please review my code and SHOW me what to change. This is what I'd like to see…
1
vote
1 answer

Python scipy.special.mathieu equation

I am trying to relate the Mathieu equation found in Wikipedia Mathieu Equation to the one implemented in scipy.special. In Wikipedia there are 3 inputs, a,q and the parameter along which the integration proceeds. mathieu_cem takes three inputs, an…
Aussie2
  • 21
  • 3
1
vote
1 answer

2D Circle Collisions at slow speeds cause overlapping

I have been working on making a Physics Engine and came across a problem when handling circle collisions. The program seems to resolve collisions just fine in most instances. However at lower speeds the circles begin to overlapp one another. To…
AdiSuba
  • 21
  • 3