2d

projective geometry: how do I turn a projection of a rectangle in 3D into a 2D view

假如想象 提交于 2019-12-25 01:06:59
问题 So the problem is that I have a 3D projection of a rectangle that I want to turn into 2D. That is I have a photo of a sheet of paper laying on a table which I want to transform into a 2D view of that sheet. So what I need is to get an undistorted 2D image by reverting all the 3D/projection transformations and getting a plain view of the sheet from the top. I happened to find some directions on the subject but they don't suggest an immediate instruction on how this can be achieved. It would be

Line intersections for diagonals on a 2d plane in C#

…衆ロ難τιáo~ 提交于 2019-12-24 19:23:48
问题 Assume a 2D grid with the top left cell as (0, 0). Pick any two points/coordinates and draw a diagonal and anti-diagonal on each. They may intersect inside or outside the grid. In the picture attached, the red lines are diagonals to the two points (300, 200) and (700, 800). How can I find out the coordinates for the diagonal intersections? Also, how would the formula differ if the slope of the line were negative? I will use this in an algorithm that needs to be highly optimized so the right

Why isn't Java Fullscreen Exclusive Mode running my max screen resolution?

不问归期 提交于 2019-12-24 19:12:20
问题 I am trying to get the Java Fullscreen Exclusive Mode to run at 1080p on my computer, but it only has a size of 1536 x 864. The display mode is also set at 1920 x 1080. GraphicsDevice device = GraphicsEnvironment .getLocalGraphicsEnvironment().getDefaultScreenDevice(); // device.getDisplayMode() returns 1920 x 1080 and some other stats // device.getDefaultConfiguration().getBounds() returns 1536 x 864 I'm hoping to try to get the screen to be at 1920 x 1080 rather than 1536 x 864. Is there an

Unity collider going through other colliders at times?

三世轮回 提交于 2019-12-24 17:18:13
问题 I'm trying to create a Pong clone for practice. I setup my project in 2D. The paddle has the following components: -Rigidbody2D (set to kinematic ) -BoxCollider2D (is a trigger ) The ball has the following components: -Rigidbody2D (set to kinematic ) -CircleCollider2D (is a trigger ) The paddle is controlled via dragging (user dragging finger on screen left/right). I used the EasyTouch plugin for this. Then I move the ball with this script: void Update () { transform.position += new Vector3

Given an X co-ordinate, how do I calculate the Y co-ordinate for a point so that it rests on a Bezier Curve

我只是一个虾纸丫 提交于 2019-12-24 13:26:30
问题 I have a point (circled in pink) which has a known X co-ordinate and a known Y co-ordinate but the Y co-ordinate is incorrect. It is currently resting upon the point where the target bezier curve (the curve partially in a white square) would be if it were a line between its two points. I need to calculate the correct Y co-ordinate for my circled point so that it ends up on the red cross. I am a C# programmer and not a mathematician so if this answer could be expressed in code or with an

how to use a sprite as an anchor point of another sprite?

纵然是瞬间 提交于 2019-12-24 13:26:15
问题 I want to know , if you can , join two sprites in libgdx . Let me explain, I have a spaceship that I have to turn in my game ... and is the first sprite . another sprite I would put on the tip of the spacecraft so that when it turns me I through the second sprite I can always know the coordinates and so derive a vector in order to advance my ship . I'm new to libgdx and if anyone had any idea would be grateful. Thank You. EDIT : I would follow that always render the position of the other

Linear interpolation: calculate correction based on 2D table

扶醉桌前 提交于 2019-12-24 12:43:56
问题 I try to do a thing that should be nothing more than a two-dimensional, linear interpolation but currently I fail finding the correct approach. To describe the problem a bit simplified: there is a drawing area with a size of 3000x3000 pixels where I have to draw e.g. a horizontal line. To do that I'm drawing dots or short lines from every pixel position to the next pixel position which then forms a line. Now a correction has to be applied to the whole thing where correction information can be

Setting class level 2D Array variable to passed in value - C++

一世执手 提交于 2019-12-24 12:00:54
问题 I'm attempting to make a maze-solving program, and while the algorithm is sound (at least in my head), I've been running into a roadblock with 2D arrays. I'm coming from C# and Java, so the syntax is giving me grief. Here's an SSCCE: //Main.cpp #include "MazeSolver.h" int main() { MazeSolver mazeSolver; char maze[51][51] = { }; // Not bothering to show code for populating the array mazeSolver.setMaze(maze); } //MazeSolver.cpp #include "MazeSolver.h" MazeSolver::MazeSolver() { } void

2d cross product definition

筅森魡賤 提交于 2019-12-24 11:17:38
问题 In determine if line segment is inside polygon I noticed the accepted answer has an unusual 2d cross roduct definition of: (u1, u2) x (v1, v2) := (u1 - v2)*(u2 - v1) I have never encountered a definition of the 2d cross product such as this one. Can anyone enlighten me as to where such definition originates from? 回答1: I suggest you to take a look at Exterior Algebra. It generalizes the notion of cross product and determinant. The "Motivation examples" section describing areas in the plane

How to instantiate tiles based on a 2D Array into a Platform Game using Unity?

徘徊边缘 提交于 2019-12-24 03:18:08
问题 I'm building a very simple platform game using 2D array to build the map based on it. There are two simple goals I want and I'm currently not finding the answer: Ensure that the camera is 16:9 and my scene will be 100% displayed in it Build a 2D platform tileset as in an array My environment: Unity 5.5.0f3 (in 2D Mode) Camera projection ortographic size 10.9 Game displayed in 16:9 Tileset dimensions are 128x128 px Here is my current code: public Camera camera; public GameObject prefab; void