ftp.nice.ch/pub/next/science/mathematics/PrimeSpiral.N.bs.tar.gz#/PrimeSpiral/SpiralView.m

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

/* File:	SpiralView.m - View object for 'PrimeSpiral'
 *
 * By:		Christopher Lane
 *		Symbolic Systems Resources Group
 *		Knowledge Systems Laboratory
 *		Stanford University
 *
 * Date:	26 February 1990
 *
 * Copyright:	1990 by The Leland Stanford Junior University.  This program
 *		may be distributed without restriction for non-commercial use.
 */

#import "SpiralView.h"

#import <math.h>
#import <appkit/Cell.h>
#import <appkit/Cursor.h>
#import <dpsclient/psops.h>

#import "PrimeGenerator.h"
#import "SpiralGenerator.h"
#import "SpiralOps.h"

@implementation SpiralView

- spiral:sender
{
	NXPoint point;
	PrimeGenerator *prime = [PrimeGenerator new];
	SpiralGenerator *spiral = [SpiralGenerator new];
	
	point.x = (float) rint((double) (bounds.size.width / 2.0));
	point.y = (float) rint((double) (bounds.size.height / 2.0));
	
	[self lockFocus];
	
	PSclearToGray(NX_LTGRAY);
	
	while(point.x > bounds.origin.x || point.y > bounds.origin.y) {
		[spiral generate:[prime generate] :&point];
		PSdrawAt(point.x, point.y);
		}
		
	[self unlockFocus];
	
	[prime free];
	[spiral free];
	
	return self;
}

- setVersion:anObject
{
	[(version = anObject) setStringValue:VERSION];
	
	return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.