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

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

/* Generated by Interface Builder */

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

@implementation Mandelsine

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

    return self;
}

- getController:sender :map
{
    [super getController:sender :map];
    [NXApp loadNibSection:"Mandelsine.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 * sin(Real) * cosh(Imaginary) - YC * cos(Real) * sinh(Imaginary) + realCoord;
	Imaginary = YC * sin(Real) * cosh(Imaginary) + XC * cos(Real) * sinh(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.