This is JuliaN.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "JuliaN.h" #import <math.h> #import <stdlib.h> #import <stdio.h> #import <appkit/Application.h> #import <appkit/color.h> #import <appkit/Form.h> @implementation JuliaN - free { [myInspector free]; /* Free that pesky inspector. */ [super free]; return self; } - getController:sender :map { [super getController:sender :map]; [NXApp loadNibSection:"JuliaN.nib" owner:self]; /* Load the inspector */ XC = 0; /* * Set default values for XC and YC */ YC = 0.83; toPower = 4; return self; } - setXYCPower:sender { XC = [sender doubleValueAt:0]; YC = [sender doubleValueAt:1]; toPower = [sender intValueAt:2]; [sender setIntValue:toPower at:2]; 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 JuliaN set */ double realCoord, imaginaryCoord; register int i, j; #ifdef DEBUG printf("\nReal %lf Imaginary %lf depth %d\n", Real, Imaginary, Depth); #endif for (i = 0; i < Depth; i++) { realCoord = Real; imaginaryCoord = Imaginary; if (Real * Real + Imaginary * Imaginary > 4) { return ((int)(chaosColors) * i / Depth); } for (j = 1; j < toPower; j++) /* must execute toPower - 1 times */ mulCoords(&Real, &Imaginary, &realCoord, &imaginaryCoord); Real = Real + XC; Imaginary = Imaginary + YC; } return (chaosColors); } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.