# Questions tagged [geometry]

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

430 questions
Filter by
Sorted by
Tagged with
37 views

### Approximately circular range of motion on a square tile grid

I've been working on a grid based tactics style game to learn the ropes of Unity. I have an issue with movement range for a player unit. Let's say the units move range is 3 spaces.. If I set up each ...
49 views

### Finding equivalent axial coordinates for a wrapping hexagonal map of radius n

I'm creating a wrap around hexagonal map that will potentially render infinatly. With the method I'm using, I have an x-y coordinate I use to find it's equivalent axial coordinate with the equations:...
23 views

### Intersection of ray and non-axis-aligned box

I need to compute the intersection of a ray with a non-axis aligned box. Currently, I transform the ray into the local space of the box, do classic ray-AABB intersection and transform the intersection ...
35 views

### Get vertices of a terrain mesh affected by a brush or placement shape

I have the following mesh, it has very simple structure. You can think of it as a terrain from top-down view: each vertex (red and numbered) is a fixed distance away from its four neighbours in the ...
24 views

### Finding the line segments where 2 polygons share an edge

I am working on code to place doors between rooms on my levels. Rooms are lists of points which make up a polygon. In order to find a place for a door between two rooms, I need to find what line ...
29 views

### Algoritm for scaling an 3D model with fixed edges

I am looking for an algorithm that allows me to scale a 3D model with certain fixed edges. For example scaling up a window should have the frame remain a fixed width while the length of the frame ...
32 views

### Finding Endpoint of line in Unity

I have a startpoint, magnitude(length) and direction and want to find endpoint to construct the line here is the code to make question more clear ...
33 views

### Unprojeting a line on the screen

I have a line connecting two points of my model. I see a projection of this line on my screen and a want to map a point of that projection to the corresponding point in my model PoV. Let ...
25 views

### Figuring out the exponent in a spotlight equation from the angle of a cone

I followed a tutorial on how to build a spotlight using DirectX. This tutorial uses a point light equation plus a line of code to limit the light to the shape of a cone. I have everything working, but ...
27 views

### How to properly space train bogies

I have a small project with a train that follows a track, composed of discrete pieces. For each piece I calculate the location based on distance traveled, and each carriage gets a fixed offset. I ...
39 views

### How to calculate plane corner vertices from plane origin point and plane normal?

I have an origin point, and normal vector of a 3D plane. I want to calculate 4 vertices to use as the corners of a 2 triangle quad to render the plane.
50 views

### Tube model imported from Blender getting stretched vertically when rendering

I'm actually working on a 3D game engine with OpenGL 4 and C++. The problem is that, I don't know why, my geometry isn't well renderered except for primitives. At the right you can see a cube, it is ...
55 views

### Pong paddle and deflection angles

I'm trying to make a pong clone and am having trouble grasping ball deflection. The way I'm approaching it is to increase the angle by how far the ball collides from the middle of the paddle. However, ...
35 views

### Finding rotation quaternion from orthonormal basis?

Given three 3D unit vectors $a$, $b$, $c$ such that: $a \times b = c$ $b \times c = a$ $c \times a = b$ (ie $a, b, c$ form an orthonormal basis) How do we calculate a unit ...
22 views

### Tilemap Collision Generation - Tracing Polygons with Slopes

I've been using Godot for my game, but it has a unfortunate quirks with tilemap collision where physics objects can bounce weirdly near tile seams and kinematic bodies can often get stuck in seams as ...
54 views

### High speed collision detection using separating axis theorem

I’m using the SAT and the minimum translation vector from it to detect and handle collision in my 2D game. It works great for regular speeds, (i.e. when the speed is low enough so that an object doesn’...
59 views

### how can I transform a skewed line to a vertical line?

So, I have a line: And I skewed it with x += y * cos(angle) and got something like: My question is, if I have another line segment with that same skew, how can I ...
56 views

### Calcluate Mesh top, bottom, left and right position relative to mouse click position on the mesh

I have a mesh (suppose it can be circle, or rectangular,square or an arc). The geometry of the mesh can be anything. I can click on mesh at any position. From relative to the clicked position, I want ...
69 views

### How to “aim ahead of” an object moving in a circle? [duplicate]

Let's say I have a GameObject A that's moving in a circular path in orbit around a central point, and I have a second GameObject ...
128 views

### How to find perpendicular line given a line?

I have two points that form 1 line. I want to find a point that creates a perpendicular line. Here is an image showing what I am looking for: How do I find the red point to form a perpendicular ...
69 views

### Draw a line along one continuous edge of a curved mesh

I have a rectangular mesh, but the mesh is curved: I want to draw a line along one side of this curvy mesh. Currently I can easily draw line along a side of a flat rectangular mesh by getting the ...
95 views

### Unity 3D rotating object around 2 axes rotates it around 3

I am developing a 3D space shooter and I've fount that when triying to rotate the ship using X and Y axes it also rotates on the Z axe. The answer here helped me a lot, but now when I try to rotate ...
109 views

### How do make a box collider align with a line renderer continuously?

I am having the issue of aligning my BoxCollider2D with my linerenderer. I am trying to have a laser shoot using: ...
19 views

### Can I slightly rotate a 2D vector (UV Edge) to more closely reflect the corresponding 3d vector?

I'm trying to get the difference between the 3D angle of two connected edges and their corresponding angle in 2D (mesh to UV space). I would like to slightly rotate the angle in 2D to closer match ...
39 views

### Find optimal placement for label/sticker on a simple polygon with holes

I'm working on a real-time archviz renderer and I need to place a label/sticker/decal on walls, which have openings. So one way to think about this is a simple (possibly concave) polygon with holes. ...
176 views

### How do I launch a ballistic projectile to hit a moving target, given: launch position & angle, target position & velocity?

This problem is in 3D space. My question is: How do you find the initial velocity of a projectile that flies under constant gravity, so that it hits a target moving with constant velocity, given the ...
19 views

I am very new to Maya and trying to make a Nikon F camera from reference images. I can't quite wrap my head around how I would make the shape on top of the camera because it is essentially a square ...
81 views

### Detect walls in geometry

Is it possible to automatically detect walls in polygon soup? Of course it's hard to strictly define what a wall is, my slightly vague definition would be: A wall is a largest possible box (not ...
57 views

### How to know if two surface are in the same direction?

In my code I creat a Mesh that are composed by multiple tile. those tile can have edge that are shared, and I need to know if the normal of the tile that have shared edge have the same direction, ...
70 views

### Calculating approximations of contact between two meshes

I'm looking for ways to calculate the degree of contact between two objects in a scene. I was thinking that calculating the hausdorff distance would be a useful approximation if it is then normalized ...
2k views

### Convert 3D direction vectors to yaw/pitch/roll angles

I have the code below that takes a set of yaw, pitch, and roll rotation angles (in degrees), and populates forward, right, and up basis vectors to express this rotated orientation as a Cartesian ...
16 views

### Moving and rotating object with another object [duplicate]

Sorry i bad painter)) Need move and rotate 'OBJECT №2' with 'OBJECT №1' I have origin point(also rotation point) and angles of two object. (Also min and max coordinates of these objects) Vector ...
125 views

### How can I build an array of coordinates of a truncated icosahedron's faces?

I can easily get a list of coordinates of all the vertices—the Wikipedia page has formulae and this page has a list of them, but that doesn't tell me which ones are part of which face. What I'd like ...
136 views

### Move and rotate one object to another C++ [3D]

I have two object, need attach 'TWO OBJECT' to 'ONE OBJECT'. I have vectors 'angle' 'origin' of ONE and TWO objects. I tried do "TWOOBJECT.origin += ONE.origin - ONE.oldorigin", this just attach ...
385 views

### How to detect least distance to line segments calculation

I'm trying to calculate the distance of the player to a few lines that intersect two points, and return the smallest distance (i.e. tell me which of the lines the player is closest to/how far the ...
114 views

### Click on an isometric plane and obtain normal coordinates

I have photos distributed as cells. When I click, I get the corresponding row and column. console.log("Col:" + X + "Row:" + Y); When applying an isometric view conversion like this: ctx.translate(0, ...
594 views

### Most efficient way to get the closest point to a 3d rectangle

I have a 3D rectangle, with 4 points (x,y,z) And I have a player, who can be anywere (inside the rectangle, outside, not even in the plane, in the corner...). I would like to get the closest point in ...
74 views

### algorithm to change the center of the image

I need and algorithm in Java if possible to change the center of the image when scaling.What is happening to me is represented in the first image: when I scale the image the image scale according to ...
66 views

### Unity3D - Generate a position within a circular band around the player

Given a certain condition in my game I need to generate a position around the player. It needs to be at least 8 meters away from him and within 10 meters, in a circular matter, as in the dotted green ...
70 views

### Calculating surface normal numerically

Say I have a 2D surface defined with the use of bitmap. I want to use this bitmap for collision detection (white color is where object can move freely, with black I mark the walls). How can I ...
78 views

### Get a Jump normal gravity based on Attractor Points, lines or Quad placed in the Level Design (in a Mario galaxy like gravity)

I have an algorithme to find. I have a player in a 3D space on a random planet. My goal is to have an oriented gravity toward my planet. And when I jump: Find the right normal direction. BUT I can't ...
104 views

### Getting the Closet Points between Polygons with the GJK Algorithm

I am trying to implement the GJK algorithm by following this lecture. For the most part, it is working, but sometimes 1 of the 2 closest points is incorrect. Here are two examples: EXAMPLE 1: The ...
145 views

### Find transformation to align two polygons at fixed points?

Problem I have a source image (arbitrary width and height c) shown here as a rectangle [X1,X2,X3,X4]. It contains two points C and D (both known coordinates within ...
86 views

### How to determine polygon based on point lists?

I have several lists of interconnected points. They are ordered so I can connect them together. Using these interconnected points I'd like to find the different points and intersection points that ...
74 views

### Interpreting focal length in units of pixels

I am working on a renderer of sorts and I have some fundamental questions. Let's say I have a vector in a 3D virtual world space which is unitless, and I want to project it onto a 2D screen, so I need ...
526 views

### Get closest point on box to line

Eventually this problem will be 3D, so I would like a solution that works in 3D. My player is looking forwards. There is an axis-aligned box on the screen (FOV is guaranteed to be 90, so boxes behind ...
109 views

### How can you tell if you are a large player on a large map or a small player on a small map?

If everything is scaled by a constant factor, can you tell that the world is smaller or larger? I think you could look down at the ground and see that it's "closer". But how do you know what ...
34 views

### Get the mesh Project Plane on Click and calculate its area

Here is the excerpt of my script which is calculating the surface area and face area of a mesh on OnMouseDown Event. ...