Questions tagged [2d]

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models.

Flat perspective, having no three-dimensional geometry. Including two-dimensional space and 2D geometric models, or two-dimensional images having only height, and width with no depth.

7489 questions
263
votes
11 answers

2D cross-platform game engine for Android and iOS?

I've worked for some time with Unity3d and found it's 2D part with OnGUI() or GUITextures too clumsy. Also, even a smallest game done on Unity3d is at least 10MB download which is just too much for a 2D game. So, I'm currently looking for an engine…
iseeall
  • 3,381
  • 9
  • 34
  • 43
225
votes
7 answers

Difference between SurfaceView and View?

When is it necessary, or better to use a SurfaceView instead of a View?
Viktor
  • 3,295
  • 2
  • 25
  • 26
181
votes
6 answers

Drawing Isometric game worlds

What is the correct way to draw isometric tiles in a 2D game? I've read references (such as this one) that suggest the tiles be rendered in a way that will zig-zag each column in the 2D array representation of the map. I imagine that they should be…
Benny Hallett
  • 7,327
  • 4
  • 26
  • 26
146
votes
12 answers

Most efficient way to find mode in numpy array

I have a 2D array containing integers (both positive or negative). Each row represents the values over time for a particular spatial site, whereas each column represents values for various spatial sites for a given time. So if the array is like: 1 3…
Nik
  • 5,515
  • 14
  • 49
  • 75
121
votes
1 answer

Image to ASCII art conversion

Prologue This subject pops up here on Stack Overflow from time to time, but it is removed usually because of being a poorly written question. I saw many such questions and then silence from the OP (usual low rep) when additional information is…
Spektre
  • 49,595
  • 11
  • 110
  • 380
116
votes
14 answers

The best way to print a Java 2D array?

I was wondering what the best way of printing a 2D array in Java was? I was just wondering if this code is good practice or not? Also any other mistakes I made in this code if you find any. int rows = 5; int columns = 3; int[][] array = new…
Chip Goon Lewin
  • 1,213
  • 3
  • 10
  • 6
115
votes
23 answers

Declare an empty two-dimensional array in Javascript?

I want to create a two dimensional array in Javascript where I'm going to store coordinates (x,y). I don't know yet how many pairs of coordinates I will have because they will be dynamically generated by user input. Example of pre-defined 2d…
Zannix
  • 1,473
  • 3
  • 16
  • 26
112
votes
6 answers

Calculating a 2D Vector's Cross Product

From wikipedia: the cross product is a binary operation on two vectors in a three-dimensional Euclidean space that results in another vector which is perpendicular to the plane containing the two input vectors. Given that the definition is only…
Zack The Human
  • 8,373
  • 7
  • 39
  • 60
101
votes
16 answers

How do I calculate the area of a 2d polygon?

Assuming a series of points in 2d space that do not self-intersect, what is an efficient method of determining the area of the resulting polygon? As a side note, this is not homework and I am not looking for code. I am looking for a description I…
Jason Z
  • 13,122
  • 15
  • 50
  • 62
97
votes
5 answers

Android OpenGL ES and 2D

Well, here's my request. I don't know OpenGL already, and I'm not willing to learn it, I want to learn OpenGL ES directly since I'm targeting my development to android, however. I want to learn OpenGL ES in order to develop my 2D games. I chose it…
CoolStraw
  • 5,282
  • 8
  • 42
  • 64
85
votes
9 answers

2D Cross-Platform Game Development Engines

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…
Hate Names
  • 1,596
  • 1
  • 13
  • 20
79
votes
13 answers

How do I reverse-project 2D points into 3D?

I have 4 2D points in screen-space, and I need to reverse-project them back into 3D space. I know that each of the 4 points is a corner of a 3D-rotated rigid rectangle, and I know the size of the rectangle. How can I get 3D coordinates from this? I…
Joshua Carmody
  • 13,410
  • 16
  • 64
  • 83
77
votes
6 answers

Convert latitude/longitude point to a pixels (x,y) on mercator projection

I'm trying to convert a lat/long point into a 2d point so that I can display it on an image of the world-which is a mercator projection. I've seen various ways of doing this and a few questions on stack overflow-I've tried out the different code…
drunkmonkey
  • 1,111
  • 1
  • 17
  • 27
76
votes
10 answers

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…
Elazar Leibovich
  • 32,750
  • 33
  • 122
  • 169
67
votes
10 answers

Is there an efficient algorithm to generate a 2D concave hull?

Having a set of (2D) points from a GIS file (a city map), I need to generate the polygon that defines the 'contour' for that map (its boundary). Its input parameters would be the points set and a 'maximum edge length'. It would then output the…
Fabio Ceconello
  • 15,819
  • 5
  • 38
  • 51
1
2 3
99 100