Skip to main content
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.
Scott Evernden's user avatar
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; } ...
neeh's user avatar
  • 3,045
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 ...
Ali Ben Messaoud's user avatar
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 ...
Sam's user avatar
  • 8,202
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[] ...
AndreyAkinshin's user avatar
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. ...
Zhyke's user avatar
  • 447
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 ...
rrichter's user avatar
  • 9,461
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 ...
Margus's user avatar
  • 20.1k
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 ...
laurGanta's user avatar
  • 185
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.
kondratyevdev's user avatar
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, ...
Josh Hunt's user avatar
  • 14.5k
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/...
user504909's user avatar
  • 9,559
71 votes
10 answers
564k views

Setting background color for a JFrame

How do you set the background color for a JFrame?
user avatar
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 ...
Jack's user avatar
  • 415

15 30 50 per page
1
2 3 4 5
175