4 votes
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 ...
3Dave's user avatar
  • 3,131
3 votes

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. ...
Mangata's user avatar
  • 2,516
3 votes
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 ...
tinyfiledialogs's user avatar
3 votes
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 ...
DragonGamer's user avatar
3 votes

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: ...
Charanor's user avatar
  • 7,840
3 votes

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

I found the function what does exactly what I need: ...
Robotex's user avatar
  • 251
3 votes
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,...
HolyBlackCat's user avatar
  • 2,006
2 votes
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 ...
DMGregory's user avatar
  • 134k
2 votes
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 ...
DMGregory's user avatar
  • 134k
2 votes
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 ...
Turms's user avatar
  • 408
2 votes

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. ...
Mangata's user avatar
  • 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 ...
Paul's user avatar
  • 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 ...
Pikalek's user avatar
  • 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 ...
DMGregory's user avatar
  • 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'...
DMGregory's user avatar
  • 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 ...
Philipp's user avatar
  • 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 ...
Bálint's user avatar
  • 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 ...
Torious's user avatar
  • 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: ...
Biggy Smith's user avatar
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 ...
Stuntddude's user avatar
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: ...
Josyah Dooley's user avatar
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 ...
1000ml's user avatar
  • 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 ...
blurry's user avatar
  • 819

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