Questions tagged [computational-geometry]

is a branch of computer science devoted to the study of algorithms which can be stated in terms of geometry.

The computational-geometry tag should be assigned to questions about computation and manipulation of locations or properties of geometric identities or objects. Since geometry computations are highly tolerance dependent, definition and computation of tolerances are welcome, too. Sample Questions are: How to compute line-line intersection on 3D? What is the better way of handling geometrical identities as data structures? How to compute volume of a solid? How to deform a solid? How to obtain parametric solids or surfaces?

2743 questions
39
votes
7 answers

How do I detect intersections between a circle and any other circle in the same plane?

I'm looking for an algorithm to detect if a circle intersects with any other circle in the same plane (given that there can be more than one circle in a plane). One method I have found is to do the separating axis test. It says: Two objects don't…
Jean-Luc Godard
  • 1,873
  • 3
  • 28
  • 53
38
votes
4 answers

2D Geometry library: LGPL alternative to CGAL?

CGAL seems to do just about everything I need and a little more for my upcoming project. It can create polygons out of arc line segments and run boolean operations on them. It has spatial sorting packages already that would save me a lot of time…
Zoomulator
  • 20,774
  • 7
  • 28
  • 32
37
votes
1 answer

Bentley-Ottmann Algorithm in Haskell?

So I've been writing a computational geometry library in Haskell because I couldn't find one on Hackage, and I figured it would be fun to do anyway. However, I've been stuck for nearly a week on one particular algorithm that I just can't seem to get…
danharaj
  • 1,613
  • 14
  • 19
37
votes
6 answers

Simplified (or smooth) polygons that contain the original detailed polygon

I have a detailed 2D polygon (representing a geographic area) that is defined by a very large set of vertices. I'm looking for an algorithm that will simplify and smooth the polygon, (reducing the number of vertices) with the constraint that the…
mbrenig
  • 577
  • 1
  • 6
  • 11
36
votes
6 answers

What is the algorithm for finding the center of a circle from three points?

I have three points on the circumference of a circle: pt A = (A.x, A.y); pt B = (B.x, B.y); pt C = (C.x, C.y); How do I calculate the center of the circle? Implementing it in Processing (Java). I found the answer and implemented a working…
Russell Strauss
  • 1,160
  • 3
  • 14
  • 30
35
votes
4 answers

How to calculate inverse kinematics

I want to know how to calculate rotation angles using inverse kinematics. I am planning on using this for real time 3d animation. Anyone know of some good literature that details a specific solution?
Mr Bell
  • 9,228
  • 18
  • 84
  • 134
35
votes
10 answers

Dividing a plane of points into two equal halves

Given a 2 dimensional plane in which there are n points. I need to generate the equation of a line that divides the plane such that there are n/2 points on one side and n/2 points on the other.
mousey
  • 11,601
  • 16
  • 52
  • 59
35
votes
7 answers

How to know if a line intersects a plane in C#?

I have two points (a line segment) and a rectangle. I would like to know how to calculate if the line segment intersects the rectangle.
Gelu
  • 955
  • 2
  • 11
  • 21
33
votes
6 answers

Maximum possible number of rectangles that can be crossed with a single straight line

I found this challenge problem which states the following : Suppose that there are n rectangles on the XY plane. Write a program to calculate the maximum possible number of rectangles that can be crossed with a single straight line drawn on this…
33
votes
9 answers

Angle between two vectors in R

What the most efficient way in the programming language R to calculate the angle between two vectors?
Christian
  • 25,249
  • 40
  • 134
  • 225
33
votes
7 answers

How to find out Geometric Median

The question is: Given N points(in 2D) with x and y coordinates, find a point P (in N given points) such that the sum of distances from other(N-1) points to P is minimum. This point is commonly known as Geometric Median. Is there any…
SexyBeast
  • 7,913
  • 28
  • 108
  • 196
32
votes
2 answers

Determine non-convex hull of collection of line segments

I have a computational geometry problem that I feel should have a relatively simple solution, but I can't quite figure it out. I need to determine the non-convex outline of a region defined by several line segments. I'm aware of various non-convex…
Joe Kington
  • 275,208
  • 71
  • 604
  • 463
32
votes
5 answers

How do I derive a Voronoi diagram given its point set and its Delaunay triangulation?

I'm working on a game where I create a random map of provinces (a la Risk or Diplomacy). To create that map, I'm first generating a series of semi-random points, then figuring the Delaunay triangulations of those points. With that done, I am now…
CommanderTso
  • 444
  • 1
  • 5
  • 11
31
votes
3 answers

Mathematically producing sphere-shaped hexagonal grid

I am trying to create a shape similar to this, hexagons with 12 pentagons, at an arbitrary size. (Image Source) The only thing is, I have absolutely no idea what kind of code would be needed to generate it! The goal is to be able to take a point in…
30
votes
1 answer

Difference between quadtree and kd-tree

What is the main difference between a quadtree and kd-tree? I understand they split points in many dimensions, but I do not understand why we would use one over the other. I need a structure that allows me to count how many points (2D points) are in…
Mauricio Galindo
  • 638
  • 1
  • 10
  • 16