This is Mandelexp.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "Mandelexp.h" #import <math.h> #import <stdlib.h> #import <stdio.h> #import <appkit/Application.h> #import <appkit/color.h> #import <appkit/Form.h> @implementation Mandelexp - free { [myInspector free]; /*Free that pesky inspector.*/ [super free]; return self; } - getController:sender :map { [super getController:sender :map]; [NXApp loadNibSection:"Mandelexp.nib" owner:self]; /* Load the inspector */ XC = 0; /* * Set default values for XC and YC */ YC = 1; /* XC and YC should really be Lambdax and Lambday... */ /* I 'll fix it for Juliasine, then, maybe... */ 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 Mandelsine set */ register double realCoord = Real, imaginaryCoord = Imaginary, 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 = XC * exp(Real) * cos(Imaginary) - YC * exp(Real) * sin(Imaginary) + realCoord; Imaginary = YC * exp(Real) * cos(Imaginary) + XC * exp(Real) * sin(Imaginary) + imaginaryCoord; 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.