2d

2d trajectory planning of a spaceship with physics

丶灬走出姿态 提交于 2019-12-18 10:24:50
问题 I'm implementing a 2D game with ships in space. In order to do it, I'm using LÖVE, which wraps Box2D with Lua. But I believe that my question can be answered by anyone with a greater understanding of physics than myself - so pseudo code is accepted as a response. My problem is that I don't know how to move my spaceships properly on a 2D physics-enabled world. More concretely: A ship of mass m is located at an initial position {x, y} . It has an initial velocity vector of {vx, vy} (can be {0,0

Outline (circumference) polygon extraction from geometry constructed from equal squares

梦想与她 提交于 2019-12-18 09:26:06
问题 I'm sure there must exist a way to do the following but I don't know what it's called so I cannot google it. I need an algorithm to go from A to B. Does someone know what it's called or has a link to it? EDIT: Sorry I wasn't clear enough. Figure A is made up of squares and I basicly need an algoritm which removes the squares and turns it into a polygon(Figure B). The input is a plain list of axis aligned squares, the output should be a list of vertices which make up a polygon. The squares

Outline (circumference) polygon extraction from geometry constructed from equal squares

寵の児 提交于 2019-12-18 09:25:47
问题 I'm sure there must exist a way to do the following but I don't know what it's called so I cannot google it. I need an algorithm to go from A to B. Does someone know what it's called or has a link to it? EDIT: Sorry I wasn't clear enough. Figure A is made up of squares and I basicly need an algoritm which removes the squares and turns it into a polygon(Figure B). The input is a plain list of axis aligned squares, the output should be a list of vertices which make up a polygon. The squares

Screen cropped issue in unity 2-D game

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 07:08:48
问题 I developed one 2-D game in unity. First I have run game on web player my screen is cutting from both ends. Now I am creating android apk from it. Then on android devices its also cutting from both ends. We are using free aspect ratio. I dont know much about screen size. So how to overcome from this problem? CameraFollow.cs script- using UnityEngine; using System.Collections; public class CameraFollow : MonoBehaviour { public float xMargin = 1f; // Distance in the x axis the player can move

Parametric Random Function For 2D Noise Generation

喜你入骨 提交于 2019-12-18 06:56:49
问题 I'm attempting to generate infinite random terrain. The terrain should generate the same every time given the same seed. I've tried using Java's Random function, creating the seed using various functions of the x and y co-ordinates of the given node on the terrain grid. Such as x*y+x+y+seed, 20*x+30*y etc. The problem with this approach is that I always see clear patterns in the numbers generated. So basically what I want is: f(x,y) = Random Number It would be helpful if the above function

Wrapping long text on an Android Canvas

安稳与你 提交于 2019-12-18 03:07:08
问题 I have a custom control that is doing a lot of 2D drawing straight to the canvas . Some of this drawing is text, so I am using the Canvas.drawText() method. I want to draw the text within some bounds - a top-left, certain maximum width, and a maximum number of lines. After drawing the text, I want to know how many lines it took. Is there a built-in function to draw text within bounds doing the splitting sensibly? If not, is there a standard recipe for doing so? 回答1: You can use the android

Wrapping long text on an Android Canvas

谁说我不能喝 提交于 2019-12-18 03:07:07
问题 I have a custom control that is doing a lot of 2D drawing straight to the canvas . Some of this drawing is text, so I am using the Canvas.drawText() method. I want to draw the text within some bounds - a top-left, certain maximum width, and a maximum number of lines. After drawing the text, I want to know how many lines it took. Is there a built-in function to draw text within bounds doing the splitting sensibly? If not, is there a standard recipe for doing so? 回答1: You can use the android

Getting text position while parsing pdf with Quartz 2D

Deadly 提交于 2019-12-17 23:09:48
问题 another question regarding pdf parsing... Just read PDF Reference version 1.7 "5.3.1 Text-Positioning Operators" and I am a little bit confused. I wrote some code to get transformation matrix and initial text position. CGPDFOperatorTableSetCallback (table, "MP", &op_MP);//Define marked-content point CGPDFOperatorTableSetCallback (table, "DP", &op_DP);//Define marked-content point with property list CGPDFOperatorTableSetCallback (table, "BMC", &op_BMC);//Begin marked-content sequence

Java basic 2d game animation stutter

烂漫一生 提交于 2019-12-17 21:15:00
问题 So, I have been working on a 2d rpg for some time now and I can't seem to fix this one problem. The graphics seem to "jump" or stutter every few seconds for an unknown reason. This is getting quite annoying because I don't know what is causing it. Here is a very basic program I wrote that just has a red square that moves from one side of the screen to the other side. Even in this very basic program the square still stutters every few updates and I really can't figure it out for the life of me

Function for rotating 2d objects?

前提是你 提交于 2019-12-17 20:10:14
问题 Is it possible to write a function in python that could rotate any 2d structure with the arguments being only the coordinates (x,y) of the points in the structure? Additional arguments would be included for axis, speed and direction. To my understanding it would only be possible by calculating point distance from symmetrical points and the axis and therefore it would always vary and is thus impossible except for 2d structures made up of standard shapes (triangles, rectangles, squares etc)