Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [geometry]

This challenge is intended to be solved by using, manipulating, or creating shapes or other geometric structures.

20
votes
11answers
2k views

Smallest Integer Disk

This challenge is about finding the smallest disk that contains some given points. This is made somewhat trickier, however, by the fact that in this challenge, the disk's coordinates and radius must ...
3
votes
0answers
108 views

Number of circles packed into a rectangle [closed]

Calculate the maximum number of circles of radius r that can fit in a rectangle with width x and height ...
8
votes
0answers
119 views

Find a way to determine to which fibonacci squares a given coordinate belongs [closed]

Given a random coordinate (x,y), determine in which square (squares are referenced by their sidelength) it is (or the borders of which squares). The squares are drawn in a counter clockwise direction,...
7
votes
2answers
192 views

Drawing convex polyiamonds

Description OEIS sequence A096004 gives the Number of convex triangular polyominoes [polyiamonds] containing n cells. It begins: ...
7
votes
2answers
219 views

Intersection Point of Two Line Segments

Given two line segments, determine if the line segments intersect and if so, where. In the case that the two given line segments are co-linear and overlap, determine the midpoint of the overlapping ...
6
votes
11answers
465 views

Draw a times table (also called modular multiplication circle) of a number \$n\$ with \$k\$ vertices

Not to be confused with this question. You need to draw a times table (also known as Cremona's method for cardioid generation) as shown in this video. The number \$n\$ and \$k\$ will be the inputs. ...
25
votes
6answers
2k views

Two dozen kissing number approximations

Given a number from 1 to 24, output the kissing number to the best of current knowledge (some numbers will have more than one acceptable output). Knowledge of geometry is not essential as the outputs ...
1
vote
3answers
329 views

Rounded Rectangles

Challenge Given an integer greater or equal to 4, n, print a rounded rectangle of as close as possible (with a gap of 1) sides and a perimeter of n characters. Rules n is always 4 or greater, ...
27
votes
4answers
712 views

Smallest region of the plane that contains all free n-ominoes

On Math Stack Exchange, I asked a question about the smallest region that can contain all free n-ominos. I'd like to add this sequence to the On-Line Encyclopedia of Integer Sequences once I have ...
-1
votes
1answer
186 views

Find the longest uninterrupted arc in N dimensions

See similar question for 2D case: Find the longest uninterrupted arc The challenge here is to find the longest uninterruped great circle arc around a unit hypersphere in N dimensions, with a random ...
5
votes
3answers
328 views

Find the longest uninterrupted arc

The challenge here is to find the longest uninterruped arc around a unit circle with a random amount of points distributed in random positions around it. Here is a diagram to assist my explanation: ...
29
votes
12answers
1k views

Triangular Lattice Points close to the Origin

Background A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid. A triangular lattice ...
14
votes
10answers
903 views

Area enclosed by perimeter loop

Find the area of a region of unit cells given its perimeter loop as a sequence of 90-degree turns. For example, take the three-cell region XX X whose perimeter ...
14
votes
6answers
936 views

Will you be my Weaver?

I've been recently playing through 'The Weaver' and I think it presents an interesting challenge for code-golf. Premise: The Weaver is a game wherein you are given a number of ribbons coming from 2 ...
25
votes
40answers
4k views

Diamond creator +

Challenge : Given an integer n as input. Create a diamond that is 2x the given number n. Input : Input is integer ...
13
votes
12answers
803 views

Circle intersection area

Description : Given x and y positions of two circles along with their radii, output the ...
10
votes
19answers
2k views

Distance between two points on the Moon

Given latitude/longitude of two points on the Moon (lat1, lon1) and (lat2, lon2), compute the distance between the two points in ...
26
votes
9answers
2k views

Largest rectangle in 2d array

Input The board: A 2D container (matrix, list of lists, etc.) of letters like: ...
15
votes
9answers
991 views

Join up the rooms

So, here's a map of, let's say, a dungeon... ########## # ##### # ##### ########## ########## ########## ########## #### ## #### ## ########## Let's ...
16
votes
14answers
743 views

Euler-Poincaré-Characteristic of Polyhedra

Given a triangulation of the surface of a polyhedron p, calculate its Euler-Poincaré-Characteristic χ(p) = V-E+F, where ...
11
votes
5answers
614 views

Sparse Protractor

Given some positive integer n, design a protractor with the fewest number of marks that lets you measure all angles that are an integral multiple of ...
5
votes
0answers
177 views

Stereographic projection of polyhedra

You will create a program that generates the stereographic projection of polyhedra. In particular, to keep things simple, we'll only focus on n-chamfered dodecahedron. Given a natural number ...
13
votes
3answers
470 views

Code Golf Simulated Golf

Given a list of hole yardages, green sizes, a slice angle and a max distance, compute a golf score. Assumptions Earth is flat All greens are circular Slice angle will be between -45 and 45 degrees ...
8
votes
2answers
899 views

Solve a Rubik's Cube

Your challenge is to write a program to solve a 3x3x3 Rubik's Cube. This challenge is based on this one from 2013, rewritten to adhere to current community standards, and reposted with the original ...
13
votes
5answers
305 views

Integer triangles with perimeter less than n

Definition An "integer triangle" is one with integer coordinates. For example the following triangle is an integer triangle: ...
21
votes
3answers
719 views

​L​o​o​p​ ​I​t​

Note: The title of this question should be "Loop It", but because title needs to be at least 15 characters, there are some invisible spaces. This note is such that the challenge can be searched for. ...
4
votes
1answer
279 views

Maximum Area of a Polygon with Vertices of a Polygon [closed]

Rules Given a list of integer coordinates, l, with a length of at least 4, and an integer n such that n is smaller than the length of l (but at least 3), return the largest area of an n-sided polygon ...
6
votes
0answers
169 views

Find the smallest triangle encompassing the specified polygon

Input: An integer N which represents the polygon's vertices and a list of their x and y coordinates. Expected output: The smallest difference possible between the area of the(not necessarily convex) ...
16
votes
2answers
218 views

Program an Uncircularness Score

Your task is to program a mathematical function s, that takes a nonempty finite set A of points in the 2D plane, and outputs an ...
24
votes
2answers
785 views

Is it a Rubik's Cube?

A venerated pass time of pedants is to point out that pictures of "Rubik's Cubes" (on t-shirts, posters etc.) are not actually solvable. The first thing that should be checked is that the cube is ...
17
votes
2answers
635 views

Intersection of two triangles

Given 4 points on the 2D planes A, B, C, D, calculate the area of the intersection region of the triangles OAB and ...
28
votes
35answers
3k views

Normalize a Vector

To normalize a vector is to scale it to a length of 1 (a unit vector), whilst keeping the direction consistent. For example, if we wanted to normalize a vector with 3 components, u, we would first ...
15
votes
14answers
1k views

Quadrants passed through by a line

Task Given a representation of a line, output the number of quadrants that that line passes through. Valid Representations of a Line You can represent a line as Three signed integers ...
27
votes
14answers
4k views

The shortest distance between two points is a line

Code a program or function to construct an interactive canvas on the screen of at least 400 pixels x 400 pixels in size. The canvas can be any color you wish, bordered or borderless, with or without a ...
14
votes
8answers
586 views

Sum the Vertex Connections

Let's say you have a positive integer N. First, build a regular polygon, that has N vertices, with the distance between neighbouring vertices being 1. Then connect lines from every vertex, to every ...
45
votes
75answers
9k views

Is my triangle right?

Given a, b, c the length of the three sides of a triangle, say if the triangle is right-angled (i.e. has one angle equal to 90 degrees) or not. Input Three ...
6
votes
2answers
251 views

Fuzzy distances to coordinates

This challenge is similar to my previous one, but has a twist that makes it significantly more difficult. There are n people on a 2D plane. Using distances between them we're going to find their ...
3
votes
2answers
422 views

A Slashy Dashy Spiral [duplicate]

Given a positive integer N, output the innermost N×N square of an ASCII art spiral made of -|/\ that spirals clockwise inward. The ...
14
votes
2answers
237 views

Like a path-segment; touched for the very first time

Given an ordered list of 2 or more 2D cartesian points, output a truthy value if either the path touches itself or self-intersects; otherwise output a falsy value if it does not touch itself or self-...
9
votes
5answers
357 views

Elliptic system

Introduction Given five points in the plane, your task is to compute the area of the ellipse passing through these points. You can assume that exactly one non-degenerate ellipse can be constructed ...
23
votes
6answers
697 views

Distances to coordinates

There are n people on a 2D plane. Using distances between them we're going to find their positions. To get a unique answer you must make four assumptions: There are at least 3 people. The first ...
7
votes
2answers
293 views

Find the Intersections

Let us consider a regular n-sided polygon where all of the sides are equal in length with n being a natural number larger than or equal to three. All of the vertices lie on the unit circle (circle of ...
15
votes
17answers
2k views

Sort the points by linear distance in a 3D space

Specs You have a cubic 3D space x,y,z of size S integer units, such as 0 <= x,y,z <= S...
19
votes
27answers
2k views

Calculate the area of a regular polygon

Given an integer, n, where 3 <= n < 2^32, calculate the area of a regular n-gon with ...
36
votes
38answers
4k views

The Crow vs The Taxicab

Imagine travelling to a point lying A miles away horizontally and B miles away vertically from your current position. Or in other words, travelling from (0, 0) to ...
19
votes
3answers
294 views

Rectangular difference

In this challenge, you are given two overlapping rectangles, and you need to calculate the rectangles created by removing one from the other. For example, if you remove the red rectangle from the ...
31
votes
24answers
2k views

Draw HyperNeutrino's benzene hegaxon icon in ASCII

In celebration of HyperNeutrino getting back his account and rep, following Mr. Xcoder. Apologies for rotating the picture for drawability. Print or output this ASCII art exactly. You may have ...
30
votes
4answers
707 views

A Dog on a Chain

I'm looking out of my attic window into my neighbor's yard. They have a dog chained to a post in the center of the yard. The dog runs around the yard but is always on the end of its chain, so it ...
18
votes
9answers
2k views

Does this line pass through that square?

Divide the first quadrant (including the positive x-axis, the positive y-axis, and the origin) into 1x1 grids, with each grid labelled by the coordinates of its bottom-left corner, as demonstrated ...
20
votes
4answers
688 views

Classify Quadrilaterals | Help me with my math exam!

Help! My math exam is coming up soon and I didn't study! 1 Part of the exam is to classify a quadrilateral given its vertex coordinates, which I, unfortunately, do not know how to do. 2 So, your ...