2d

Resources for 2d game physics [closed]

我的未来我决定 提交于 2019-11-28 02:45:41
I'm looking for some good references for learning how to model 2d physics in games. I am not looking for a library to do it for me - I want to think and learn, not blindly use someone else's work. I've done a good bit of Googling, and while I've found a few tutorials on GameDev, etc., I find their tutorials hard to understand because they are either written poorly, or assume a level of mathematical understanding that I don't yet possess. For specifics - I'm looking for how to model a top-down 2d game, sort of like a tank combat game - and I want to accurately model (among other things)

What is the difference between System.Drawing.Point and System.Windows.Point?

≡放荡痞女 提交于 2019-11-28 02:24:33
问题 What's the difference between System.Drawing.Point and the System.Windows.Point? In what context should which one be used? I'm working with WPF. 回答1: System.Drawing.Point represents a GDI point and is used in Windows Forms. It can only hold integer values. WPF doesn't use GDI anymore, so it has its own System.Windows.Point type to represents a point, which can have non integer values. 回答2: One is used with the classes in System.Drawing namespaces, and one is used with WPF. The System.Drawing

How to select a line

别来无恙 提交于 2019-11-28 02:15:45
So I'm trying to figure out how to implement a method of selecting lines or edges in a drawing area but my math is a bit lacking. This is what I got so far: A collection of lines, each line has two end points (one to start and one to end the line) The lines are drawn correctly on a canvas Mouse clicks events are received when clicking the canvas, so I can get the x and y coordinate of the mouse pointer I know I can iterate through the list of lines, but I have no idea how to construct an algorithm to select a line by a given coordinate (i.e. the mouse click). Anyone got any ideas or point me

Using PathIterator to return all line segments that constrain an Area?

喜夏-厌秋 提交于 2019-11-28 02:03:51
问题 In Java, how would one employ PathIterator to iterate through the line segments that constrain an Area? The Area is bound only by lines (but curve support wouldn't hurt). The method should return a collection of all the line segments. 回答1: This works (in all situations, I believe), but it might require more thorough testing: Area area; // The value is set elsewhere in the code ArrayList<double[]> areaPoints = new ArrayList<double[]>(); ArrayList<Line2D.Double> areaSegments = new ArrayList

Curve fitting with y points on repeated x positions (Galaxy Spiral arms)

余生颓废 提交于 2019-11-28 01:29:13
I currently have a MATLAB program which takes RGB images of traced spiral arms from galaxies and selects the biggest arm component and plots only that. I have tried using matlab's built in curve fitting tool with smoothing spline to fit it and I get the following result: I have tried using interp1 with parametric fitting to only get bad results. Is there a way to fit this type of curve at all? Spektre Your fail is due to that you handle your 2D curve as function which is not the case (you got more y values for the same x ) and that is why the fit fails on the right side (when you hit the non

check if two segments on the same circle overlap / intersect

时光总嘲笑我的痴心妄想 提交于 2019-11-28 01:21:26
Given two circle segments of the same circle: A=[a1, a2] and B=[b1, b2], with: a1, a2, b1, b2 values in degree between -inf and +inf a1 <= a2 ; b1 <= b2 a2-a1<=360; b2-b1<=360 How can I find out if these two circle segments overlap? (i.E. if they intersect or touch in at least one point) Examples: A=[ -45°, 45°]; B=[ 10°, 20°] ==> overlap A=[ -45°, 45°]; B=[ 90°, 180°] ==> no overlap A=[ -45°, 45°]; B=[ 180°, 360°] ==> overlap A=[ -405°, -315°]; B=[ 180°, 360°] ==> overlap A=[-3600°, -3601°]; B=[ 3601°, 3602°] ==> overlap (touching counts as overlap) A=[ 3600°, 3601°]; B=[-3601°,-3602°] ==>

Framebuffer FBO render to texture is very slow, using OpenGL ES 2.0 on Android, why?

空扰寡人 提交于 2019-11-27 20:36:40
问题 I am programming an Android 2d game using opengl es 2.0. After I draw my sprites to the backbuffer I draw lights to a FBO and try to blend it to the back buffer again. When I draw the FBO to the framebuffer, even trasparent without any color, the framerates drops from 60 to 30 on a Samsung Galaxy w (it has an adreno 205 as gpu). I searched everywhere and tried everything, even if I draw a single sprite on the scene and blend a trasparent FBO texture to the screen the framerate drops. I tried

Place random non-overlapping rectangles on a panel

只愿长相守 提交于 2019-11-27 20:13:57
I've a panel of size X by Y. I want to place up to N rectangles, sized randomly, upon this panel, but I don't want any of them to overlap. I need to know the X, Y positions for these rectangles. Algorithm, anyone? Edit : All the N rectangles are known at the outset and can be selected in any order. Does that change the procedure? You can model this by a set of "free" rectangles, starting with single one with coordinates of 0,0, size (x, y). Each time you need to add one more rectangle, choose one of remaining "free" rectangles, generate new rectangle (with top-left coordinate and size such

Inverse Bilinear Interpolation?

余生颓废 提交于 2019-11-27 19:54:44
问题 I have four 2d points, p0 = (x0,y0), p1 = (x1,y1), etc. that form a quadrilateral. In my case, the quad is not rectangular, but it should at least be convex. p2 --- p3 | | t | p | | | p0 --- p1 s I'm using bilinear interpolation. S and T are within [0..1] and the interpolated point is given by: bilerp(s,t) = t*(s*p3+(1-s)*p2) + (1-t)*(s*p1+(1-s)*p0) Here's the problem.. I have a 2d point p that I know is inside the quad. I want to find the s,t that will give me that point when using bilinear

2D Cross-Platform Game Development Engines [closed]

旧时模样 提交于 2019-11-27 19:45:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've worked for some time with Corona SDK and love how fast and easy I can create powerful apps using Lua. But it can only compile for iOS and Android, which feels like too little now. My main interest is for it to be able to compile to Desktop AND Mobile. At least for the following: Windows + Mac for desktop,