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

learn more… | top users | synonyms

20
votes
3answers
936 views

Drawing Epicyclogons

An epicycloid is the curve a point on a circle makes as it rolls around another circle. A cyclogon is the shape a point on a regular polygon makes as it rolls across a plane. An epicyclogon is the ...
5
votes
2answers
606 views

The distance between circles

Imagine you are given two lists of numbers which are to be interpreted as points on a circle of circumference 1000. Let us say circleA = [10, 24, 44, 175, 321, 579, 618, 841, 871, 979] circleB = ...
16
votes
4answers
596 views

Three-pointer! But what kind?

From http://en.wikipedia.org/wiki/Triangle: Write a program that takes three 2d coordinate tuples (Cartesian), and classifies what shape these three points describe. In almost all cases these ...
29
votes
17answers
3k views

Check if point lies inside triangle

Your goal is to determine whether a given 2D point X lies within the area of the triangle with given vertices A,B,C. Write a function that takes in the coordinates of the test point X and the three ...
13
votes
1answer
483 views

The Star-Spangled Code Challenge

The flag of the United States of America contains, in its canton, 50 stars, representing the 50 states. In the past, when there were fewer states, there were of course fewer stars, and they were ...
23
votes
6answers
969 views

Circles dividing the plane

This problem idea is borrowed from a recent Croatian programming contest but please don't cheat by looking at the solution outlines :) You are given a set of circles in the plane with their centers on ...
17
votes
8answers
789 views

Thinking outside the box

You are trying to fit a sphere into a 5-sided box, but sometimes it does not fit completely. Write a function to calculate how much of the sphere is outside (above the rim of) the box. There are 3 ...
6
votes
5answers
204 views

Golfing: How many unit-length squares in a list of 2d coordinates?

Given a list of 2d (x, y) coordinates, determine how many unit squares (edge length 1 unit) can be formed using the coordinates. Input will be an array of 0 or more pairs of coordinates: e.g. in ...
10
votes
10answers
825 views

Generate a right triangle

In this challenge, you must take two numbers (separated by a space) as input and output a right triangle. The first number will be the width of the triangle you should output. The second number will ...
8
votes
2answers
654 views

The centers of a triangle

Circles and squares have a single, definite center point. However, the notion of the center of a triangle has long been discussed. Four different centers were known to the Ancient Greeks - the ...
8
votes
7answers
626 views

Number of holes in a polygon

The Problem: Count the number of holes in a connected polygon. Connectivity of the polygon is guaranteed by the condition that every triangle in the input triangulation shares at least 1 side with ...
12
votes
4answers
640 views

Find the Convex Hull of a set of 2D points

When you hammer a set of nails into a wooden board and wrap a rubber band around them, you get a Convex Hull. Your mission, should you decide to accept it, is to find the Convex Hull of a given set ...
11
votes
4answers
3k views

Polygon prefixes

Polygons are named after the number of sides that they have. A pentagon has 5 sides, an octagon has 8 sides. But how are they named? What's the name for a 248-sided polygon? All polygons are suffixed ...
4
votes
3answers
232 views

Line through Polygon

Input: A line of the standard slope-and-intercept form: mx+b, as well as a set of Cartesian points determining the vertices of a polygon. Assume that the x and y values of the points will be integers. ...
10
votes
3answers
885 views

Solving triangles with trigonometry

Time to dig up your old trigonometry notes from high school! The challenge is to solve the unknown sides and angles of different triangles. And as is customary in code golf, the smallest working code ...
15
votes
4answers
620 views

Determine if a polygon is convex

Write a program to determine if the input polygon is convex. The polygon is specified with one line containing N, the number of vertices, then N lines containing the x and y coordinates of each ...
6
votes
7answers
419 views

Intersection of Two Lines

Given equation of two lines in the format Ax+By=C, determine their intersection point. If they are parallel print 'parallel' without quotes. For input/output format refer sample input/output. Input ...
8
votes
4answers
437 views

Code-Golf: Lattice Points inside a Circle

The following picture shows the problem: Write a function that, given an integer as the circle radius, calculates the number of lattice points inside the centered circle (including the boundary). ...
3
votes
1answer
100 views

Squares in Movement Range

There are two inputs, the first input is a map in 2D array, where 2 represents an obstacle and 0 represents a regular ground, and 1 represents the player's location (implies that the player is ...
7
votes
2answers
330 views

Simple Geometric problem

This problem (see below) has been given as High School Programming League code golf challange. The shortes codes submitted during the contest where: 177 bytes in Ruby, 212 bytes in Python 2.5, 265 ...
3
votes
2answers
364 views

Turn 2D boolean array into (rectilinear) polygons

Challenge Write a program which, given a 2-dimensional boolean array (equivalently, a monochromatic bitmap), outputs a series of polygons that describe the outline of the region that is “true” (1). ...