spiral

Varying Colors in Processing

I've been working on porting some of my Processing code over to regular Java in NetBeans. So far so well, most everything works great, except for when I go to use non-grayscale colors. I have a script that draws a spiral pattern, and should vary the colors in the spiral based on a modulus check. The script seems to hang, however, and I...

What is the algorithm for storing the pixels in a spiral in JS?

What is the algorithm for storing the pixels in a spiral in JS? ...

Looping in a spiral

A friend was in need of an algorithm that would let him loop through the elements of an NxM matrix (N and M are odd). I came up with a solution, but I wanted to see if my fellow SO'ers could come up with a better solution. I'm posting my solution as an answer to this question. Example Output: For a 3x3 matrix, the output should be: (...

2d Array in Spiral Order

I'm trying to fill an array in spiral order. So far, I can print the array in spiral order, but is there a way to modify the array so that i can fill it in spiral order and then just print the array? I'd like it to go in decreasing order like a countdown. Please help! public class Spiral { public static void main(int m, int n) { ...

Traverse 2D Array in Spiral pattern using recursion.

Hi, I am preparing for an interview and have been stuck on this question for quite some time now. Could anybody please help me with the code. If not complete then may be a snippet of it? Please.. ...

PHP script to draw a spiral?

Does anybody have a PHP (or other language) script for drawing a spiral. A simple (Archimedean spiral) would be just fine. Of course the principle is simple but coding it in SVG or GD would take some time, so I wonder if somebody has one ready :-) ...

Code Golf: Easter Spiral

What's more appropriate than a Spiral for Easter Code Golf sessions? Well, I guess almost anything. The Challenge The shortest code by character count to display a nice ASCII Spiral made of asterisks ('*'). Input is a single number, R, that will be the x-size of the Spiral. The other dimension (y) is always R-2. The program can assume...

rendering an antialiased spiral

I have looked at this example using php and GD to piecewise-render a spiral with small arcs. What I would like to do is render an approximation to a spiral that is as mathematically accurate as possible. Inkscape has a spiral tool that looks pretty good, but I would like to do the spiral generation programmatically (preferably in Python...

grid traversal question

Possible Duplicate: Looping in a spiral Given a grid of any height and width, write an algorithm to traverse it in a spiral. (Starting at the top left and ending in the middle) without passing over previously visited nodes. Without using nested loops. ...

Spiral Vs. (Throw away Prototype Vs. Evolutionary Prototype) - Software Development Life Cycle

What is the difference between Spiral Model and Prototype model in software engineering. and also state some difference between Throwaway and Evolutionary prototyping. ...

Generate lazy "spiral" in Scala

Task: For a given position in 2D array generate list of surrounding positions located in radius. For example: input: (1, 1) radius: 1 output: ( (0, 0), (1, 0), (2, 0), (0, 1), (2, 1), (0, 2), (1, 2), (2, 2) ). I wrote something like def getPositions(x:Int, y:Int, r:Int) = { for(radius <- 1 to r) yield ...