2d

Merge (Boolean Union) rectangular regions with integer accuracy

Given any number of intersection, disjoint and touching rectangles, how to find the (multiple) outline polylines? Rectangles are defined in pixel coordinates so they have integer accuracy, but they may be thousands of units large. I really need numeric coordinates for the outlines, merging GDI regions won't do. I know I can simplify t...

Wall detection algorithm

What would be the sanest/simplest approach to do wall detection on static images? It doesn't have to be in real-time. Right now I'm using corner detection, but is there a simpler way to detect only the walls and discard all the smaller irrelevant corners detected in foreground objects? edit Target images are standard pictures of indoo...

Android: adding a bitmap texture to a non rectangular item

I have a widget which looks like this: Every cone is a "touchable element". Now I want to put a bitmap texture above each cone. However, bitmap images are all rectangular, so a bitmap texture above one cone would interfere with the bitmap texture above another cone. I'm wondering what is the best solution to this approach. Should I j...

A good 2D-primitive rendering library for C#/.NET?

Hi, I'm developing a C#/.NET application (Winforms/WPF, not entirely decided yet) which needs to display simple diagrams: boxes/"text boxes", lines/arrows, circles, text etc... Some items on the diagram need to be clickable/selectable, allowing me to display e.g. a dialog for filling in data on the selected item. I guess the diagram...

How to align shapes together? (Geometrical Best-Fit Algorithm)

I'm working with mecanical engineers who rely on 3D modeling software. These softwares have a "Best Fit" feature. It allows you to acquire data with a sensor (like a 3D scanner) and align the mesured data with a CAD Drawing. I'd like to know how such an algorithm can work! In simpler words, imagine that you have 2 NEARLY identical tria...

How To Extrude a Flat 2D Mesh, Giving it Depth

I have a set of co-planar, connected triangles, i.e., a 2D mesh. Now I need to extrude it out a few units in the z-axis. The mesh is defined by a set of vertices which the renderer makes sense of by matching up against an array of triangles. Example Mesh: Vertices: (0,0,0), (10,0,0), (10,10,0), (0,10,0) <-- (x,y,z) Triangles: (1, 2, 3)...

2D Bounding box collission

Hi, i'm having some problems with collission in a small 2D game i'm writing. I'm currently working on a function that i want to find if the player character collides with a block, and which side of the block he collided with. Currently i have something like (psuedo-code): if(PLAYER_BOX IS WITHIN THE BLOCKS Y_RANGE) { if(PLAYER_BOX_...

Calculating the angle (of the line) between two points on a wrapping plane

OK, so I have a play field of 512x512 which wraps around, -32 becomes 512 for both x and y. Now I need to calculate the angle between two entities, I have the following code as a kind of workaround, it works most of the time, but sometimes it still fails: Shooter.getAngle = function(a, b) { var ax = a.x; var bx = b.x; if ...

Android: looking for a drawArc() method with inner & outer radius

I have the following custom view: This I have achieved by using the Canvas' drawArc() method. However, with this drawArc() method I cannot limit the arc's inner radius. What I'd like to have is something like this: where there is only an outer ring left. What I need is an drawArc() function where I can set the inner radius of the...

What is the best pratice to render sprites in DirectX 11?

I am currently trying to get used to the DirectX API and I am wondering what is the usual approach to render a sprite in DirectX 11 (e.g. for a tetris clone). Is there a simmilar interface as ID3DX10Sprite, and if not, which would be the usual method to draw sprites in DirectX 11? Edit: Here is the HLSL code that worked for me (the com...

Why is SDL so slow and how can I get it to run faster?

I have the following test setup: 1024 * 768 screen surface created with SDL_HWSURFACE The main loop consists only of SDL_Flip() and a simple FPS counter The problem is: I am only getting around 1000 FPS with this. Which is really really low when you consider that you do not even draw anything! The FPS drop really fast when I contin...

can Android produce 2d image effects similar to those possible with Flash's DisplacementMapFilter class?

Hi all, I'm interested in reproducing the image effect seen in the iPhone app Wobble (where users could define circular regions on 2d images which would then have a displacement-like warp applied when the phone was tilted) for a game I am planning to deploy to Android. Does the Android API include 2d effects that could pull this off? ...

error message when populating cell in 2d numpy array

I am trying to populate data from some csv files into a numpy array with the following code: PreExArray=zeros([len(TestIDs),numColumns],float) for row in reader: if row[1] =='PreEx10SecondsBEFORE': PreExArray[(j-1),0]=[row[2]] However, the last line of code above throws the following error: ValueError: setting an array e...

change dtype of a single column in a 2d numpy array

I am creating a 2d array full of zeros with the following line of code: MyNewArray=zeros([4,12],float) However, the first column will need to be populated with string-type textual data, while all the other columns will need to be populated with numerical data that can be manipulated mathematically. How can I edit the code above so th...

2D array using pointers

I am attempting to read a file with some random names in the format "ADAM","MARK","JESSIE" ..... I have some constraints, the file should be read in a function but should be accessible form the main function with no global variables. The file size and the no of names in the file are not known. This is what I have done till now. I have ...

Finding a suitable 2D graphics API

We are in the first stages of making a 2D game at the moment, which will focus on destructible environments and objects. However, we have already encountered serious problems with the choice of the right graphics API At the moment, we use SDL - but the problem we see with it is that it isn't really performant, and has no hardware-accel...

[GENERAL] Suggestion for graphics library for 2D game (PC)

Hello. I'm trying to set base to a 2D game with destructible terrain and/or particle effects, scroll, zoom, characters, etc... I'd like to know if there is a graphics library that would support those things in both software and hardware acceleration .. (Need pixel access). I've tried SDL (even with directX backend), but it seems hardware...

OpenGL: Accurate textures possible?

This is for a 2D game with OpenGL: Is it with using OpenGL possible to display a texture absolutely unfiltered, not streched or blurred? So that when I have a BMP and convert it into an OpenGL texture, and then retrieve that texture and convert it back, I have no modifications or quality / data loss? ...

jquery: 2d transform (scaling images) plugin and IE

The following snippet works everywhere it needs to except IE7: //Assess Stage 1 function stage1() { $("#prevBtn").hide(); $('#cs_contentToSlide').animate({ left:0},200, function() { $("#cs_house").fadeTo(10,1); $("#cs_social").fadeTo(10,.3); $("#cs_pie").fadeTo(10,.3); $("#cs_house").animate({scale: '1.1...

2d Framework c++

I'm looking for a 2d framework with such things as layers/particles/screen manager/sprite batch/parallax/etc coded in c++ out there? I'm looking for somethings that doesn't necessarily have graphics, because I want to add it on to airplay sdk. Or something I can easily rewire to do the graphics through airplay. ...