2d

2D vector modelling for game development

Making my Asteroids clone (in C) I've rather fallen in love with vector-based entities, but I've simply coded them in as x,y-point arrays. That's been fine for something like Asteroids, but what should I do if I want to make more complex 2D models? I note that there is an awful lot of 3D modelling software out there, as well as ample tu...

Traversing the boundary points of a polygon made of connected triangles

Hello I have a two dimensional polygon mesh made of connected triangles represented like this: vertex array: V = A, B, C, D, E, ... index array, triangle vertex indices in groups of 3 in counter-clockwise-order: I = 0, 4, 3, ... (so that e.g. V[0], V[4], V[3] which is A-E-D forms a triangle) Example mesh Now i want to traverse ...

Appropriate similarity metrics for multiple sets of 2d co-ordinates

Pardon me if this has been asked/answered before...my searches did not bring it up. I have a collection of 2D co-ordinate sets (on the scale of a 100K-500K points in each set) and I am looking for the most efficient way to measure the similarity of 1 set to the other. I know of the usuals: Cosine, Jaccard/Tanimoto etc. However hoping f...

Repaint on child jpanel

Ok say I have a JPanel "controls" and jpanel "graphPanel" within another jpanel public class outer extends JPanel implements ActionListener{ private JPanel controls,graphPanel; private JButton doAction public outer(){ JPanel controls = new JPanel(); JButton doAction = new JButton("Do stuff"); doAction.addActi...

CGAL 3.4: How do I get end vertex co-ordinates from a Finite_edges_iterator?

Here is some code: struct K : CGAL::Exact_predicates_inexact_constructions_kernel {}; typedef CGAL::Triangulation_vertex_base_2<K> Vb; typedef CGAL::Constrained_triangulation_face_base_2<K> Fb; typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS; typedef CGAL::Exact_predicates_tag It...

Buttons and Cartesian Coordinates

Hi, I have this scrollview "eager" to be filled up with buttons (4 per row), and resembling iphone apps icons, I want the user to be able to rearrange them has she/he pleases. If it were one row of buttons only, Apple Autoscroll tutorial app would be an excellent example to follow. Not the case, this is 2D and I cannot figure out how to...

2D image rotation, few issues

Hi, I'm adding "mouse rotation" to my 2D drawing program. I've got all the code working, by basically calculating the rotation angle from the original mouse click to wherever the mouse currently is. I also draw a transparent rectangle that rotates, instead of actually rotating the image on every mouse movement event. Now, my problem ...

Map a 2D array onto a 1D array C

I want to represent a 2D array with a 1D array. A function will pass the two indicies (x,y) and the value to store. These two indicies would represent a single element of a 1D array, and set it accordingly. I know the 1D array needs to be (arrayWidth *arrayHeight) in size, but I don't know how to set each element. For example if I passed...

Is there any Algorithm for converting 2d video into 3d video?

Is there any Algorithm for converting 2d video into 3d video? (for viewing using glasses) (a-la turning Avatar into Avatar for An IMAX 3D Experience ) or at least turn it into video prepared for feeling some 3d viewing using a-la or I know my question is asked(expressed) not in the best way so feel free to edit. ...

2d Game Making > Where can someone get Free Tilesets?

I have been scouring the internet for free tilesets that are open to you. I have found http://lostgarden.com/ It does not seem very useful. There are a few things here and there, but overall not much to really make a game off of. http://www.flyingyogi.com/fun/spritelib.html Spritelib is a little better it has some useful information,...

What is an infinite scaleless quadtree called?

2D spatial indexing question: What do you call a data structure that is essentially an infinite* quadtree whose nodes contain neither absolute coordinates nor absolute scales -- in which the coordinate system of each node has been normalized to the unit square (0,0)-(1,1), and in which the top-level node is not fixed absolutely? It's a...

Skia and Android Paint drawing objects and their use or documentation

Does anyone know of good documentation for the Skia drawing library used by Android? The main Canvas object has hardly any state, so I'm thinking especially of the objects you can embed into the Paint object. I've worked out by trial and error how to use some ColorFilters and made a cool effect with ColorMatrixColorFilter. Now I hav...

Running C# app inside browser as a plugin

I have a small 2D game engine written in C#, using DirectX. Is it possible to somehow run it in a browser as a plugin? Like for example Flash and others, where you go to a site with a game and it will ask you to install a certain plugin and then you can play the game in the browser, with mouse and keyboard input. I have searched around f...

Fast two-dimensional pattern matching

Consider a two-dimensional grid (the usual lattice in the plane). For my purposes, a pattern or arrangement is an assignment of the numbers 1 and 2 to some connected subset of the grid points. For example, the following shows three separate arrangements: .......1.....1.... .222...2.....12... .111...2.....2.... .222...22...12211. ........

2d game : fire at a moving target by predicting intersection of projectile and unit

Okay, this all takes place in a nice and simple 2D world... :) Suppose I have a static object A at position Apos, and a linearly moving object B at Bpos with bVelocity, and an ammo round with velocity Avelocity... How would I find out the angle that A has to shoot, to hit B, taking into account B's linear velocity and the speed of A's ...

Is there a visual two-dimensional code editor?

Let me explain what I mean by "two-dimensional code editor": imagine of using Inkscape or Gimp in a big canvas (say infinite). The "T - add text" tool is used to write the code. Additionally, all function definitions will be framed and links will connect the called functions. In other words: you have a very large sheet of (virtual) pap...

Contact simplex between 2D convex polygons

How do I find the point/line of contact between two convex intersecting 2D polygons? I have implemented both the Separating-Axis test and the GJK algorithm, but neither of these return the contact simplex between the shapes (although the EPA extension to GJK will give me penetration distance). edit: This is for a physics engine, so I n...

Help rendering sprite

What i want the program to do is draw the graphic ground at each point in which a one appears in the .txt file, but everytime i run it, it doesnt draw the sprite? here is the code..... using (StreamReader sr = new StreamReader("trainingLevel.txt")) { while (!sr.EndOfStream) { stri...

A simple algorithm for polygon intersection

I'm looking for a very simple algorithm for computing the polygon intersection/clipping. That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons. I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation...

XNA 2D vector angles - what's the correct way to calculate ?

what is in XNA in 2D the standard way vector angles work ? 0 degrees points right, 90 points up, 180 left, 270 down ? What are the 'standard' implementations of float VectortoAngle(Vector2 vec) and Vector2 AngleToVector(float angle) so that VectortoAngle(AngleToVector(PI)) == PI ? ...