# Tag Info

Accepted

### What is the fastest algorithm to check if two cubes intersect (where the cubes are not axis aligned)?

Separating axis test. (Also called separating axis theorem, separating axis theorem test, yada yada.) If you can find an axis (ANY axis), not just regular XYZ basis vectors) where the projections of ...
• 3,131

### Fast way to calculate angular intervals and occlusion of circular objects in a 2D vision cone

Here are some optimization suggestions: 1. Filter unnecessary tests Objects located outside the field of view circle(distance>r1+r2) do not need to be detected. ...
• 2,516
Accepted

### Best way to find line segment intersection

This problem can be extremely easy or extremely difficult; it depends on your application. If all you want is the intersection point, the following should work: Let A,B,C,D be 2-space position ...
Accepted

### Intersection of two limited planes (stripes)

For the case that someone needs this one day... I solved it by computing the intersection line of the two planes (explanation and code here: http://geomalgorithms.com/a05-_intersect-1.html ) and then ...
• 165

### How to stop sprite when overlap on in libgdx?

In your collision detection code you can do this to stop your player when he collides with the ball: ...
• 7,840

### How to snap a point to the height of the navmesh surface?

I found the function what does exactly what I need: ...
• 251
Accepted

### X axis intersection with inverted Y axis coordinates

This is way too complicated. Let's say the screen center is at (0,0), the asteroid coords are x,...
• 2,006
Accepted

### How to perform a fast ray cylinder intersection test?

First we'll subtract the cylinder center from the ray origin, to translate our whole problem to be centered at (0, 0, 0). Case 0: Inside First, check if the ray origin is inside the cylinder from the ...
• 134k
Accepted

### Ray-Box (AABB) is slower than without

It looks like you're using the bounding boxes on sphere primitives. A sphere intersection is very cheap, as computer graphics operations go. In fact, it's often substantially cheaper than testing ...
• 134k
Accepted

### Having some trouble with my frustum checking code

Assuming the "inside" of a plane is the opposite side of the plane.normal, the function IsSphereInsidePlane correctly determines if the sphere is completely inside ...
• 408

### Determine if a triangle is on the screen

There are three kinds of positional relationship between two plane figures: disjoint, one inside the other, partial intersection. You need to check for partial intersection and one inside the other. ...
• 2,516
1 vote
Accepted

### How to tell when calculating an Intercept Point between two moving objects, when it will never intercept?

From your description of the behaviour it sounds like your quadratic equation solver is breaking down. $$\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ For example, if a is 0 (which will happen if the ...
• 96
1 vote

### Fast way to calculate angular intervals and occlusion of circular objects in a 2D vision cone

My first move would be to use a Raycast at regular intervals between the start & end angles. In other words: begin at the starting angle perform a raycast ...
• 12.4k
1 vote
Accepted

### Ray-Square Intersection where the Ray always lies on the Interior of the Square?

Here's some glsl-type code for how we can do this. The trick is to think of the ray as a particle starting at some position and moving at some velocity. Then we can calculate how long it takes the ...
• 134k
1 vote
Accepted

### How to check if a point is on the plane given bottom-right point, top-left point, normal and the quaternion rotation of the plane

Let's assume your quaternion is set up so that it rotates the z+ vector to point along the plane normal, the y+ vector along the rectangle's "up" axis, and the x+ vector along the rectangle'...
• 134k
1 vote

### Sum of FoV enemies

Degrees are a very unusual way to represent directions in game engines. If you really want to use angles, then it is usually more efficient to handle angles in radians. But many engines do not use ...
• 119k
1 vote
Accepted

### Intersection point of two lines with given formula

s and t are the percentage of the line before the intersection point. If t is between 0 and ...
• 14.9k
1 vote

### line segment triangular-prism intersection

As far as I know the only somewhat efficient way is to take the line segment, iterate over the 5 planes of the triangular prism (one for each side), and "cut" the line segment by each plane. You keep ...
• 483
1 vote

### line segment triangular-prism intersection

You could try decomposing the prism into triangles and then test line against each triangle: as you say Moller-Trumbore triangle intersection can be used for this, for example: ...
• 428
1 vote

### Overlap color between objects

What you are essentially doing is counting the number of times each pixel is drawn to. There are two obvious ways to do this: incrementing the stencil buffer, or incrementing the color buffer using ...
• 111
1 vote
Accepted

### Clamp point to triangle for sphere collision

Had a few things backwards. After a couple days of research and toying with the code I finally got it working. Here is the finished method: ...
1 vote
Accepted

### I need to find intersection point of a vector in an axis aligned rectangle

The goal is to project the vector onto the correct sides of the rectangle. Using the tangens function we're already halfway done. The rest is basic trigonometry. Input data Depending on how you store ...
• 293
1 vote

### Cutting a 3D mesh with a 2D shape

Does it need to truly "Cut out" the mesh", or just look cut out? You don't mention the scenario so I'm going to assume that simply "looking cut out" would be adequate, and I'll assume this is ...
• 819

Only top scored, non community-wiki answers of a minimum length are eligible