This is Lamda.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "Lamda.h" #import <math.h> #import <stdlib.h> #import <stdio.h> #import <appkit/Application.h> #import <appkit/color.h> #import <appkit/Form.h> @implementation Lamda - free { [myInspector free]; /* Free that pesky inspector. */ [super free]; return self; } - getController:sender :map { [super getController:sender :map]; [NXApp loadNibSection:"Lamda.nib" owner:self]; /* Load the inspector */ XC = 0; /* * Set default values for XC and YC */ YC = 1; return self; } - setXYC:sender { XC = [sender doubleValueAt:0]; YC = [sender doubleValueAt:1]; return self; } - gohome:(float *)newX :(float *)newY :(float *)newDX :(float *)newDY :(int *)newDepth { *newX = 0.0; *newY = 0.0; *newDX = 4; *newDY = 4; *newDepth = 150; return self; } - (int)colorindex:(double)Real :(double)Imaginary { /* * Overwritten for Lamda set f(z) = lambda * Z * (1 - Z) = lambda * Z - * lambda * Z * Z = XCx + XCy + YCx + YCy - (XCx + XCy + YCx + YCy) * (x + * y) = XCx + XCy + YCx + YCy - (XCxx + XCyx + YCxx + YCyx + XCxy + XCyy + * YCxy + YCyy) XCx + XCy + YCx + YCy - (XCxx + 2XCyx + YCxx + 2YCyx + XCyy * + YCyy) XCx + XCy + YCx + YCy - XCxx - 2XCy - YCxx - 2YCyx - XCyy - YCyy * XCx + YCy - XCxx - 2YCyx - XCyy + XCy + YCx - 2XCy - YCxx - YCyy */ register double realCoord = XC, imaginaryCoord = YC, tempdouble; register int i; #ifdef DEBUG printf("\nReal %lf Imaginary %lf depth %d\n", Real, Imaginary, Depth); #endif for (i = 0; i < Depth; i++) { if (Real * Real + Imaginary * Imaginary > 4) { return ((int)(chaosColors) * i / Depth); } tempdouble = (realCoord) * (Real) - (imaginaryCoord) * (Imaginary) - (realCoord) * (Real) * (Real) + 2 * (imaginaryCoord) * (Imaginary) * (Real) + (realCoord) * (Imaginary) * (Imaginary); Imaginary = (realCoord) * (Imaginary) + (imaginaryCoord) * (Real) - 2 * (realCoord) * (Imaginary) - (imaginaryCoord) * (Real) * (Real) + (imaginaryCoord) * (Imaginary) * (Imaginary); Real = tempdouble; } return (chaosColors); } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.