2,625 questions
625
votes
42
answers
470k
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.
0
votes
1
answer
7k
views
Display an array of color in C [closed]
My program both writes and 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;
}
...
20
votes
3
answers
40k
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 ...
280
votes
15
answers
211k
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 &...
163
votes
4
answers
196k
views
How to use Greek symbols in ggplot2?
My categories need to be named with Greek letters. I am using ggplot2, and it works beautifully with the data. Unfortunately I cannot figure out how to put those greek symbols on the x axis (at the ...
49
votes
7
answers
65k
views
Fast work with Bitmaps in C#
I need to access each pixel of a Bitmap, work with them, then save them to a Bitmap.
Using Bitmap.GetPixel() and Bitmap.SetPixel(), my program runs slowly.
How can I quickly convert Bitmap to byte[] ...
5
votes
1
answer
2k
views
Translucent circular Control with text
I am working on a project wherein I need to add a Control with the shape of a Circle with some text in the middle.
My problem is the circle is too small, when I resize it, it overlaps other controls. ...
328
votes
13
answers
1.1m
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 ...
8
votes
4
answers
24k
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 ...
15
votes
3
answers
14k
views
OpenGL - How to create Order Independent transparency?
I've been working on a game engine for educational purposes and I came across this issue I cannot seem to find an answer for:
Alpha channel only works for objects that have already been drawn before ...
398
votes
26
answers
308k
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.
192
votes
13
answers
504k
views
How to read the RGB value of a given pixel in Python?
If I open an image with open("image.jpg"), how can I get the RGB values of a pixel assuming I have the coordinates of the pixel?
Then, how can I do the reverse of this? Starting with a blank graphic, ...
124
votes
8
answers
280k
views
How can I set the matplotlib 'backend'?
I am new user of matplotlib, my platform is Ubuntu 10.04 Python 2.6.5
This is my code
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,3])
The error is:
/usr/...
71
votes
10
answers
564k
views
Setting background color for a JFrame
How do you set the background color for a JFrame?
11
votes
2
answers
13k
views
Ray Casting with different height size
I have a java project who makes the "windows' maze" and use the ray casting algorithm. Here's a screenshot :
Like you can see all the walls have the same height size. I would like to do the same but ...