# Questions tagged [geometry]

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

324 questions
Filter by
Sorted by
Tagged with
2answers
253 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 ...
2answers
961 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 ...
2answers
710 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 ...
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 ...
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 ...
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 ...
8answers
625 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 ...
80answers
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 positive ...
2answers
267 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 ...
2answers
449 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 ...
2answers
269 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-...
5answers
408 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 ...
7answers
987 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 ...
2answers
323 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 ...
17answers
3k 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...
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 ...
40answers
5k 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 ...
4answers
425 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 ...
25answers
3k 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 ...
4answers
771 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 ...
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 ...
4answers
2k 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 ...
3answers
419 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. ...
3answers
630 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 ...
17answers
4k 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 ...
1answer
1k 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 ...
20answers
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 ...
0answers
135 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 ...
0answers
108 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 ...
1answer
193 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 ...
1answer
1k 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 ...
13answers
817 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 ...
14answers
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: ...
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 ...
13answers
218 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: ...
9answers
480 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 ...
2answers
309 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 ...
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 ...
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 ...
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 ...
1answer
386 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 Your ...
8answers
3k 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 ...
3answers
628 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 ...
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. ...
1answer
673 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 ...
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 ...
3answers
221 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 ...
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: ...
7answers
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 ...
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 ...