Questions tagged [geometry]

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

3
votes
2answers
431 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
239 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
371 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
698 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
295 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 ...
20
votes
4answers
362 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 ...
31
votes
4answers
722 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
984 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 ...
6
votes
3answers
416 views

Help me sort out my desktop windows!

It's really frustrating when I'm working and I have a ton of windows open that are completely or partially hidden behind other windows. To make things worse, I'm still using two 1024x768 monitors. ...
14
votes
3answers
441 views

Draw an ASCII cuboid

Given three integers >= 2, create an ASCII cube in an orthogonal (cabinet) projection. The three integers represent height, width and depth (measured in visible characters) including the corners. The ...
19
votes
12answers
3k views

What is the area of this polygon?

Calculate the area of a polygon. Inspired by this shoelace algorithm video. Task Your job is to create a program or function that calculates the area of a polygon. Program or function is defined ...
0
votes
1answer
375 views

Menger Sponge Generator [duplicate]

Challenge My challenge, is for you to generate a Menger Sponge based on the level/iteration given. You need to draw it in ...
27
votes
19answers
4k views

Draw A Reuleaux Triangle!

The Reuleaux triangle is the shape formed by the intersection of three circles, with each circle passing through the others' centers. Regardless of rotation, a Reuleaux triangle's width will always ...
1
vote
0answers
131 views

Puzzle & Golf : Reproduce this gif [closed]

The objective of this programming puzzle is to reproduce the following gif. Simplification: If you notice the geometric figures don't exactly touch each other. I think it's simpler if you make each ...
2
votes
0answers
107 views

Can those squares form an imperfect square [duplicate]

Given a non-empty array of positive integers, determine if it is possible to take squares with side lengths specified by each integer, and arrange them in space such that they form a square. The ...
3
votes
1answer
176 views

ASCII Arc Length: How long is a piece of string?

Given an ASCII representation of a piece of string, determine its length. Input An multi-line ASCII rendering of a piece of string, which runs from top to bottom, with one 'node' (corner) on each ...
17
votes
1answer
940 views

Flatten the CUBE

Do you ever look at 3D shapes and think that we have 2 many dimensions. So let's make 3D into 1D! (See what I did there?) Task Given a 2D representation of a cube (layout below), flatten it into a ...
18
votes
13answers
759 views

What are my dimensions?

Task: Given the area of a triangle, find a Heronian triangle with that area. Any Heronian triangle with the specified area is allowed. A Heronian triangle is a triangle with integer sides and integer ...
25
votes
12answers
1k views

Embedded Diamonds!

No, not this. And not this either. This question is nothing like those Write the shortest code to print/return the following output: ...
20
votes
7answers
1k views

Hexagonal Triangles!

Your task: make a hexagonal triangle with side length n, where n is a positive whole number or 0. First, let me define a ...
-3
votes
13answers
210 views

Finding the center point between two points on a plane

Challenge: To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points. Example: ...
0
votes
7answers
400 views

Embedded Triangles!

Your task: given an integer n, output an embedded triangle to the nth depth. Standard methods of input and output, input in any ...
19
votes
2answers
287 views

Fold Some Towels!

I heard somewhere that one thing that technology cannot do yet is fold towels1. So it is now your job to prove that statement false! Given a string as input, made up of rectangles (towels), like the ...
25
votes
11answers
1k views

Triangular Manhattan Distance

The Manhattan distance on a regular grid is the number of orthogonal steps one needs to take to reach one cell from another. Orthogonal steps are those that go through the edges of the grid cells (as ...
-1
votes
5answers
214 views

No Singles Allowed [closed]

This is a fairly simple challenge. Write a program that computes the distance between two points on a 2D plane. However, you can't use any functions or operators (referred to here as symbols) that ...
15
votes
2answers
1k views

Schläfli Convex Regular Polytope Interpreter

Background The Schläfli Symbol is a notation of the form {p,q,r,...} that defines regular polytopes and tessellations. The Schläfli symbol is a recursive description, starting with a p-sided regular ...
8
votes
1answer
370 views

Tiling the unit square

Background By expanding and cancelling terms, it is easy to show the following identity: However, it is an open problem whether all 1/n-by-1/(n+1) rectangles can tile the unit square. The Task ...
17
votes
8answers
2k views

How Many Holes?

Challenge Given a graphical input of a shape, determine how many holes there are in it. Not Duplicate This question was marked as a possible duplicate of Count Islands. I believe this challenge is ...
12
votes
3answers
578 views

Grids can be curvy. How long is yours?

Consider depicting a simple, open, two-dimensional curve on a W wide by H high grid of text where X represents part of the curve and ...
22
votes
10answers
2k views

Two-Coloring Overlapping Circles

Write a program or function that takes in the following input in a reasonable format of your choice: Two positive integers W and H that define the width and height of the image you'll be generating. ...
13
votes
1answer
422 views

Average distance of two points in unit n-dimensional hypercube

An easy way to understand the unit n-dimensional hypercube is to consider the region of space in n dimensions that you can get if every coordinate component lies in [0, 1]. So for one dimension it's ...
24
votes
11answers
1k views

Counting unit squares circle passes through

Write a program or function that given an integer radius r returns the number of unit squares the circle with radius r centered at the origin passes through. If the circle passes exactly through a ...
5
votes
3answers
200 views

Contiguous Block Count

Count the number of contiguous blocks within a given 3D input. Input The input will consist of one or more rectangles of characters separated by blank lines. Each rectangle represents a cross ...
26
votes
25answers
2k views

Print a cube net of the specified size

Challenge Given a size s, print a cube net of that size made of hash symbols (#) and spaces (). Examples: ...
18
votes
6answers
1k views

Count the squares

Challenge Origami (folding paper) is a creative form of art. As far as I know, master of Origami prefers square paper. Let's start from beginning - convert a rectangular paper to a square one. So ...
36
votes
5answers
3k views

​P​i​ =​= ​3​.​2​

Inspired by this video of Infinite Series. Introduction Pi is defined as the ratio of the circumference to the diameter of a circle. But how is a circle defined? Usually a circle is defined as the ...
18
votes
4answers
427 views

Let's Tessellate!

Introduction From Wikipedia: A tessellation of a flat surface is the tiling of a plane using one or more geometric shapes, called tiles, with no overlaps and no gaps. A fairly well known ...
40
votes
13answers
3k views

Volumes of ASCII boxes

Introduction In this challenge, you are given as input the ASCII representation of the net (unfolded surface) of a rectangular cuboid (3D box). The format is this: ...
33
votes
41answers
3k views

Evaluate the aspect ratio of a triangle

Given three sidelengths of a triangle, evaluate its aspect ratio AR given the following formula: where The closer to equilaterality a triangle is, the closer to 1 ...
3
votes
2answers
274 views

Evaluate the B-spline basis

B-splines are defined using a set of "knots", "control points", and degree. For the purposes of this challenge, the control points are not needed. The knots are simply a list of strictly increasing ...
11
votes
14answers
2k views

Help me I'm lost in the ocean!

Introduction Today I went fishing alone with my canoe, unfortunately I fell asleep and the stream brought me away, I lost my oars, now it's night and I am lost in the ocean! I can't see the coast so ...
11
votes
2answers
241 views

Hexagonal coordinates: Polar to Cartesian

Wikipedia says about Polar Coordinates: In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a ...
23
votes
7answers
808 views

Distance Between Two Points Travelling on a Polar Graph Chart

Brief Problem Explanation Write a program to find the minimum distance between two points traveling only on rays emanating from the origin and circles centered on the origin. Explanation of Premise ...
33
votes
9answers
2k views

I really wanted a rhombus, but all I got was this stupid rectangle

Given only a straightedge and compass, inscribe a rhombus inside the given rectangle, sharing two opposite points. Input Input is the dimensions of the rectangle. In the example shown, that would be ...
8
votes
2answers
382 views

Check if rectangles fill a rectangular space without gaps or overlaps

This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a ...