ftp.nice.ch/pub/next/science/mathematics/TotalChaos.1.0.s.tar.gz#/TotalChaos/types/JuliaBrot.m

This is JuliaBrot.m in view mode; [Download] [Up]

/* Generated by Interface Builder */

#import "JuliaBrot.h"
#import <math.h>
#import <stdlib.h>
#import <stdio.h>
#import <appkit/Application.h>
#import <appkit/color.h>
#import <appkit/Form.h>

@implementation JuliaBrot

- free
{
    [myInspector free];
 /* Free that pesky inspector. */
    [super free];
    return self;
}

- getController:sender :map
{
    [super getController:sender :map];
    [NXApp loadNibSection:"JuliaBrot.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 Julia set(note, only diff is next line ! !) 
  */
    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 > 10)
	{
	    return ((int)(chaosColors) * i / Depth);
	}
	tempdouble = Real * Real - Imaginary * Imaginary + realCoord;
	Imaginary = 2 * Real * 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.