collision

circle-AABB containment test

I'm currently in the throes of writing a system based on subdividing space (it's for a game), I need to be able to test if a circle completely contains a square. For bonus points, I should point out that my system works in N dimensions, so if your algorithm works by looping through each dimension and doing something, present it as such ...

Objective-C function dispatch collisions; Or, how to achieve "namespaces"?

I have an application for Mac OS X that supports plugins that are intended to be loaded at the same time. Some of these plugins are built on top of a Cocoa framework that may receive updates in one plugin but not another. Given Objective-C's current method for function dispatching, any call from any plugin to a given Objective-C routine ...

Django slugified urls - how to handle collisions?

I'm currently working on a toy project in Django. Part of my app allows users to leave reviews. I'd like to take the title of the review and slugify it to create a url. So, if a user writes a review called "The best thing ever!", the url would be something like: www.example.com/reviews/the-best-thing-ever. That's all well and good...

How can i check if 2 controls overlap eachother on a canvas in WPF?

I am writing a designer that enables the user to drag controls around the screen. What would be the best way of detecting if a control is overlapping another control while i am dragging the one control around? Should i just get the dimensions of the FrameworkElement and keep on checking the dimensions of the other elements? Thanks. Eli...

Can anyone help with the collision detect for my platformer? (Actionscript 3.0)

Im currently working on making a flash platformer engine...but my collision detect needs some serious help. Whenever my character 'jumps', and lands on the collision object, he goes about halfway through it for a split second, then goes back to the top (where I want him to be). If I continue to jump multiple times, the shadow of him, if ...

TFS rollback when user deleted file and created new one with same name

Someone (other than myself) accidentally deleted files in TFS and checked it in. He then discovered his error and wanted to replace the lost files, which he did - from his own hard drive. In between his error and my discovery of it, others have made changes to adjacent files. Now, I want to roll the deleted files back to their state befo...

What is a good 64bit hash function in Java for textual strings?

I'm looking for a hash function that: Hashes textual strings well (e.g. few collisions) Is written in Java, and widely used Bonus: works on several fields (instead of me concatenating them and applying the hash on the concatenated string) Bonus: Has a 128-bit variant. Bonus: Not CPU intensive. ...

How to resolve Rails model namespace collision

The story so far: I have a rails app with a model named "Term". All is well until trying to install Cucumber. Upon running rake cucumber I get Term is not a class (TypeError) This happens because Cucumber includes another gem, 'term-ansicolor' (to do the nifty colored text output in the console), and term-ansicolor defines a modul...

why MD5 collision failed?

The two data blocks are from this site,but failed to produce the collision : var_dump(md5('d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f8955ad340609f4b30283e488832571415a085125e8f7cdc99fd91dbdf280373c5bd8823e3156348f5bae6dacd436c919c6dd53e2b487da03fd02396306d248cda0e99f33420f577ee8ce54b67080a80d1ec69821bcb6a8839396f9652...

Triangle - Triangle Intersection Test.

I'd like to know if there is out there some tutorial or guide to understand and implement a Triangle-Triangle intersection test in a 3D Environment. (i don't need to know precise where the intersection happened, but only that an intersection has occurred) I was going to implement it following a theoric pdf, but i'm pretty stuck at the ...

2D Ball Collisions with Corners

I'm trying to write a 2D simulation of a ball that bounces off of fixed vertical and horizontal walls. Simulating collisions with the faces of the walls was pretty simple--just negate the X-velocity for a vertical wall or the Y-velocity for a horizontal wall. The problem is that the ball can also collide with the corners of the walls, ...

Chipmunk collision detection

Hello, I am completely new to chipmunk and I have just been using it for a few days, so I'm guessing this is something pretty obvious, however I cannot find any documentation for this. Is there any callback or method in chipmunk that tells you that 2 given shapes have collided?. If not is the best way to simply use cgrectcontains on th...

Chipmunk conditional collision on velocity?

Hello, I am doing a game with cocos2d and using chipmunk to manage the physics. What I would like to achieve is what pretty much every nintendo game does that your character may jump and rest in a higher floor (collision shape) without causing a collision as long as the velocity is positive, and that once the velocity is negative the co...

Algorithm for Gift Card Codes

I recently posted this question about codes for a gift-card-like voucher that users can redeem online. I wanted to find the best tradeoff between large keyspace, low guessability, and human readability. Now that I'm into implementation I realize I've got another problem altogether, more of an algorithmic challenge. Let's assume I adop...

Android id collision mechanism for R.java

We all know that when generating an id for Android using @+id/foo Android creates for us an entry in R.java like: public static final class id { public static final int foo=0x7f060005; } What happens if there is a name collision in different xml files (let's say, inside two layouts)? The @+id mechanism ensures us to overw...

How can I check if something leaves the Screen? - JFrame

I have a ball based on a component and I've thought that using the isShowing() method would do the trick but after my ball leaves the container, (Pong game) the isShowing() method still returns true. So does the isShowing() method check if the component is still in the container's... bounds? Or just if it is visible and the container is...

Shortest route to intersection

I asked this question about 2 months ago but found none of the answers to be helpful enough. So I am giving it another shot. I think it was my fault not describing it well enough. So lets try again. Here is a rough idea of what I am trying to accomplish. The goal is to send a projectile from point T to intercept the object represente...

I'm trying to get basic collision dynamics working

I've simplified things down to cubes/a single cube colliding with an infinite-mass rectangle and the following code: The problem is, the boxes tend to spin too much and get stuck together spinning and, if the binary search is included, just hit and spin a lot. Thanks for any and all help. /// <summary> /// Projects an abstract 1D line...

How well does .NET dictionary resolve collisions?

I have a problem with a custom object that needs to be keyed for a table. I need to generate a unique numeric key. I'm having collision problems and I'm wondering if I can leverage a dictionary to help me. Assume I have an object like this: class Thingy { public string Foo; public string Bar; public string Others; } and so...

How do I avoid name collision with macros defined in Windows header files?

I have some C++ code that includes a method called CreateDirectory(). Previously the code only used STL and Boost, but I recently had to include <windows.h> so I could look-up CSIDL_LOCAL_APPDATA. Now, this code: filesystem.CreateDirectory(p->Pathname()); // Actually create it... No longer compiles: error C2039: 'CreateDirectoryA'...