Questions tagged [computational-geometry]

The study of computer algorithms which admit geometric descriptions, and geometric problems arising in association with such algorithms. The two major classes of problems are (a) efficient design of algorithms and data classes using geometric concepts and (b) representation and modelling of curves and surfaces.

1263 questions
233
votes
24 answers

How to check if a point is inside a rectangle?

There is a point $(x,y)$, and a rectangle $a(x_1,y_1),b(x_2,y_2),c(x_3,y_3),d(x_4,y_4)$, how can one check if the point inside the rectangle?
Freewind
  • 2,555
79
votes
6 answers

How to generate random points on a sphere?

How do I generate $1000$ points $\left(x, y, z\right)$ and make sure they land on a sphere whose center is $\left(0, 0, 0\right)$ and its diameter is $20$ ?. Simply, how do I manipulate a point's coordinates so that the point lies on the sphere's…
35
votes
4 answers

Minimum number of straight lines to cover $n \times n$ grid?

I want to know the minimum number of lines needed to touch every square of an $n \times n$ grid. The only added rule is that the line has to pass inside the square, not on the edge/corner. I have found a solution for $n-1$ lines for all $2<n\le 10$…
32
votes
6 answers

Is it possible to solve any Euclidean geometry problem using a computer?

By "problem", I mean a high-school type geometry problem. If no, is there other set of axioms that allows that? If yes, are there any software that does that? I did a search, but was not able to find a single program that allows that. It is strange…
22
votes
4 answers

How to union many polygons efficiently

I've asked this question at SO , but only answer I got is a non-answer as far as I can tell, so I would like to try my luck here. Basically, I'm looking for a better-than-naive algorithm for the constructions of polygons out of union of many…
Graviton
  • 2,364
20
votes
0 answers

Placing triangles around a central triangle: Optimal Strategy?

Now cross-posted to MathOverflow ( link ). Question: There is an equilateral triangle. Two players alternate turns placing non-overlapping equilateral triangles of the same size that touch the original one; contact needs to exist for at least one…
19
votes
1 answer

Geometry of nose in and nose out parking in parking lots

I would like some computational evidence in favor of my observation that one can park a car in tighter (parking lot) spaces by backing in rather than nose in. I have been doing this successfully for some 15 years, but see few others trying this. So,…
Will Jagy
  • 147,694
15
votes
3 answers

Check if a point is inside a rectangular shaped area (3D)?

I am having a hard time figuring out if a 3D point lies in a cuboid (like the one in the picture below). I found a lot of examples to check if a point lies inside a rectangle in a 2D space for example this on but none for 3D space. I have a cuboid…
Faas
  • 163
14
votes
6 answers

"Surface Area" of $k$ simplex in $\mathbb{R}^{k}$?

Consider the $k+1$ vertices $(x_1,\ldots,x_{k+1})$ with $x_i\in\mathbb{R}^k,i=1,\ldots,k+1$. I know that the "volume" of the $k$-dimensional simplex formed by these vertices is proportional to $$\left|\det\left( \begin{array}{ccc} 1 & \ldots & 1 \\…
user1963
  • 555
13
votes
5 answers

Every polygon has an interior diagonal

How does one prove that in every polygon (with at least 4 sides, not necessarily convex), that it is possible to draw a segment from one vertex to another that lies entirely inside the polygon. In particular, I'm having trouble rigorously defining…
Potato
  • 41,689
13
votes
4 answers

Find whether two triangles intersect or not in 3D

Given 2 set of points ((x1,y1,z1),(x2,y2,z2),(x3,y3,z3)) and ((p1,q1,r1),(p2,q2,r2),(p3,q3,r3)) each forming a triangle in 3D space. How will you find out whether these triangles intersect or not? One obvious solution to this problem is to find the…
Atishay
  • 231
13
votes
3 answers

How to determine whether a point is inside a closed region or not?

Take the following parametric equation of an implicit curve as an example: $$ \left\{\quad \begin{array}{rl} x=& 9 \sin 2 t+5 \sin 3 t \\ y=& 9 \cos 2 t-5 \cos 3 t \\ \end{array} \right. $$ For an arbitrarily given point $P=(x_0,y_0)$, numerically,…
13
votes
1 answer

Automorphism group of a lattice's Voronoi cell

Let $\Lambda$ denote a lattice of $\mathbb{R}^n$, i.e. $$\Lambda = \left\{\sum_{k=1}^n n_i\mathbf{a}_i\ \bigg|\ n_i\in\mathbb{Z}\right\},$$ for $n$ linearly independent vectors $\{\mathbf{a}_i\}$ in $\mathbb{R}^n$. The Voronoi cell of the lattice…
EuYu
  • 42,984
12
votes
3 answers

is there an efficient algorithm for comparing collections of points?

Let's say you have two sets of M points $p_1...p_M$, and $q_1...q_M$, which reside in $\mathbb{R}^N$. Is there an efficient (e.g. polynomial in M and N) algorithm to determine if the point-sets are the same up to some orthogonal transformation? I.e.…
12
votes
2 answers

Point closest to a set four of lines in 3D

Given four lines in $3D$ (represented as a couple of points), I want to find the point in space which minimizes the sum of distances between this point and every line. I'm trying to find a way to formulate this as a problem of Least Square, but I'm…
Prateek
  • 121
1
2 3
…
84 85