# Tagged Questions

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

15k views

### Draw the national flag of Iceland

This year's UEFA Euro 2016 is over and besides a couple of negative headlines there has been a very positive surprise as well – the Iceland national football team. Let's draw their national flag. ...
390 views

### Borders of overlapping circles

Given the coordinates of several points on a plane, and the radius of a circle surrounding each point, draw polygons representing the circles and the edges where the circles meet. Straight edges will ...
108 views

### Decompose the domain

In scientific computing, it is often desirable to decompose some large domain into smaller "subdomains", then parallelize the computation by performing the work on each subdomain in parallel and the ...
945 views

### g​o​l​f​ ​a​t​a​n​2

Sometimes it really is a struggle to convert cartesian coordinates (x,y) to polar coordinates (r,phi). While you can calculate r = sqrt(x^2+y^2) quite easily, you often need some distinction of cases ...
672 views

### Rotate a hypercube

Introduction A hypercube/tesseract is the 4 dimensional equivalent of a normal cube. It's made by taking a cube net, extending it to the 3rd dimension, then – using the 4th dimension – folding it ...
51 views

### Does the triangle contain the origin? [duplicate]

Challenge description On a Cartesian plane, a triangle can be described as a set of three points, each point being one of the triangle's vertices. For instance, coordinates (2, 1), (6, 8), (-7, 3) ...
4k views

### The happy Ender problem

The happy ending problem (actually a theorem) states that Any set of five points in the plane in general position has a subset of four points that form the vertices of a convex quadrilateral. ...
216 views

### Find the circumference! [closed]

Challenge Well, find the circumference of any circle. You'll be using the formula 2*pi*radius or pi*diameter. Rules You will take an input, r or d, as command line argument or stdin. Your program ...
2k views

### Do these squares overlap?

Given the coordinates of the upper left corners of two squares and their side lengths, determine whether the squares overlap. A square includes the top and left lines, but not the bottom and right ...
489 views

### Calculate the Fermat Point of a Triangle

This is somewhat similar to The centers of a triangle, but with a different point. The Fermat Point is the point P in triangle ABC such that the value of AP + BP + CP is minimized. There are two cases:...
404 views

### Gasket Weaving - draw a Sierpiński knot

Given an integer N >= 2, produce an image showing a Sierpiński knot of degree N. For example, here are knots of degree 2, 3, 4 and 5: Click on the images to view full size (the higher the ...
264 views

228 views

### Tiling by substitution

EDIT: The incorrect A rhomb substitution has been fixed. Apologies to anoyone who had started working on a solution. Consider the following substitutions, where the substituted rhomb(us) is scaled up ...
293 views

### Counting triangles with integer perimeter

Mary has given John two sticks of lengths a and b respectively, where a and b are positive integers. John is very curious. He would like to know how many triangles with integer perimeter can be ...
612 views

### Draw a simple cube

We don't have a single challenge about drawing a real 3 dimensional cube, so here it goes: Challenge Your task is to draw a rotated, cube with perspective. It can be in a separate window or as an ...
227 views

### Symme-Try This Triangle Trial

A string whose length is a positive triangular number (1, 3, 6, 10, 15...) can be arranged into an "equilateral text triangle" by adding some spaces and newlines (and keeping it in the same reading ...
986 views

### Form tiles in a rectangular ring

Given the input tilesX and tilesY create a method that would make a rectangular ring from the tiles. The function must order the tiles in a ring like this: tilesX and tilesY are always positive ...
339 views

### Find the area of a polygon

Given consecutive side lengths s1, s2, s3... s_n of an n-gon inscribed in a circle, find its area. You may assume that the polygon exists. In addition, the polygon will be convex and not self-...
311 views

### How can I shorten this python code analyzing a 3d grid?

My Python 3 function golf(...) should take a list of lists of lists of strings representing a solid cube and return whether there are any places in which two equal strings are directly next to each ...
5k views

### Build a triangle without any triangles

As a little kid, I liked to play with these toys a lot: They probably intended for these to be used for art, but I always used them for math! Fractals, patterns, etc. One time, I was given this ...
349 views

### Need help golfing Python 3 code to calculate volume & surface of spheroids in <150 bytes

I want to write a function golf(C, A) that takes the height (C = 2*c) and the width (A = 2*a) of an oblate (left image) or prolate (right image) spheroid or a sphere as parameters and returns the ...
1k views

### Rectangle Detection

Write a program or function that takes in a multiline string of 0's and 1's. No other characters will be in the string and the string will always be rectangular (all lines will have same number of ...
524 views

### Draw a random hexa-glyph

The above image is called a hexa-glyph. Hexa-glyphs are some cool patterns I made up while doodling during my DiffEq class. Here's how you make one: Consider the following set of points, shaped ...
201 views

### Identify arborally satisfied point sets

An arborally satisfied point set is a 2D set of points such that, for any axis-aligned rectangle that can be formed using two points in the set as opposite corners, that rectangle contains or touches ...
152 views

### Count rectangle intersections

The Challenge Given an arbitrary amount of rectangles, output the total count of intersections of those when drawn in a 2D plane. An intersection here is defined as a point P which is crossed by two ...
277 views

### How far from the exterior?

Take a 2D region of space divided into axis aligned unit square elements with their centers aligned at integer intervals. An edge is said to be internal if it is shared by two elements, otherwise it ...
273 views

Introduction Imagine you are on a two dimensional cartesian plane and want to determine your position on it. You know 3 points on that plane and your distance to each of them. While it is always ...
265 views

Addition on Elliptic Curves Disclaimer: This does not do any justice on the rich topic of elliptic curves. It is simplified a lot. As elliptic curves recently got a lot of media attention in the ...
292 views

### Hexagon-In or Hexagon-Out?

There is a great story to tell about regular hexagons found for example in honeycombs. But this busy bee needs your help in telling him which point is inside or outside his honeypot. So, given a ...
2k views

### Calculate the volume of an object

You can determine the volume of objects based on a given set of dimensions: The volume of a sphere can be determined using a single number, the radius (r) The volume of a cylinder can be determined ...
540 views

### Cities: Sightlines

I'm at position (0, 0) of an infinite two-dimensional city, which is perfectly divided into blocks centered at each lattice point, some of which contain buildings. A building at a certain point (x, y) ...
423 views

### Text on a circle

Write a program or function that prints an input string around the discrete circle that has the minimum possible radius. For example, for input This is an example, your program should output: a si ...
179 views

### Extend the line

Task Given an image with a line on it, produce or display an image with the line extended the the line to the edge of image. The line is black and the background is white. The image size is 100x100 ...
357 views

### Where does the spaceship go?

Based on an idea suggested by Zgarb. A spaceship is moving around a regular 3D grid. The cells of the grid are indexed with integers in a right-handed coordinate system, xyz. The spaceship starts at ...
120 views

### Test if a point is in an Icosahedron

Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at ...
237 views

### Compute the winding number

The winding number is the integer number of net counterclockwise revolutions an observer must have made to follow a given closed path. Note that any clockwise revolutions count negative towards the ...
2k views

### Hypercube elements

Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube. As an example, the 3 dimensional cube has 1 cell (i.e. 1 3-...
2k views

### Distance between two points in n-dimensional space

Here is another simple one: The Challenge Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance. The coordinates will be rational numbers;...
173 views

### Find our neighbors

You live in a rectangular neighborhood which is completely partitioned into N rectangular plots, i.e. there are no gaps or overlaps. Plots do not necessarily have the same width/height as other plots. ...
3k views

### A Geometrical Challenge

Everybody loves geometry. So why don't we try and code golf it? This challenge involves taking in letters and numbers and making shapes depending on it. The Input The input will be in the form of (...
742 views

### Hypercube sides

Your goal is to output all the "sides" (corners, edges, faces, etc.) of an N-dimensional unit hypercube, where N is non-negative. A "side" is defined as any (N-M)-dimension surface embedded in N-...
203 views

### Find the line guaranteed by Sylvester-Gallai

The Sylvester-Gallai theorem says: Suppose you have a finite list of points in the plane. Suppose further that not all of those points are collinear (lie in a single line). Then there is some line ...
4k views

### Toilet Paper Mysteries

Today you need to solve a very practical problem: How many loops do you need to have a certain number of sheets on your toilet paper roll? Let's look at some facts: The diameter of a bare toilet ...
465 views

### Putting square pegs into square holes

I was intrigued by the design of this graphic from the New York Times, in which each US state is represented by a square in a grid. I wondered whether they placed the squares by hand or actually found ...
173 views

### Finding Exclusive Area in Circle Intersections

Here's a deceptively challenging geometry puzzle for you! Given a circle A, and n other circles B[n], find the total area contained within A that is not within any circle of B. Your code should be ...
194 views

### Lego Gear Train

Inspired by the Lego gear ratios challenge by Keith Randall. I, too, plan on building a giant lego robot that will eventually be able to destroy the other robots in the never-before-mentioned ...
469 views

### Draw a Christmas Star / Stellated Dodecahedron

Paper stars are a big thing in my family at christmas, so I thought a virtual one would be cool. Below is an image of a regular dodecahedron (from https://en.wikipedia.org/wiki/Dodecahedron, ...
2k views

### How much present did you get for Christmas?

Yes, how much, not how many... As we all know, a large present is far better than a small one. Therefore, the value of the presents should always be measured in total volume, not number of presents, ...