Geometry Puzzler
Jun 27, 09
For the love of puzzlers, try your hand at the following math problem:
You are given four 2-dimensional co-ordinates in a random order. What is the simplest method to draw the enclosing polygon created by joining the points?
Answers should be written in C-like syntax or pseudo code, without library dependencies, and should not include any visual methods. You can simply return an array of co-ordinates that, when followed in order, will draw the proper polygon.
For example:
function polygon(p1, p2, p3, p4) {
polygon( [x1,y1] , [x2,y2] , [x3,y3] , [x4,y4] );
The winning entry will be used in a 3D game released for amoebaOS, and will be credited within the game for their contribution!

Good luck and have fun!
You are given four 2-dimensional co-ordinates in a random order. What is the simplest method to draw the enclosing polygon created by joining the points?
Answers should be written in C-like syntax or pseudo code, without library dependencies, and should not include any visual methods. You can simply return an array of co-ordinates that, when followed in order, will draw the proper polygon.
For example:
function polygon(p1, p2, p3, p4) {
// code
return [ p3, p2, p4, p1];
}return [ p3, p2, p4, p1];
polygon( [x1,y1] , [x2,y2] , [x3,y3] , [x4,y4] );
The winning entry will be used in a 3D game released for amoebaOS, and will be credited within the game for their contribution!

Good luck and have fun!
Comments
Leave a Comment