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
23
votes
4 answers

Plotting a 2d Array with mplot3d

I have a 2D numpy array and I want to plot it in 3D. I heard about mplot3d but I cant get to work properly Here's an example of what I want to do. I have an array with the dimensions (256,1024). It should plot a 3D graph where the x axis is from 0…
Fourier
  • 435
  • 2
  • 5
  • 10
22
votes
5 answers

Creating 2D dictionary in Python

I have a list of details from an output for "set1" which are like "name", "place", "animal", "thing" and a "set2" with the same details. I want to create a dictionary with dict_names[setx]['name']... etc On these lines. Is that the best way to do…
user2921139
  • 1,669
  • 4
  • 17
  • 25
22
votes
3 answers

Wrapping long text on an Android Canvas

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…
Will
  • 73,905
  • 40
  • 169
  • 246
22
votes
4 answers

Allocate 2D Array on Device Memory in CUDA

How do I allocate and transfer(to and from Host) 2D arrays in device memory in Cuda?
Gitmo
  • 2,366
  • 5
  • 25
  • 31
21
votes
3 answers

Centering text on the screen with SFML

I'm using SFML 2.0 libraries on Ubuntu 12.10, using sudo apt-get install libsfml-dev to get them. Now I'm trying to get a sf::Text centered in the sreen. To do this, I set the origin of the text (the place that is used to make transformations such…
Dani Torramilans
  • 340
  • 1
  • 2
  • 7
21
votes
2 answers

How to make a smooth camera follow algorithm?

I am making a game with LibGDX (Java). I need the camera to follow a fast moving character. The easiest way to do it is to just write this: this.getCamera().position.set(obj.x, obj.y, 0); But, is there any algorithm to make this more smooth? Like…
Avetis Zakharyan
  • 887
  • 2
  • 9
  • 20
21
votes
2 answers

Why do 2D transformations need 3x3 matrices?

I want to do some 2D drawing and thus want to implement some matrix transformations. With my light mathematics background I am trying to understand how to do so in C# (any other oop language would do it obviously). All I read is explaining that we…
Mr.Pe
  • 719
  • 1
  • 7
  • 19
20
votes
1 answer

Setting up a 2D view in Three.js

I'm new to three.js and am trying to set up what amounts to a 2D visualization (for an assortment of layered sprites) using these 3D tools. I'd like some guidance on the PerspectiveCamera() arguments and camera.position.set() arguments. I already…
gromiczek
  • 2,970
  • 5
  • 28
  • 49
20
votes
9 answers

How do I draw simple graphics in C#?

I just want to draw simple 2D objects like circle, line, square etc in C#. How do I do that? Back in the Turbo C++ days I remember initializing some graphics library for doing the same. Do I need to do something similar in .NET? Is it any different…
msvcyc
  • 2,569
  • 4
  • 24
  • 30
19
votes
6 answers

R generate 2D histogram from raw data

I have some raw data in 2D, x, y as given below. I want to generate a 2D histogram from the data. Typically, dividing the x,y values into bins of size 0.5, and count the number of occurrences in each bin (for both x and y at the same time). Is there…
Vahid Mirjalili
  • 6,211
  • 15
  • 57
  • 80
19
votes
5 answers

Build a simple HTML5/canvas 2D game. Game engine recommended to use?

I want to start learning HTML5 with canvas by building a simple 2d game. I want to build one that looks like this one: http://www.youtube.com/watch?v=h4SgiVCPfPk Do you recommend any framework or game engine I could use to do this?
pimpampoum
  • 5,816
  • 6
  • 24
  • 27
18
votes
1 answer

Mapping a height map to a grid-based contour format

I have a 2D height map in the following format 06 36 39 42 43 55 ... 37 40 43 43 45 46 ... 40 43 44 45 46 48 ... 44 44 46 47 48 50 ... 41 44 45 47 48 48 ... ... And I need to remap it into a grin based contour format (so it can further be mapped…
Sash
  • 4,448
  • 1
  • 17
  • 31
18
votes
4 answers

iOS - 2d image turn into a 3d

I was checking out this cool app called Morfo. According to their product description - Use Morfo to quickly turn a photo of your friend's face into a talking, dancing, crazy 3D character! Once captured, you can make your friend say anything…
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
18
votes
2 answers

Working with the coordinate system and game screen in Unity 2d?

So I've developed games in other platforms where the x/y coordinate system made sense to me. The top left representing the game screen with coordinates of (0,0) and the bottom right was (width,height). Now I'm trying to make the jump to Unity 2d and…
Eric Smith
  • 1,336
  • 4
  • 17
  • 32
18
votes
1 answer

2D drawing in OpenGL: linear filtering with pixel accuracy at native size

Short version: Is there a general approach in OpenGL that will allow pixel-perfect 2D drawing of textures from an atlas when drawn at native size (including edge pixels), and good quality scaling when filtering to non-native size? More detail on the…
Benji XVI
  • 2,192
  • 1
  • 25
  • 24