2d

Creating a polygon shape from a 2d tile array

I have a 2D array which just contains boolean values showing if there is a tile at that point in the array or not. This works as follows, say if array[5,6] is true then there is a tile at the co-ordinate (5,6). The shape described by the array is a connected polygon possibly with holes inside of it. Essentially all i need is a list of v...

API for displaying video and drawing 2D elements

I'm looking for a Windows library/SDK that will allow me to do the following: Display video from a network stream Draw 2D elements on the displayed image in real time, such as lines, circles, text, etc. Use it in a commercial application (I don't mind paying for it) I'm willing to use any programming language or environment so there'...

Drag+Drop with physical behaviour

I'd like to implement a dragging feature where users can drag objects around the workspace. That of course is the easy bit. The hard bit is to try and make it a physically correct drag which incorporates rotation due to torque moments (imagine dragging a book around on a table using only one finger, how does it rotate as you drag?). Doe...

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 side and stitch it into a 3D model? Any opensource/commercial library/product is ok. 2. ...

Animations in a 2D C# XNA game

I want to create a 2d game in C# using XNA. There should be stickmen who can wear different weapons like a pistol, a grenade or a rocket launcher. And those stickman also should be able to do other things, like drink a bottle of beer and stuff.. So how do you create and store these animations (drink a bottle of beer, walk, throw a grenad...

Using OpenGL to accelerate 2D graphics.

Hello, Me and my friend are trying to accelerate a 2D game with OpenGL. The video chipset is Radeon X1250 which seems to be underpowered and can display up to some 80 1366x768 full frames/s. Given that we are drawing many sprites on top of each other the performace drops dramatically under the 60 FPS we are targeting at. Could you pleas...

2D Triangle in SlimDX

How to draw a triangle using SlimDX's Direct2D interface given triangle vertices are given in pixel coordinates? ...

Converting 3D positions to 2D?

Say I have a 3D object's position, and the camera's location and rotation matrix. How, would I go about converting this to a 2 Dimensional position on the screen? So that I could draw over the 3D object? You see, I'm using an engine that only allows 3D Env + 2D Gui, so I can't do my normal approach of drawing in 3D, but scaled up. I n...

Rotating 2D image/scriptable object in Google Earth (Is it possible?)

Is there a way to insert a 2D image into Google Earth which could then be rotated to always face the camera? It's done in Sketch-up with the man that stands there when you initially open a new scene. You can rotate your view around, but he will keep facing you until you look at him from the top, which then reviels that he is actually a ...

How can I build a 2D matrix from standard input in Perl?

Okay, I've been struggling with this all weekend, and I've gotten plenty of help but I'm still not getting it. Here is my code so far: what I want to do is build a few matrices from user input. Eventually I want to multiply them. Another story. input is as follows 1 2 2 4 4 5 6 6 1 2 2 3 1 2 2 3 sub makeMatrix { my ($input) = @...

2D Drawing in Netbeans 6.x

How can i draw 2d in a JPanel that i have on my GUI? I can do it in eclipse but am having trouble doing it in netbeans. I've looked for some tutorials but the only good one i found was for netbeans 5.5 (world's fasted java netbeans 5.5 tutorial) and i guess netbeans removed some of the things needed for that tutorial. ...

XNA - Merge sprites for better drawing performance?

Hello! I read somewhere that when rendering a lot of 3D objects one could merge these to form a giant mesh so that only one draw call would be made. Therefore letting the, quote: "GPU do its magic", while the CPU is free for other calls than draw. So to my question, would this be feasible to do in a 2D environment with performance in m...

Traverse 2D Array in Spiral pattern using recursion.

Hi, I am preparing for an interview and have been stuck on this question for quite some time now. Could anybody please help me with the code. If not complete then may be a snippet of it? Please.. ...

Insert a point into a finite 2D region with maximum distance to existing points.

I have a set of 2D points inside a finite 2D region of space (let's say a world-aligned rectangle to keep things simple for now). What would be an exceedingly efficient way to insert a new point into the set that has a relatively large distance to its new closest neighbour? I could slowly build a Delaunay triangulation and limit my sear...

Aligning Shapes on a plan, Algoryhtm

Hello Coders ! I am developing a simple diagram tool with shapes on a plan using flex. First i was using a simple 20*20 grid. But the real cool stuff out their is auto axe magnet effect, that's how i call it at least to see why i mean by that i made a small video of balsamiq. http://screenr.com/clB http://www.balsamiq.com/ As you ca...

[Qt/Opengl] Accelerate 2d Drawing

I'm triying to make a 2D real-time plot. I've tried with modifying the osciloscope example of qwt, tried to use QGraphicsView, and QPainter to reach high framerate drawing. I'm using 8 channels to plot data wich is arriving from a rs232 port. I take a sample every 10 ms. Maybe i've used the QPainter in a wrong way, but i couldn't draw ve...

How do I use OpenGL 3.x VBOs to render a dynamic world?

Although there seem to be very few up to date references for OpenGL 3.x itself, the actual low level manipulation of OpenGL is relatively straight forward. However I am having serious trouble trying to even conceptualise how one would manipulate VBOs in order to render a dynamic world. Obviously the immediate mode ways of old are non ap...

Mac dev - Help getting started with 2d games

I want to make some simple 2d games/clones (for Mac), but I have a few questions: Should I use Quartz 2d or OpenGL (I don't plan to try 3d anytime soon) There seems to be a lot of typedef'd things like CGFloat/GLfloat, which should I use? Should I use Objective-C for the game too (classes) or just C? (I assume I'll use Objective-C and ...

Mapping points from Euclician 2-space onto a Poincare disc

For some reason it seems that everyone writing webpages about Poincare discs is only concerned with how to represent lines and measure distances. I'd like to morph a collection of 2D points (as defined by x,y coordinates in the Euclidian plane) onto a Poincare disc, but I have no idea what the algorithm is supposed to be like. At this p...

How do I generate a contour graph?

How do I generate a contour graph like this: It's easy enough if the points are on a regular grid, but what if they aren't, like in my example? Is there a fairly simple algorithm to determine the color for each pixel? ...