2d

How to know if a line intersects a plane in C#? - Basic 2D geometry

Hello, my school maths are very rusty and I think this is a good opportunity to take advance of this community :D I have two points (a line) and a rectangle, I would like to know how to calculate if the line intersects the rectangle, my first approach had so many "if" statements that the compiler sent me a link to this site. Thanks for...

How to work around a very large 2d array in C++

I need to create a 2D int array of size 800x800. But doing so creates a stack overflow (ha ha). I'm new to C++, so should I do something like a vector of vectors? And just encapsulate the 2d array into a class? Specifically, this array is my zbuffer in a graphics program. I need to store a z value for every pixel on the screen (henc...

Fast, Pixel Precision 2D Drawing API for Graphics App?

I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any form of anti-aliasing (again, pixel level control is required.) I would like ...

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 am not using any particular API, and I do not have an existing projection matrix. I'm jus...

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 corresponding (probably non-convex) polygon. The best solution I found so far was to generate ...

Best way to detect collision between sprites?

Whats the best way to detect collisions in a 2d game sprites? I am currently working in allegro and G++ ...

How to test if a line segment intersects an axis-aligned rectange in 2D?

How to test if a line segment intersects an axis-aligned rectange in 2D? The segment is defined with its two ends: p1, p2. The rectangle is defined with top-left and bottom-right points. ...

Bezier clipping

I'm trying to find/make an algorithm to compute the intersection (a new filled object) of two arbitrary filled 2D objects. The objects are defined using either lines or cubic beziers and may have holes or self-intersect. I'm aware of several existing algorithms doing the same with polygons, listed here. However, I'd like to support bezie...

Is using Dexter's character sprite okay, or do I have to...

. Inspiration -- Southpark game (very popular if you see download count on download.com ,,, did he ask for permission ??) I am making a 2d game based on dexter's lab theme. I've got the sprite of dexter from GSA. basically I'm not an artist, so I have to depend on already available sprites, backgrounds, sfx on websites like GameSpr...

2d graphics effects 101: throwing something

I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great. When you are panning in this way and you are release, the page stops dead where you dropped it. I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone UI, I guess. I'm not really chasing...

3d to 2d Projection Matrix

I have 3 points in 3d space. I know the exact locations of them. Suppose they are (x0,y0,z0) (x1,y1,z1) (x2,y2,z2) Also i have a camera that are looking at these 3 points and i know the 2d locations of those three points on camera view plane. So for example (x0,y0,z0) will be (x0',y0') and (x1,y1,z1) will be (x1',y1') and (x2,y2,z2) wil...

Where to get sprites & tilesets for 2d games?

Apart from creating my own graphics, where can I get to see some inspiring tilesets for inspiration and use for a 2d platform game ? some of my favourites - SavWae sprites - a huge list of links to sprites & tiles resources The protagonists domain Savware is the place to go I believe, thats what leads you to Sprite-Resource.com - on...

Favorite image file format for 2d sprites

What is your favorite, lossless image format for games (namely 2d games)? And why? Some things to take into consideration are size on disk, overhead for converting to a usable format, and features of the format (ie alpha support). There is no best answer, but be sure to back yours up the best you can! ...

Recommend a tool for graphics, please!

I work on a (raytracer) graphics engine and during the development process I want to create a bunch of pictures describing algorithms in space. First I thought about 3D packages (like 3DSMax and others), then about 2D (like Illustrator and others). But it all seems to be an overkill... (I'd like to use Rhino 4.0 Evaluation, but it is an...

Resources for 2d game physics

I'm looking for some good references for learning how to model 2d physics in games. I am not looking for a library to do it for me - I want to think and learn, not blindly use someone else's work. I've done a good bit of Googling, and while I've found a few tutorials on GameDev, etc., I find their tutorials hard to understand because th...

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 it's possible that I'll be able to continue using it, but I suspect it won't be able to su...

Best 2D animation library/tech for "iPhone" style animation on WIN32?

All, I have built a nifty demo application that displays data about our internal systems as a full-screen "billboard" style display. You could think of this as something like an application displaying the national deficit - rapidly increasing numbers, animating very quickly, all day. The problem is that the demo works really well and t...

Mathematics and Game Programming

I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbook and do some light 2D Cartesian programming. Are there an...

How do I extract a 2D slice from 3D geometry from plane intersection?

Hello world. Recently our team was facing the task to build the 2D slice between a plane and some set of 3D geometry (set of triangles). Google hasn't been as helpful as we have wanted it to be, so we turn our attention here to see if anyone has encountered this problem with a possible solution. Links are also wanted. Finding the inter...

Point in Polygon aka hit test

What's your best, most elegant 2D "point inside polygon" or Polygon.contains(p:Point) algorithm? Edit: There may be different answers for floats vs integers. Primary goal is speed. ...