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
13
votes
6 answers

How to calculate both positive and negative angle between two lines?

There is a very handy set of 2d geometry utilities here. The angleBetweenLines has a problem, though. The result is always positive. I need to detect both positive and negative angles, so if one line is 15 degrees "above" or "below" the other line,…
Jaanus
  • 17,688
  • 15
  • 65
  • 110
13
votes
2 answers

How to get 1D column array and 1D row array from 2D array? (C# .NET)

i have double[,] Array;. Is it possible to get something like double[] ColumnArray0 = Array[0,].toArray() and double[] RowArray1 = Array[,1].toArray() without making a copy of every elemet(using for)? Thanks.
Jose Kiwi
  • 133
  • 1
  • 1
  • 4
13
votes
5 answers

Convert 2d images to 3d model

I need to display 3d sculptures in my application, but all I will have initially is 2d images of sculpture from different angles( angle and count of images is under our control) 1. Is there any library which can do that, e.g. take 8 images from all…
Anurag Uniyal
  • 85,954
  • 40
  • 175
  • 219
13
votes
3 answers

Best practices: efficient sprite drawing in XNA

What is an efficient way to draw sprites in my 2D XNA game? To be more concrete, I have split this question up into 4 questions. I used to declare Game1's spriteBatch static, and called SpriteBatch.Begin and .Close in every IDrawable.Draw. That…
Rudey
  • 4,717
  • 4
  • 42
  • 84
12
votes
3 answers

Algorithm to divide a chocolate bar in equal parts

A random thought popped into my head (when I was sharing a chocolate bar of course!). I was wondering if there is a generic algorithm to solve this problem. The problem goes like this: Info 1. You have a chocolate bar with small squares arranged in…
roy100
  • 205
  • 3
  • 9
12
votes
4 answers

Scrolling parallax background, infinitely repeated in libgdx

I'm making a 2D sidescrolling space shooter-type game, where I need a background that can be scrolled infintely (it is tiled or wrapped repeatedly). I'd also like to implement parallax scrolling, so perhaps have one lowest background nebula texture…
fundead
  • 1,321
  • 1
  • 14
  • 15
12
votes
3 answers

What's the best language for real-time graphics programming on Android?

Some googling has led me to believe that C++ is the best language for real-time 2D graphics programming, but since the Android is Java-based, is that still the best option? Or us the fact that I have to use NDK going to slow it down or something? My…
Kalina
  • 5,504
  • 16
  • 64
  • 101
12
votes
6 answers

2d trajectory planning of a spaceship with physics

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…
kikito
  • 51,734
  • 32
  • 149
  • 189
12
votes
3 answers

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…
Gavin
  • 9,855
  • 7
  • 49
  • 61
12
votes
3 answers

How to calculate end points of perpendicular line segments?

I know the end points of a line segment and the distance/size of the perpendicular end caps I'd like to create but I need to calcuate the end points of the perpendicular line. I've been banging my head against the wall using either 45-45-90…
basszero
  • 29,624
  • 9
  • 57
  • 79
12
votes
3 answers

2D animation in Python

I'm writing a simulator in Python, and am curious about options and opinions regarding basic 2D animations. By animation, I'm referring to rendering on the fly, not displaying prerendered images. I'm currently using matplotlib (Wxagg backend), and…
Dan Homerick
  • 4,118
  • 7
  • 28
  • 30
12
votes
1 answer

Computing a 2D signed distance field

I'm trying to compute a signed distance field of an black and white images pixels, but I think I've managed to get my code wrong somewhere. As this is my input and output: Input Output The issue I'm having is the black line in the middle of the S,…
thr
  • 19,160
  • 23
  • 93
  • 130
11
votes
1 answer

OpenGL 2D polygonal shape drawing and manipulation?

I'm working on a 2D game project where I am expecting users to draw 2D polygons (closed path) such as: Possible Solutions: 1 - Draw by Points and Calculate Border Lines. 1 Problem - Calculation of Border Lines. 2 - Start with an ellipse and let the…
Max Abrahamsson
  • 1,460
  • 3
  • 17
  • 35
11
votes
7 answers

Java 2D Game engine for tile-based Game

Can anyone recommend a good Java game engine for developing simple tile-based games? I'm looking for an engine that will allow me to build maps using something like Tiled www.mapeditor.org Slick is exactly what I'm looking for, …
DAH
11
votes
3 answers

Collision reaction in a 2D side-scroller game similar to "Mario"

This has been greatly bothering me in the past few weeks. In this time I've been researching online, even reading books in the Computers section at Borders to try to find an answer, but I haven't had much luck. I programmed a 2D level editor for…
Rob
  • 430
  • 1
  • 5
  • 13