The CJ-5
Posted by Ryan Baxter Mon, 27 Oct 2008 17:12:00 GMT
A couple of weeks ago I became the owner of a 1958 Willy’s CJ-5. I’ve always wanted a Jeep and only seriously started looking for one about a month ago. Being the web-savvy guy that I am - my search started with eBay and craigslist. Not having any luck online, I contacted a friend and fellow Jeepster for advice. Apparently I should have started my search a little closer to home. Sitting in a back lot of Triple A Motors in Williamsport, Pennsylvania was the CJ-5.
I’ve begun busting my knuckles and as a Web Developer, it’s a much welcome diversion. There is something extremely gratifying in wrenching on a vehicle and hearing it’s engine roar to life for the first time. Well, sputter and die in my case, but it did run briefly. I’ve already replaced the distributor cap and rotor, plugs, wires, and fuel pump. Hopefully with some new vacuum lines she’ll be ready for a proper test drive.
Since this will be an ongoing project, I’ll have more pictures as progress is made.
- Meta 3 comments, permalink, rss, atom
Ruby Fractal Library 1.1.0
Posted by Ryan Baxter Fri, 24 Oct 2008 18:49:00 GMT
Between spending time with the baby and working on a new project (more to come), I’ve found time to add a few features to the Ruby Fractal Library. An Algorithms module now contains lambda expressions implementing both the Escape Time and Normalized Iteration Count algorithms. Users can also create their own lambda expressions and assign them to the Fractal class’s algorithm property.
In the example below, I’ve show the difference between images rendered using the Escape Time and Normalized Iteration Count algorithms. As you can see, the Normalized Iteration Count algorithm generates images without the color banding associated with the Escape Time algorithm.
| Escape Time | Normalized Iteration Count |
|
|
A Themes module now serves as a home for all of the library’s predefined color palettes. There are only two, but they’re easy to make. Since themes are also expressed as lambdas they too can be created by users and applied to the Fractal class. Below is my attempt at creating a snowflake using the Julia set and a user-defined theme.
snowflakes = Julia.new(Complex(-0.3007, 0.6601), 5, 100)
snowflakes.width = 350
snowflakes.height = 350
snowflakes.m = 2
snowflakes.set_color = PNG::Color::White
snowflakes.algorithm = Algorithms::NormalizedIterationCount
snowflakes.theme = lambda { |index|
r, g, b = 0, 0, 0
if index >= 510
r = 0
g = 255 % index
b = 255
elsif index >= 255
r = 0
g = index % 255
b = 255
else
b = index % 255
end
return r, g, b
}
snowflakes.draw('snowflakes.png')Snowflakes was inspired by a colleague who wondered why I kept creating paisley. The Fire theme will do that. :)
When I get more time I’d like to implement some of the Escape Angle and Curvature Estimation algorithms as outlined by Garcia, Fernandez, Barrallo, and Martin, but for now I’d gladly accept any user-contributed algorithms or themes.
A fractal can now be instantiated with a single point rather than a range. This is the biggest breaking change over version 1.0.0. I believe that this makes the library easier to use and more similar to other fractal generating programs. The Fractal type also contains a where_is? method. This should help when trying to determine the complex coordinate of an x, y value pair.
In testing the library, I attempted to generate a few of the fractals found in the Mandelbrot set Wikipedia entry. The images found at Wikipedia were rendered using Ultra Fractal 3 and are beautiful. Knowing Ruby, I didn’t expect to generate images with the same quality, but I was pleasantly surprised. Here is “Satellite” followed by the Misiurewicz point. Both were rendered with the Ruby Fractal Library.
| Satellite | Misiurewicz point |
|
|
Satellite can be found where c = -0.743643135, 0.131825963i at around 200k magnification. I had to set max_iterations = 1500 to get this level of detail. It still took a few minutes to render using the latest YARV interpreter on an Intel Core 2 Duo 2.6Ghz. Overall I’ve noticed that YARV finishes rendering the Mandelbrot set in approximately half the time of the old Matz interpreter. Not a bad gain. It’ll never be as quick as C, but I still look forward to Ruby 2.0!
The Ruby Fractal Library can be found under the “Projects” section of this website. Feel free to send me any feedback. I’d love to see some new color themes or algorithms.
- Posted in Code Snippets
- Meta no trackbacks, 2 comments, permalink, rss, atom

