A branch of mathematics concerned with questions of shape, size, relative position of figures, and the properties of space.
0
votes
1answer
14 views
How to find the points of intersection of two rectangular OBBs
In my game I need to be able to find the points of intersection between two rectangular OBBs.
I'm using Separate Axis Theorem to check if there's an intersection and get the penetration vector if ...
0
votes
2answers
86 views
which quarter of a triangle the point is in
I've got a world made out of squares. The square are devided in four triangles like this:
The corners have their heights stored in a 2D array and the center height is the average of the corners. To ...
0
votes
0answers
61 views
planning a spaceship path (possibly bezier curves)
Given a spaceship with a current position and velocity, I'm trying to plan a path to a given destination point, so that I can show a line plotting the course taken by the ship. It's in space so drag ...
3
votes
1answer
223 views
Explain this line segment intersection code
I've been reading this article on pathfinding over polygon meshes using line-of-sight, and in the article are several code snippets. One of them, the one I'm trying to understand, is a simple function ...
2
votes
2answers
178 views
How to make a projectile align correctly with the entity that shot it
I'm developing a 2D game. In the game, all entities can rotate 360 degrees. Each entity holds an angle value, and every frame it is drawn rotated around it's center by it's current angle value. For ...
1
vote
1answer
25 views
XY Location scaling with varying density screens
I have a phone with resolution H=1280,W=720,Density=2
I have a tablet with resolution H=1216,W=800,Density=1.331
I drew a rectangle on my phone with corners Left,Top (-1.6,1.55), Right,Bottom ...
0
votes
0answers
35 views
Equation / formula to determine an objects position on an ellipitcal path
I'm making a space game, as such I need objects to follow an elliptical path (orbit).
I've worked out how to calculate all the important aspects of my orbits, the only remaining thing is how to have ...
0
votes
1answer
50 views
Point in Polygon, Ray Method: ending infinite line
Having a bit of trouble with point in polygon collision detection using the ray method
i.e. http://en.wikipedia.org/wiki/Point_in_polygon
My problem is I need to give an end to the infinite line ...
1
vote
1answer
58 views
Reflection velocity
I'm trying to get a moving circular object to bounce (elastically) off of an immovable circular object. Am I doing this right? (The results look right, but I hate to trust that alone, and I can't ...
-2
votes
0answers
47 views
Convex Hull for Concave Objects
I want to implement 3D GJK and I want it to handle concave shapes too (almost all my shapes are concave). I've thought of decomposing the concave shape into convex shapes and then building a ...
6
votes
1answer
102 views
Tessellation vs Geometry Shader
Correct me if I'm wrong, but both the Geometry Shader and the Tessellation Shader jobs are to generate vertices in the Graphic Pipeline. What I would like to know is how they are different and when ...
1
vote
1answer
85 views
Sphere-Sphere intersection and Circle-Sphere intersection
I have code for circle-circle intersection. But I need to expand it to 3-D.
How do I calculate:
Radius and center of the intersection circle of two spheres
Points of the intersection of a sphere ...
3
votes
2answers
297 views
Find the next cell in a grid from a point and direction
I'm trying to solve a very simple problem but I'm unable to come-up with an efficient solution so far. What I'm really trying to do is voxelize triangles in a three dimensional environment but I'll ...
2
votes
2answers
94 views
Connecting two arbitrary points with 2 lines
DEFINITIONS:
Any "Point (x, y)" mentioned below is really the bottom left coordinates of a 1 unit by 1 unit rectangle. A "Line" is a defined as a rectangle that is either 1 unit tall and 1 unit or ...
3
votes
3answers
284 views
Throwing a ball and estimating its path using a Physics engine
The problem:
A player entity wishes to throw a ball from a known position with a known initial velocity. The surrounding environment contains physical objects that can alter the trajectory of the ...
1
vote
1answer
55 views
Calculate diameter of sphere large enough to encompasss a frustum
I'm attempting to speed up box-to-box collision checks by first testing if two spheres large enough to encompass each (respectively) would collide (because I'm using separating axis theorem and it's ...
1
vote
2answers
96 views
Find closest point from an origin, in a mesh
I want to do something similar to a raycast. With a raycast, you can set an origin and a destiny, and check where the ray collides with something but only with a line. What I want to do, is given an ...
1
vote
1answer
163 views
How do you make a bullet ricochet off a vertical wall?
First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar ...
0
votes
2answers
116 views
How do I add an image inside a rectangle or a circle in JavaFX?
Suppose we have a rectangle called r
Rectangle r = new Rectangle(40, 20);
and an image called image
Image image = new Image("...src for image");
How do I fit the image inside the rectangle? ...
2
votes
2answers
69 views
How can I test if a point is behind a polygon in 2D?
In order to improve the performance of my visibility graph generator I am trying to figure out the following.
Given the image below; is there a way to find out if a point is 'behind' the polygon? For ...
8
votes
1answer
490 views
How can I project a 3D point onto a 3D line?
Let's say I have a line defined by two points, A and B, both in the form (x, y, z). These points represent a line in 3D space.
I also have a point P, defined in the same format, that isn't on the ...
0
votes
0answers
93 views
Calculating intersection of line segment with view frustum
I want to calculate the intersection of a line segment with the view frustum.
Here's what I tried so far. The code works perfectly when the look direction vector is orthogonal to the line. E.g. ...
0
votes
0answers
60 views
Rasterizing euclidean planes
I'd like to visualize a BSP tree. To do this, I need to project an arbitrary euclidean plane onto a projection plane. I was thinking about calculating the intersections of the plane with the viewing ...
3
votes
1answer
134 views
Converting between Spiral Honeycomb Mosaic and axial hex coordinates
There seems to be quite a lot of logic in dealing with hexagonal grids using a system of axial coordinates like the one described here.
In doing some reading about hex grids, though, I ran across the ...
0
votes
1answer
37 views
Best method for selecting points from a point set - path distance
having a big set of points and a polygonal path what is the best way to select a set of points that are at a certain distance or smaller from the path?
Or do I need to iterate thru all points on each ...
0
votes
0answers
47 views
Java Angle Math: Calculate how near the player looks to an entity [duplicate]
I am programming a Minecraft Bukkit plugin and need a way to calculate an input number from 0 to 360 for displaying a custom compass / radar. So if the player directly looks at the object (shouldn't ...
8
votes
1answer
493 views
How do I make a curved surface out of rectangular blocks?
For a Peggle-like game, I want to make blocks that follow a curve, like this:
The blocks would then disappear as the ball hits them.
I managed to draw some horizontally, but I'm having trouble ...
1
vote
2answers
102 views
Calculate shadow map to overlay hidden line-of-sight things in 2d?
Given a 2D sideview with even-sized grid squares and our hero in a known center-ish position like this
... and imagining this hero's line of sight like this...
how could one get the point values ...
-2
votes
2answers
213 views
Convert atan2 value to standard 360-degree-system value [duplicate]
Lets say I'm using atan2 to get the angle between two vectors.
atan2 gives a value in radians. I convert it to degrees using a built in function in Java. This gives me a value between 0 and 180 ...
-2
votes
1answer
127 views
How does atan2 work when getting angle of a vector?
I know that atan2 gives me the absolute angle of any vector. But it doesn't give a value from 0 to 360 degrees. Instead, it gives a value (if I'm not mistaken), between 0 and 180, or between 0 and ...
0
votes
1answer
281 views
Using atan2 to calculate angle between two vectors
I understand that:
atan2(vector.y, vector.x) = the angle between the vector and the X axis.
But I wanted to know how to get the angle between two vectors using atan2. So I came across this solution:
...
1
vote
3answers
239 views
How to move an object along a vector
Let's say I got an object A and object B in a 2D game.
I create a vector leading from A to B. It's name is AB.
How can I make A move along the vector AB and reach B?
One way I was thinking of doing ...
4
votes
2answers
461 views
How do I use the dot product to get an angle between two vectors?
I am learning to use normalized vectors in my games.
I've learned that in order to know the angle between two vectors, I can use the dot product. This gives me a value between -1 and 1, where
1 ...
2
votes
1answer
80 views
map the section of a procedurally generated surface on a plane
I'll try to be as clearer as I can.
I have a surface on a 3D space which is not flat, it has hills and depths.
My goal would be intersect it with a plane so that I can map the section of the surface ...
2
votes
1answer
101 views
How do I compute the point of a triangle-ray intersection?
I have a line (the direction vector of the player) and a triangle representing the face of a model (so composed of 3 points).
I can't find the mathematical operation to check if that vector is ...
2
votes
1answer
274 views
2d grappling hook for platformer?
What are the options and mechanics for creating a grappling hook in a 2D game?
In the prototype for this feature, the person runs around in a platformer world and can throw the hook at any wall, ...
1
vote
2answers
90 views
How can I compute the movement of an object along a parabola?
I am working on a simple 2D game. In the game, I have a 'robot' that throws a ball towards another robot, in the shape of a parabola. Both 'robots' have the same Y coordinate.
The program knows the ...
0
votes
1answer
57 views
How to modify normal vectors with a tranformation matrix
Transformation is quite simple when it comes to Position or Color of the vertex, for Position just multiply matrix * vector and for color just don't do anything, but my question now is: How to handle ...
-1
votes
2answers
132 views
Using Geometric Slerp to move Camera
I'm writing a program in C++ using OpenGL and GLM; I'm trying to get my camera to follow my car. So far it successfully follows it around the screen, but I'm having trouble adjusting the Camera's ...
3
votes
3answers
871 views
How can I draw a quad in wireframe with modern OpenGL, without rendering the interior bisecting edge?
I want to draw a quad (not two triangles). I actually know that triangles are faster, as I answered this question.
But let's say I am building a 3D modeling tool. It makes sense to draw a quad for ...
0
votes
3answers
2k views
Spherical coordinate from cartesian coordinate
I am implementing a type for Ogre 3D rendering engine to provide spherical coordinates.
So far everything is working fine, until I try to build spherical coordinates from a cartesian vector.
Here is ...
7
votes
2answers
613 views
How does Unity3D lower an imported .obj vertex count?
I have a question regarding how Unity3D handles importing of .obj files.
I'm importing this teapot: http://groups.csail.mit.edu/graphics/classes/6.837/F03/models/teapot.obj
The number of vertices ...
1
vote
1answer
217 views
How to generate AABB, OBB & Sphere from polygon soup
How can I generate AABB, OOBB and Sphere from a polygon soup, where the bounding volumes are defined as follows:
AABB should be specified by min(x,y,z) max(x,y,z)
OOBB should be specified by ...
1
vote
1answer
86 views
How can I find a position between 4 vertices in a fragment shader?
I'm creating a shader with SharpDX (DirectX11 in C#) that takes a segment (2 points) from the output of a Vertex Shader and then passes them to a Geometry Shader, which converts this line into a ...
4
votes
2answers
277 views
a flexible data structure for geometries
What data structure would you use to represent meshes that are to be altered (e.g. adding or removing new faces, vertices and edges), and that have to be "studied" in different ways (e.g. finding all ...
2
votes
1answer
153 views
Why is there high performance hit with many meshes?
I am currently reading upon Geometry Instancing, as I want to render a lot of animatable objects on the screen.
However I have come to a more fundamental question first: Why do I even need to use it?
...
0
votes
2answers
1k views
How to determine the point of intersection of two lines? [closed]
I have two lines say P1( 0, -1, 0, -1 ) and P2( -1, 0, 0, -1 ). Since I'm working in 2D, there is no Z component. The x,y,z components are normals and the w component is the distance from origin. I am ...
4
votes
2answers
349 views
Allowing a player to walk up and down slopes without resistance
I am trying to implement a platformer where both the player and the level are made up of arbitary polygons. One requirement is that the player can stand still on slopes, and walk up and down them ...
1
vote
0answers
281 views
Geometry shader and triangle adjacency
I'm currently trying to change my project to use GL_TRIANGLE_ADJACENCY instead of GL_TRIANGLES.
Following this question, I have managed to construct my index buffer fine, but when it comes to the ...
2
votes
1answer
62 views
GL_TRIANGLE_ADJACENCY and glDrawElements
So I've not been able to find much online about how data should be stored for triangle adjacency.
Currently I calculate my adjacent using half-edges (mention in an answer here).
But do I store this ...