Questions tagged [geometry]

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

48 questions
262 views

Shrink a convex polygon

Shrinking a concave polygon is quite hard, to do well. But I expect shrinking a convex polygon would be easy. The naive approach of moving each vertex a certain distance to the centre gives me poor ...
1k 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 ...
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 ...
34 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 ...
19 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. ...
83 views

Get triangles after subdivision

I was able to do subdivision on a triangle mesh with midpoints but then I get polygons with too many faces. How do I convert to triangles after? Similar to this picture:
389 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:...
50 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?
79 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 ...
539 views

Why is this unity camera moving in weird directions?

I have the following script ...
50 views

How perform for obj follow mouse with angle?

how i can perform for sprite follow mouse if i change angle ? If i change angle the sprite no more follow mouse correctly. I absolutely need the obj follow mouse with pivot. https://jsfiddle.net/...
85 views

How to implement a pannini projection in opengl?

I have read about the pannini projection, which involves (I think) projecting a scene onto a cyclinder instead of a rectangle. How can I implement this projection in a vertex shader? Blinky is using ...
30 views

Defining a coordinate system for player residing in another coordinate system

I'm making a game and I wanted to simplify some code by taking advantage of linear algebra. I'm a little stuck. Let's say the player (green triangle) resides in a coordinate system where the x-axis ...
58 views

How to draw circular sectors on polar grid only within bounding rectangle

I'm attempting to optimize a game map by only drawing circular & annular sectors within the current viewable rectangle bounds. The solution should cover both cases in the example graphic (Figs 1 &...
93 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: ...
670 views

How to trace contour of shapes with holes?

I am experimenting with the RVO2 library for collision avoidance in a 2D simulation. This library supports specifying arbitrary obstacles as a list of vertices. The obstacles must be full shapes, i.e. ...
60 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 ...
68 views

Distance from capsule center to point on the surface

this question is engine agnostic, I will use the term "object" to refer to entities in my scene. The scenario is the following: I have 2 entities Entity O is a capsule Entity C is a point I want to ...
55 views

Modern way of getting points within a distance?

I'm making a game engine, and some components may want to interact with others based on distance. Currently, the component registers an update listener which runs on a loop, then it checks the ...
42 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 ?
356 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 ...
29 views

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'...
30 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 ...
63 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 ...
126 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 ...
91 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 ...
36 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 ...
201 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 ...
178 views

HLSL topology mismatch question

I'm trying to write a fur shader with the shells & fins technique. Currently I receive this DirectX error D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: The declared input primitive type in ...
221 views

2d grid vision(eye sensor) for a neural network bot?

I have a 2d grid and neural network bots living above it. What is a good way to give them vision of tiles in front of them? Below I describe my idea that I don't know how to efficiently(or ...
57 views

Detecting the two Vector3 that determine the bottom-edge of the side of a box-collider that had collision (with C#)

So, I understand that plenty of questions have been posted on how to detect which side of a Box Collider had collision. However, what I am trying to achieve is a little different. I want to find out, ...
650 views

Calculating Minimum Translation Vector in Separating Axis Theorem based algorithm

In the 2D SAT collision determination algorithm, you project the convex polygons onto each potential separating axis. Supposing the polygons intersect, from what I understand, the axis for which the ...
231 views

How can I keep vertex order the same on every Instantiate()?

While trying to resolve another question, I have discovered that if I Instantiate() from a prefab, the order of the mesh vertices (and therefore triangles) is inconsistent between instances. This is ...
69 views

Blender: calculation of elevation and rotation angle from plane

I have a generic plane (any location, any rotation around every axis) with its normal axis passing by the center. Then I have a generic point and I need to find the elevation and the rotation angle ...
10 views

Object's plane on image

I have a segmented image. So, for example, I know 2D coordinates of pixels for road on image. Now I want to know a plane of this road. How can I do this? P.S. I think it's popular problem, so I'm ...
54 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 ...
123 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 ...
20 views

Is it possible to generate a 2D surface that approaches certain mesh, and then a specialised ray-tracing function for it?

As an example, suppose we are trying to ray-trace a sphere. There are two options. The first one is to build a mesh of triangles approximating the sphere and ray trace it. Unfortunately, the more ...
43 views

Tetrahedron Circumsphere

Following this question, I want to create a sphere from a tetrahedron using this Wolfram support. But so far the resulted sphere is bigger than it should be and center seems to have an offset. ...
386 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 ...
140 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 ...
132 views

Project 2d click/touch onto 3d plane

I have a 3d scene that contains an infinite plane that is NOT parallel to the camera (so every screen coordinate corresponds to a point on this plane- in other words, there are no possible invalid ...
92 views

boost/geometry replacement in Java/for the JVM (Destructable Box2D terrain)

I'd like to reimplement https://github.com/seemk/DestructibleBox2D in Java. The main problem is finding an adequate replacement for the boost/geometry library. Any ideas?
50 views

3D Picking: Doesn't Work Consistently

I'm trying to implement a 3D picking function that at the moment simply calculates the ray being sent from the camera after the user clicks the mouse on the window. It kind of works well when the ...
757 views

Taking a 2D slice of a 3D volume

I have a regular 3D polygon and I'd like to display 2D slices of it. What is the best way to achieve this? (Preferrably in OpenGL, but a general algorithm/tecnique would be good as well). I've ...
45 views

Rotating between two coordinate frames

I have two coordinate frames, A and B. I want to create the rotation matrix RAB which takes you from A to B. A is a right-handed system, and B is a left-handed system. Furthermore, after moving from a ...