This came up when a friend talked about a programming competition, and we wondered what the best approach was:
Given a list of points, find the centre of a circle of predetermined size that covers the most points. If there are several such circles, its only important to find one of them.
Example input: 1000 points, in a 500x500 space,...
Our VB.NET project is using a Java library from Vivid Solutoins (com.vividsolutions.jts.geom.Geometry) to do Geometry calculations. The help is here: http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html
What I can't figure out are the units specifically for the Buffer property, or any other distance for that...
I have the start point (x1,y1) and the desired length and angle of the line.
If the angles were directions, 0 degrees is W, 90 is N, 180 is E and 270 is S. I can modify this if needed.
How can I use the start point, length and angle to determine the end point(x2, y2)?
...
The idea is to get rating control, that could have value like 0.3 and draw it as partly filled shape.
The approach I used was described in CodeProject article. Have Path, add mask (rectangle), add outline.
Original code used Margin for mask and fixed-width paths.
The problem is that using rectangle as mask re-draws background, which is g...
Let me know if this is mathoverflow material, and I'll wend my way over there. I'm hoping someone will recognise this and point me in the right direction...
I'm trying to map out related nodes. I've figured out how to calculate the minimum distances between all the points, and now I need to know how to turn those into actual co-ordinate...
I have a frustum (truncated pyramid) and I need to compute a bounding sphere for this frustum that's as small as possible. I can choose the centre to be right in the centre of the frustum and the radius be the distance to one of the "far" corners, but that usually leaves quite a lot of slack around the narrow end of the frustum
This see...
For a 2D game I'm working on, I'd like to figure out when a projectile reaches its closest to point to its target.
A projectile is a point that moves by a constant dx,dy per frame.
A target is another point whose speed relative to the projectile is slow enough as to be considered stationary.
I want to have the projectile explode when it...
I'm trying to test whether a given point (x, y) is located on or close to the outline of a QGraphicsPathItem.
Using QGraphicsItem.contains() or .collidesWithItem() / Path() will not do: those also return True if the point is contained within the area on the interior of the path, while I want to test only for points on the outline. How ...
Hey there guys, I'm learning processing.js, and I've come across a mathematical problem, which I can't seem to solve with my limited geometry and trigonometry knowledge or by help of Wikipedia.
I need to draw a rectangle. To draw this rectangle, I need to know the coordinate points of each corner. All I know is x and y for the midpoints...
I'm learning metapost and i want to know how to generate a figure like a polygon number http://en.wikipedia.org/wiki/Polygonal_number , i got triangular numbers but not hexagonal.
Thanks for help.
...
The problem
I have an array of java.awt.Rectangles. For those who are not familiar with this class, the important piece of information is that they provide an .intersects(Rectangle b) function.
I would like to write a function that takes this array of Rectangles, and breaks it up into groups of connected rectangles.
Lets say for examp...
I am preparing myself for programming competitions and i would like to know how can i solve this problem. I guess it's geometry problem, and it seems i can't get any ideas about solving it.
Here it is:
There is a yard in which there are wolves and sheep. In the yard there are also blocks which do not allow to pass. The wolves are repr...
This question is related to:
How do I determine the intersection point of two lines in GDI+? (great explanation of algebra but no code)
How do you detect where two line segments intersect? (accepted answer doesn't actually work)
But note that an interesting sub-problem is completely glossed over in most solutions which just return nu...
Hi, I'm writing a solution for the Usaco problem "Electric Fences".
In the problem you have to find the optimal location for a point among a large amount of linesegments, so the sum of point-linesegment distances is smallest possible.
I had an idea, that it might be possible to do a hillclimb, and it worked for all testcases. The given ...
I am looking for a way to calculate the area, in pixels, of an arbitrary instance of java.awt.geom.Area.
The background: I have Shapes in my applications that may overlap. I want to know how much one Shape overlaps another. The Shapes may be skewed, rotated, etc. If I had a function area(Shape) (or Area), I could use the intersection of...
I'm looking for a very simple algorithm for computing the polygon intersection/clipping.
That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons.
I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation...
I have a list of about 60 stores with physical addresses and geocodes. I would like to make a simple interface where a user can enter a zip code, or city and state, or even a street address and have the list sort in order of proximity to the entered address. This is a very common feature of websites as I understand.
My plan to do this...
I'm using rectangles defined in terms of their x y coordinates and their width and height. I figured out how to rotate them in terms of coordinates (x = cos(deg) * x - sin(deg) * y y = sin(deg) * x + cos(deg) * y) but I'm stuck on the height and width. I'm sure there's an obvious solution that I'm missing. If it matters, I'm using Python...
Hi,
I am looking for an algorithm to get contour of a figure created by a set of non-overlapping rectangles. The figure can be of any shape but it is simply-connected, i.e. contains no holes.
I need an idea on how to write a function like that:
IEnumerable<Point> GetContour( IEnumerable<Rect> rects )
Time complexity of the algorithm...
Dear experts,
I have a a mesh, with certain types of elements (e.g. triangular, tetra). For each element I know all its vertices i.e. a triangular 2D element will have 3 vertices v1, v2 and v3 whose x,y,z coords are known.
Question 1
I am looking for an algorithm that will return all the edges... in this case:
edge(v1, v2), edge(v1,...