Release 1.0  No Copyright 1992 by David Stes, No Rights Reserved
You Can Contact Me At : david stes, hoge meerheuvel 5, 2960 brecht BELGIUM  (stes@cage.rug.ac.be)
Please Do Not Make Serious Use Of This Object

Cube

INHERITS FROM	Control:View:Slider:Object

DECLARED IN	"Cube.h"

CLASS DESCRIPTION

Cubes are Controls that represent a certain three dimensional transformation matrix.  Clicking a point inside the cube, will cause it to 'stick' to the mouse pointer;  by rotating the cube, you alter the value of the matrix.  In response to an action message sent by the Cube, you can retrieve the matrix by sending the Cube a getmatrix: message.

Cube (and an accompanying CubeCell) can be dragged into your application from the CubePalette in Interface Builder.

IMPORTANT : to compile, you should link the Cube class into your application
	(i) 	add Cube.h and CubeCell.h to ".h(other)"
	(ii) 	add Cube.o and CubeCell.o to "Other files"
	(iii)	create a Makefile.preamble containing the following lines :

   				 OTHER_OFILES = Cube.o CubeCell.o

INSTANCE VARIABLES

Inherited from Object	Class	isa;

Inherited from Responder	id	nextResponder;

Inherited from View	NXRect	frame;
NXRect	bounds;
id	superview;
id	subviews;
id	window;
struct __vFlags	vFlags;

Inherited from Control	int	tag;
id	cell;
struct _conFlags	conFlags;

Declared in Cube	(none)

METHOD TYPES

Initializing a new Cube instance	± initFrame:

Setting Cube Values	- reset:
- setmatrix: 
- getmatrix:

Resizing the Cube	- sizeToFit

Handling Events	- acceptsFirstMouse
- mouseDown:

CLASS METHODS

(none)

INSTANCE METHODS

acceptsFirstMouse

Returns YES since Cubes always accept first mouse.

initFrame:
± initFrame:(const NXRect *)frameRect

Initializes and returns the receiver, a new instance of Cube.  The Cube will be centered in the frameRect such that there's enough space to rotate it.  By default, the Cube isn't continuous.  After initializing the Cube, invoke the sizeToFit method to resize the Cube.  This method is the designated initializer for the Cube class. 

getmatrix:
- getmatrix:(float *)get

Copy the transformation matrix of the cube into the get matrix.  Send display: to visualize the change.

Example :

- example
{
    float matrix[3][3];
    
    ...
    
    [cube getmatrix:(float*)matrix];
    
    ...
}

mouseDown:
- mouseDown:(NXEvent *)theEvent

Sends a  trackMouse:inRect:ofView: message to the Cube's cell.  Returns self.

reset:
- reset:sender

Set the transformation matrix to the identity matrix.   Send display: to visualize the change.

setmatrix:
- setmatrix:(float *)set

Copy the set matrix into the transformation matrix of the cube.  The determinant of the matrix should be +1.   Send display: to visualize the change.

Example :

- example
{
    float matrix[3][3];
    
    ...
    
    [cube setmatrix:(float*)matrix];
    
    ...
}
  
sizeToFit
- sizeToFit

The Cube is sized to fit its cell.  Returns self.