Questions tagged [geometry]

62 questions
40
votes
12 answers

How to check if 4 points form a square?

Assume I have 4 points (they are 2-dimension), which are different from each other, and I want to know whether they form a square. How to do it? (let the process be as simple as possible.)
MarshalSHI
  • 511
  • 1
  • 4
  • 8
13
votes
2 answers

How to calculate figure rotation efficiently?

I have a Figure represented through a matrix of bytes (bitmap-like matrix). Example Figure is shown on the Picture 1. The goal is to find the best rotation angle of some given Figure. When Figure is rotated by best angle, the rectangle that is…
Dusan
  • 585
  • 6
  • 19
13
votes
3 answers

Find the new coordinates using a starting point, a distance, and an angle

Okay, say I have a point coordinate. var coordinate = { x: 10, y: 20 }; Now I also have a distance and an angle. var distance = 20; var angle = 72; The problem I am trying to solve is, if I want to travel 20 points in the direction of angle from…
dqhendricks
  • 626
  • 1
  • 6
  • 12
12
votes
5 answers

Find nearest best fit for circle

Below is an example image, if I have a point of the white dot in the middle and I want to find the nearest possible location for the blue circle (which is obviously at the location where I placed it) if all the red circles already exist. How can I…
11
votes
5 answers

How to compare features of two curves?

I need to compare two curves f(x) and g(x). They are in the same x range (say -30 to 30). f(x) may have some sharp peaks or smooth peaks and valleys. g(x) may have the same peaks and valleys. If so I want a measure on how well these features…
laalee
  • 111
  • 1
  • 6
10
votes
1 answer

How do graphics programmers deal with rendering vertices that don't change the image?

So, the title is a little awkward. I'll give some background, and then ask my question. Background: I work as a web GIS application developer, but in my spare time I've been playing with map rendering and improving data interchange formats. I work…
canisrufus
  • 1,091
  • 7
  • 17
8
votes
3 answers

Generate equally sized areas in polygon

I am looking for a pseudo code logic that would find n equally sized areas in a given polygon. No space should be between or outside the matched areas. First valid match of areas should be returned. Assuming following polygon [2,2, 3,1, 5,1, 5,4,…
Sergey Lukin
  • 199
  • 4
6
votes
3 answers

How to determine if set of ordered coordinates form a simple curve?

I hope it is the right place to ask this. I wasn't sure if it belongs to Stack Overflow or Computer Science. Eventually this seemed more suitable. Anyway, some background first: A closed curve, is a curve with no endpoints and which completely…
so.very.tired
  • 163
  • 1
  • 4
6
votes
3 answers

Efficient method for finding closest point to a line segment from a set of points including line segment's vertices

Let's say I have a list of points (in my case, point objects in a Python implementation). I then have a line segment connecting two of these points. I want to know if there's a way to efficiently find the point from the list that is closest to the…
acm_myk
  • 123
  • 1
  • 1
  • 6
6
votes
3 answers

Method for determining if a line segment is an external edge of a Delauney triangulation?

I've created a Delauney triangulation of a set of points. Now I want to iterate over the triangulation and remove any line segments/edges on the exterior for which the following are true: The outside edge is the hypotenuse of the triangle Call the…
acm_myk
  • 123
  • 1
  • 1
  • 6
6
votes
3 answers

Maximizing number of nested triangles

There is a finite set of points on a plane (about 1500 points in the current task). I need to construct triangles on those points such as each triangle lies completely inside one larger triangle: Now I want an algorithm to maximize the number of…
wRAR
  • 163
  • 4
5
votes
4 answers

Which class should have the `intersects` method?

I have a Circle class and a LineSegment class, and I want to implement a method that returns two points (or one, or none) for the intersections. How do I know which class to put this method in? Would a separate "middle-man" Intersections class be…
MCMastery
  • 163
  • 1
  • 5
5
votes
2 answers

2 closest points between 2 rectangles

On a 2D plane, I have 2 rectangles. I want to find the closest pair of points (one on each rectangle), which are closest to each other. By points I mean the corners of the rectangles. And no, they do not overlap. Is there any way to do that other…
shoham
  • 225
  • 4
  • 9
5
votes
2 answers

How to represent a geometric line programmatically?

I have been trying to design a library to do some simple geometric computations in an Euclidean space regardless of its dimension. While it is easy to represent points, vectors, hyperspheres and hyperplanes in a generic fashion, I am still unable to…
Morwenn
  • 1,736
  • 2
  • 13
  • 22
5
votes
3 answers

Intersection of geometric entities

I was trying to design a small C++ geometric API for learning purposes, but came across a problem when dealing with intersections of geometric entities. For example, the intersection of a line and a sphere can have three different types: a couple of…
Morwenn
  • 1,736
  • 2
  • 13
  • 22
1
2 3 4 5