All Questions

400
votes
28answers
189612 views

How can I determine whether a 2D Point is within a Polygon?

I'm trying to create a fast 2D point inside polygon algorithm, for use in hit-testing (e.g. Polygon.contains(p:Point)). Suggestions for effective techniques would be appreciated.
15
votes
3answers
32190 views

Draw a line in a JPanel with button click in Java

I want to draw a line in a JPanel. This is my GUI and I want a line in the JPanel in white. I find many examples but the problem is the how to use it. In many exmples, always they draw in a JFrame...
67
votes
2answers
87662 views

Showing data values on stacked bar chart in ggplot2

I'd like to show data values on stacked bar chart in ggplot2. Here is my attempted code Year <- c(rep(c("2006-07", "2007-08", "2008-09", "2009-10"), each = 4)) Category <- c(rep(c("A", "B...
241
votes
12answers
151257 views

Ball to Ball Collision - Detection and Handling

With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator. You click and drag the mouse to launch a ball. It will bounce around and eventually stop on the...
0
votes
1answers
1260 views

Display an array of color in C

My program both writes an reads arrays of colors like this one : struct Image { size_t width; size_t height; struct Color *data; } struct Color { char r; char g; char b; } ...
419
votes
8answers
374097 views

Do I use <img>, <object>, or <embed> for SVG files?

Should I use <img>, <object>, or <embed> for loading SVG files into a page in a way similar to loading a jpg, gif or png? What is the code for each to ensure it works as well as pos...
8
votes
4answers
17741 views

Java, how to draw constantly changing graphics

Have not done this before, so obviously I suck at it. Here 64 pixels around current mouse position get drawn little bigger on a form. Problem is, that it's 'kind of' to slow, and I have no idea where ...
299
votes
15answers
208440 views

Creating a blurring overlay view

In the Music app of the new iOS, we can see an album cover behind a view that blurs it. How can something like that be accomplished? I've read the documentation, but did not find anything there.
132
votes
17answers
86555 views

Algorithm to detect intersection of two rectangles?

I'm looking for an algorithm to detect if two rectangles intersect (one at an arbitrary angle, the other with only vertical/horizontal lines). Testing if a corner of one is in the other ALMOST works....
196
votes
8answers
562477 views

How do I position one image on top of another in HTML?

I'm a beginner at rails programming, attempting to show many images on a page. Some images are to lay on top of others. To make it simple, say I want a blue square, with a red square in the upper ri...

Previous Next