# Questions tagged [geometry]

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

265 questions
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 ...
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-...
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 ...
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 ...
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 ...
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...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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: ...
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 ...
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: ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
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 ...
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: ...
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 ...
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 ...
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 ...
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: ...
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 ...
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 ...
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 ...
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 ...
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 ...