# Questions tagged [geometry]

A branch of mathematics concerned with questions of shape, size, relative position of figures, and the properties of space.

523 questions
Filter by
Sorted by
Tagged with
897 views

### Mythbuster: Mirror Operation with Quaternion

Mirror operation : all vertex positions must be reflected by a specific plane (here YZ).Synonyms: FlipHorizontal, SymmetryX, MirrorX, What implementations I already know that work: 1) Multiplying ...
• 931
706 views

### Using a vector to measure an angle relative to the screen / camera

My game is supposed to have an object that changes it sprite depending on which way the mouse faces. programming this has become a challenge, because I want to calculate the angle relative to the ...
• 130
152 views

### Detecting single circle within multiple circles area

There are multiple circles with same radius, given another circle in different radius, how to detect the another circle is fully in multiple circles area. Image below shows left samples is in the ...
• 49
8k views

### If a 3D vector represents a point, how can it have a length?

I am trying to understand vector arithmetic (and specifically its use in the Unity engine). I am not able to figure out how a vector can have a length (magnitude) even though it only represents a ...
248 views

### Find points inside a closed area

I have a 2D rectangular grid (100x100) with 3 types of cell (Empty, Base and Outline). I need to find cells inside the territory formed by Base and Outline cells. For example, in this scheme: I need ...
789 views

### Moving a sprite along a circle given by an implicit equation

I’m trying to create a hyperbolic version of Pong in a Poincaré disk, using C++ and SFML. Here is my problem: when the ball rebounds on a paddle, I deduce two coordinates allowing me to recover the ...
1 vote
91 views

### Ensuring linear velocity remains constant even when turning

I am using Ackermann steering to rotate a vehicle. The code is as follows: ...
• 57
128 views

### Best way to get the maximum moveable Area

I was thinking about creating a polygonal area, for a given unit, in which it can move with a given range (radius) but with care for obstacles. Here is a picture to visualize my idea: My Ideas so ...
• 161
1 vote
1k views

### Calculate evenly distributed points along a curve

I'm using this equation to calculate a series of points along a quadratic curve: ...
• 2,751
1 vote
109 views

### Making world geometry with Ogre3d

In Ogre3d's manual and in the documentation it's said that Ogre::Mesh shouldn't be used for world geometry. Quoting the manual: Mesh objects are assumed to represent movable objects and are not ...
797 views

### Determining Rectangle-Circle Collision Point

I'm developing a 2D game engine currently. I stuck on determining position of a rectangle that collides with a circle when its speed is added to its position. Rectangles have only x axis speed. On ...
461 views

### Calculate the leaning angle

I have an object moving around, let's say it's a cycle. In cycle dynamics, when the object takes a turn, it often leans into the direction of the turn. I would like to simulate this. I'm using the ...
• 250
257 views

### Find X,Y Spiral positions by given ID. Hard formula.

I need to spawn new villages in my grid-based game map. But i am weak in advanced math.. I need to fetch coordinates by id. These 2 constants can be other numbers. Please help with the function in ...
• 191
1 vote
136 views

### Speed of procedural geometries

I'm evaluating solutions for creating a VR videogame that should run on cellphones. The assets will be streamed from our servers and that could be a problem on limited capabilities devices. Since the ...
• 165
1 vote
148 views

### Problem with Rotating Third Person Radar UE4

I am doodling on the Flying game template on UE4. I am making a 2D radar on top left. Radar's north direction is the pawn's forward direction. So when it approaches to an object with the dotProduct ...
• 111
1 vote
4k views

### How can I randomly pick points on a triangle?

Please can help me for a geometry query, I am working out fast mesh to voxel algorithm without using rays and complex maths... What are the maths to sample N points on a triangle randomly? If you ...
• 253
31k views

### I'm rotating an object on two axes, so why does it keep twisting around the third axis?

I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can ...
• 135k
4k views

### How does one calculate the surface normal, in 2D collisions?

I have a ball, which should bounce when it collides with a surface. I know the formula for reflections; $$v_1 - 2n(v_1 \cdot n)$$ However, I cannot obtain the required information. I know: the ...
• 193
77 views

### There any way to insert images inside the code (just for comprehesion) in any IDE compatible with Game Engine Unity3D (Monodevelop for example)? [closed]

My code has a lot of geometry codes, thinks that shouldn't be represented just by comments I don't know if it exists, but should be fine to insert images like png in the middle of codes explaning that ...
• 279
55 views

### Coordinates of the corners of a rectangle bridging two circles

I am implementing a game that involves slingshots and circular objects. I have gotten the basic "geometric" construction down for rendering the slingshot, but I am having trouble implementing this in ...
1 vote
229 views

### Collision Detection works 2 sides

This might be really simple but it is giving me a lot grief and I wondered if you guys would be able to shed some light on it. Basically I have a tile map which draws tiles at 64 * 64 and that works ...
1 vote
224 views

### Reconstructing 3D Rotation from 8 byte - Assistence required

I am currently trying to load 3D models and animations into a program. The file format has no public description, so I am decoding them piece by piece. (I'm studying computer science and it's for ...
• 131
1 vote
909 views

### Overlap color between objects

I'm currently trying to build a game with Ogre3D that is basically a moving vehicle that leaves a green trail (2D manual mesh) in it's path, what i'm trying to achieve is exactly what this image shows:...
• 83
195 views

### Determine the z coordinate of a deformed plane based on uv (xy) coordinates

I am using a formula to turn the following texture into what looks like two 3 dimensional planes The formula I am using for the texture deformation is ...
• 674
86 views

### Push cube outside triangle face [closed]

I'm creating a 3D game, and I need to know how to push a player (axis aligned box/cube) outside a triangle. How can I get get the push direction?
424 views

### Move object forward according to rotation

How do I make an object (like a bullet) go forward according to its rotation in vanilla nodejs (my game server language)? For example, if an object's rotation is 0 degrees, then it goes straight up.
3k views

### Finding if 2 polygons intersect using clipper library

After realising my code was pretty inefficient at checking for polygon overlaps, I've turned to a mentioned library Clipper but finding it difficult to know hot to use it for this operation. I am ...
• 445
392 views

### Finding when shapes overlap and lines intersect but exclude points/edges

I've been looking for a c# algorithm to help determine if shapes and lines intersect but want to exclude boundary overlaps. Here's an example: My true problem is finding if polygons intersect but ...
• 445
1 vote
205 views

### Points inside a Polygon, failing for shapes with 0,0

I've been using an algorithm (http://wiki.unity3d.com/index.php/PolyContainsPoint) to tell me if a point is inside a polygon... in fact a few variants (here and here) but they all come back the same. ...
• 445
970 views

### Checking if shapes will tessellate

I'm trying to figure out where to start with getting code together to check if a shape tessellates. An example: Consider that the shapes cannot be rotated, just as-is. A 'compound' shape (as seen in ...
• 445
207 views

### Given a grid system where some coordinates are marked as impassable, how to find natural-looking car driving path between two locations?

I can compute an A* path, but I get only cardinal directions from that. A 45˚ path would look like "up 1 left 1 up 1 left 1 up 1 left 1..." My specific question is, given a grid with a pathing ...
• 484
4k views

### Algorithm for "healing" multiple rectangles into a smaller number of rectangles?

Say I have a grid of rectangles of different shapes and colors and I want to reduce (reasonably close to optimal is fine, optimal is not necessary) the number of rectangles to represent the same ...
• 484
30 views

### Lengthen Line (bidirectional) - crossing zero line

I'm trying to lengthen a line, by a certain amount. I want to apply the modification to both points on the line, expanding it in both directions. without moving it from it's current position (center ...
• 103
1 vote
155 views

### Calculating the inverse mesh of a 2D mesh inside a bounding box

If I have a mesh (drawn in red below) How can I calculate the inverse of the mesh (drawn in red below), given that the mesh is always constrained by the same four vertices of the encompassing ...
• 674
296 views

### What shapes interlock solidly like cubes?

What basic geometric shapes, besides cubes, interlock "minecraft" style like cubes? A small edit to make question more suited to Game Dev: I am experimenting with game dynamics to create geometric ...
• 173
262 views

### is there a way to check if a point is inside circle, other than distance between points?

Is there a way to check if a point is inside circle, other than distance between points? I am struggling with floating point precision problems. Is there some method to do the same test, but with more ...
• 15
10k views

### How to draw an arc between two angles?

I'd like to draw an arc between two specific angles. For example, "draw an angle between 0 and 90 degrees" and it will draw only that part of the circle and ignore the rest.
• 245
1 vote
680 views

### Best way to test if some point on a line if in front of another point on the same line in 3D

I have a line in 3D defined by point P0 and direction vector D. For given input point P on a line defined as above, I want to test if P is in front of point P0. The code will be used in GLSL fragment ...
• 73
1 vote
4k views

### Calculate length of isometric line

In my isometric game the user can draw a line of arbitrary length, and I need to calculate the "unprojected length" of the same line. Users can only draw lines in 6 directions (4 isometric directions ...
• 2,751
239 views

### How can I detect handedness of normal maps in a shader?

I've implemented normal maps into my game renderer using the formulas by Christian Schuler. It works OK with most normal maps but some not so much since in some the Y component (green) is reversed. ...
• 963
125 views

### Point plotting with a line graph

Please see attached screenshot. Here's how it works. A is a slider that goes up and down, and the red line uses the centre point of the A slider to draw its start point. B is another slider, but ...
6k views

### How does a 4x4 matrix represent an object in space and matrix lore?

I have been following some tutorials on how Matrix maths works, with adding, dividing, scaling, etc, but I am struggling to understand how the 4x4 matrix represents an object's position in space. ...
• 453
152 views

### Check if a 3D mesh is a rectangular prism

I have a mesh post-processor in Unity that automatically a convex mesh collider to objects that need one (mostly all). Sometimes however there are objects that only need a box collider instead. ...
152 views

### What is the formula for the collision of two "stretched spheres"?

In Smash Bros Melee, hitboxes aren't perfect spheres or boxes. They are, instead, a shape that looks like a continuous line of consecutive spheres: I.e., the geometry can represented as: ...
• 1,180
64 views

### rough texturing on edges of mechanical parts

How do major studios fake the effect of "wear & tear" on the edges of guns and other things? I've always wondered this, but today it got to the point where I figured, why not just ask you guys. I"...
373 views

### Applying texture inside of an Icosphere?

I have implemented a code to generate an Icosphere procedurally in Unity 5.3.4f, which works pretty well. However, what I need to do know it tweak the code to make the sphere to receive texture only ...
• 177
1 vote
279 views

### In Unity shaders, how is IN.worldRefl calculated?

I want to know how the world reflection vector in shaders is calculated so that I can manipulate it, but there is no documentation on what it does or how Unity calculates it. How is the reflection ...
202 views

### Draw a square given 2 corners

I am at the moment trying to come up with a simple method to extract some data points, given two corners. A*************** **************** ***************B I ...
• 135