Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [geometry]

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

17
votes
3answers
3k views

How to compute the area of an irregular shape?

I have a room object defined by a collection of looping line segments that I need to calculate the area for. The classes can be described as follows (in pseudo-code): ...
2
votes
1answer
144 views

How to achieve this sprite/mesh tile splitting like in Peggle?

Everyone knows Peggle. Here's a simple screenshot from one of their 'shapes': On the first look, it looks so simple. It's a circle made of identical tiles: It's ...
0
votes
1answer
2k views

OpenGL calculate UV sphere vertices

I am trying to implement a class Sphere in C++. Therefore I want to calculate the vertices in the constructor of the class (or in a seperate function..). Although ...
0
votes
2answers
985 views

How to rotate a local position offset based on a direction vector?

I'm trying to fire three raycasts in the direction of movement, from offset starting points. I'm having trouble calculating the start positions of the rays based on the direction. As you can see in ...
0
votes
0answers
40 views

How can I make a polyheadron regular in Maya?

Let's say that I created a tetrahedron manually, and for the sake of the question pretend that you can't just create pyramids as primitives. My pyramid is not a regular polyhedron; there are edges ...
-3
votes
2answers
1k views

Describing the spherical cap intersection between a spherical shell and a solid ball

I have: an infinitely thin sphere shell with center O1 and radius R1, and a solid ball with center ...
15
votes
4answers
3k views

Procedurally generating a building of specific area

Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly ...
0
votes
1answer
83 views

Oscillate an object's scale

I am able to scale an object using a scaling function I wrote. Internally it builds matrices that are multiplied by each of the vertices to transform them. The parameters I give the scaling function ...
1
vote
0answers
40 views

How can I append geometrical objects over a circle LibGDX

I want to draw geometric shapes over circle with using the graphics library in LibGDX like that; As you see from image, I want to append blue shapes to black circle. Any advice ?
4
votes
2answers
288 views

What should I use as units for my 2D game?

I'm trying to create my first C++ 2D fighting game from scratch, using SDL, and so far I got things to where I am able to move a couple sprites around using some keyboard keys. Right now, I have it so ...
1
vote
1answer
484 views

Circles within circle (PUBG safe zone)

I'm attempting to do something that resembles the safe zone in PUBG (PLAYERUNKNOWN'S BATTLEGROUNDS), a circular area on the map that shrinks over time. On map screen: ...
2
votes
2answers
427 views

How do I test if an AABB and concave polygon intersect?

The player's collider is an axis-aligned bounding box in my 2D platformer, but the environment can be different shapes. I already have collision-detection that prevents the player from going through ...
1
vote
0answers
283 views

Triangulating a 3D mesh from a set of data points

I'm trying to implement the Bowyer-Watson point insertion version of the Delaunay triangulation algorithm, but in 3D. I previously implemented the 2D version without problems, but when transitioning ...
1
vote
2answers
61 views

Compute Corners of Cuboid In 3D

How can I compute the eight corners of a cuboid given a Depth and Height and two points: A(x,y,z) and B(x,y,z)? Is it possible to calculate the eight corners/points of a cuboid given only a limited ...
1
vote
0answers
26 views

Algorithm for clipping convex quadrilaterals

I'm dealing with hardware that uses quads as its polygonal primitive. Not triangles. A triangle can be expressed by setting 2 of the 4 equal to each other for a degenerate quad. For the 3D engine, I'...
1
vote
0answers
29 views

Creating Smooth Corners when Converting 2D Polylines to 3D Models

Part of my game takes SVG polylines (which are just basically a set of x,y coordinates that define a multi-segment line) and converts them into 3D 'paths' (ie. a line created as a set of faces all ...
2
votes
2answers
154 views

Allow a Player to Navigate the 2D surface of a 3D mesh

Edit: Currently, I am looking for a method which will allow a player to control a 2D mesh and navigate along the surface of a 3D mesh. Visually, this would look like the player is inhabiting a 2D ...
1
vote
1answer
186 views

Determine the bullet / particle reflection off of a circle in node js using SAT lib functions

I can see how the calculation should occur from other examples such as: How to bounce a 2d point particle off of a circular edge. But I could use some help with the specifics for my inputs given ...
9
votes
1answer
2k views

How can I get the normal vector for a plane from a set of vertices?

I'm working on a HLSL / C++ little project to going over my graphics work, and I am unsure how I am to get a facing vector from a vertex polygon. I can't seem to find the formula. The positions are ...
0
votes
0answers
308 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 ...
2
votes
2answers
230 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 ...
3
votes
4answers
116 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 ...
27
votes
6answers
7k 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 ...
1
vote
2answers
64 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 ...
1
vote
1answer
62 views

Ensuring linear velocity remains constant even when turning

I am using Ackermann steering to rotate a vehicle. The code is as follows: ...
3
votes
1answer
87 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 ...
3
votes
1answer
306 views

Calculate evenly distributed points along a curve

I'm using this equation to calculate a series of points along a quadratic curve: ...
2
votes
0answers
60 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 ...
0
votes
2answers
280 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 ...
0
votes
1answer
96 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 ...
1
vote
2answers
155 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 ...
1
vote
0answers
113 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 ...
1
vote
1answer
77 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 ...
0
votes
2answers
662 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 ...
31
votes
2answers
9k 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 ...
0
votes
2answers
572 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; (v1 - 2(v1 • n)n) However, I cannot obtain the required information. I know: the ball ...
0
votes
1answer
58 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 ...
0
votes
1answer
42 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
3answers
189 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
0answers
84 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 ...
0
votes
1answer
344 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:...
0
votes
2answers
139 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 ...
0
votes
1answer
47 views

Push cube outside triangle face

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?
0
votes
1answer
81 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.
1
vote
1answer
865 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 ...
1
vote
1answer
92 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 ...
1
vote
1answer
126 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. ...
1
vote
1answer
244 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 ...
2
votes
2answers
90 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 ...
11
votes
1answer
1k 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 ...