physics

Projectile Motion in VB

What I'm trying to do is simulate projectile motion in Visual Basic using Visual Studio. Essentially, something like this but without air resistance or mass. Anyhow, the way I'm doing it is using a PictureBox and drawing the image in (of, say, a circle) every so often with a timer of interval 1 with its x and y properties being variabl...

Figure out acceleration to hit a target position with 0 velocity?

I'm trying to get my simulation to stop on a specific point. I have my starting position, an ending position, my current velocity and the time I'd like to take to get there. Since: d = vt + (at^2)/2 I was figuring that d = (end - start) a = 2(d - vt) / t^2 but my end point is way off when I run it. I've tried using two simple updat...

C# XNA Box2d: ApplyImpulse() acts surprisingly

I'm trying to move a body: if (ks.IsKeyDown(Keys.Up)) { rocket.ApplyImpulse(new Box2DX.Common.Vec2(0, 30f), rocket.GetPosition()); } Oddly, the body only moves when the key is released. Why is this? I've been looking at the manual but can't figure it out. When I remove the conditional, and just have the applyImpulse() call in Ste...

iPhone fluid simulation (like in Liquid app, using gravity etc)

How can i achieve Liquid app style fluid simulation? An I need LBM or SPH? I think SPH is too heavy for use on iPhone. But water in Liquid looks like SPH. Thank you! ...

Python: Visualisation of waves

Hello. I want to programm an easy visualisation of wave propagation. I tried this with visual python (VPython) but the programm is very slow. I want to use a 2-D visualisation now. Which module could you recommend? Tkinter? Matplotlib? For the computation i use numpy/scipy because it is fast. Thanks in advance. EDIT: Do you think ma...

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) |******** | ****** | **** | *** | *** | ** | ** | ...

General purpose physics engine

Is there any general purpose physics engine that allows huge simulations of rigid bodies? I'm using PhysX from Nvidia, but the focus of this engine is game development, soft bodies. I want to know if exists physics engine that runs on top of PS3 cell processors or CUDA cores allowing massive scientific physics simulations. ...

Simulation of molecular dynamics in Python

I am searching for a python package that I can use to simulate molecular dynamics in non-equilibrium situations. I need a setup that can handle a fairly large number of molecules in a primarily kinetic theory manner, and that can handle having solid surfaces present. With regards to the surfaces, I would need to be able to create arbitra...

How to get points that intersect the trendline?

Basically I did the Cavendish experiment, and I have a damped sinusoidal wave plotted on Excel. With Position (mm) against Time (s). My problem is that I have added a tread line through the wave function, and wish to calculate the points of which the wave function intersects the tread line. From this I will then be able to calculate the...

Detect&find intersection ray vs. cubic bezier triangle

While writing a model editor, besides enabling raytracing I can think about couple of operations where I'd like to find an very good approximation about the intersection point between a ray and a triangular bezier patch. How to do this? I know couple of ways but likely there's better ones. Exact use-cases: I might want to use one bezie...

Breaking a concave polygon into convex ones.

I'm using a game physics library (Box2D) which only supports convex polygon shapes. However, I'd like the level builder to be able to just specify concave polygons without having to worry about that. So, how can I automatically break apart a concave polygon into convex ones (or even all triangles). Speed would be cool, but ease of imple...

Implementing Projectile Motion

I've scored the internet for sources and have found a lot of useful information, but they are math sites trying to tell me how to solve what angle an object has to be at to reach y location. However, I'm trying to run a simulation, and haven't found any solid equations that can be implemented to code to simulate a parabolic curve. Can th...

How to get colliding effect or bouncy when ball hits the track.

** STILL NOT WORKING ** I am using below formula to move the ball circular, where accelX and accelY are the values from accelerometer, it is working fine. But the problem in this code is mRadius (I fixed its value to 50), i need to change mRadius according to accelerometer values and also i need bouncing effect...

Animation with Initial Velocity

I've been trying to solve this problem for a number of days now but I must be missing something. Known Variables: vi = Initial Velocity t = Animation Duration d = Distance. end velocity should always be zero The function I'm trying to create: D(0...t) = the current distance for a given time Using this information I want to be able to ...

2d trajectory planning of a spaceship with physics.

I'm implementing a 2D game with ships in space. In order to do it, I'm using LÖVE, which wraps Box2D with Lua. But I believe that my question can be answered by anyone with a greater understanding of physics than myself - so pseudo code is accepted as a response. My problem is that I don't know how to move my spaceships properly on a 2...

point light illumination using Phong model

Hello: I wish to render a scene that contains one box and a point light source using the Phong illumination scheme. The following are the relevant code snippets for my calculation: R3Rgb Phong(R3Scene *scene, R3Ray *ray, R3Intersection *intersection) { R3Rgb radiance; if(intersection->hit == 0) { radiance = scene->background;...

Closest Approach question for math/physics heads

I'm using a Segment to Segment closest approach method which will output the closest distance between two segments of length. Each segment corresponds to a sphere object's origin and destination. The speed is simply from one point, to the other. Closest Approach can succeed even when there won't be a real collision. So, I'm currentl...

Friction in Box2d

I am using Box2d for a topdown game. The "ground" is a series of tiles, where each tile is a static body with a sensor shape. Can I make friction take effect for this, even though the objects aren't really "colliding" with the ground? If Box2d won't let me do this, I considered trying to implement my own by detecting what force is curre...

Cosmic Rays: what is the probability they will affect a program?

Once again I was in a design review, and encountered the claim that the probability of a particular scenario was "less than the risk of cosmic rays" affecting the program, and it occurred to me that I didn't have the faintest idea what that probability is. "Since 1/2^128 is 1 out of 340282366920938463463374607431768211456, I think we...

Rewriting a for loop in pure NumPy to decrease execution time

I recently asked about trying to optimise a Python loop for a scientific application, and received an excellent, smart way of recoding it within NumPy which reduced execution time by a factor of around 100 for me! However, calculation of the B value is actually nested within a few other loops, because it is evaluated at a regular grid o...