ftp.nice.ch/pub/next/developer/objc/3dkit/Pyramid.s.tar.gz#/Pyramid/matrix.h

This is matrix.h in view mode; [Download] [Up]

/*	matrix.h - matrix algebra definitions
 *	Copyright (C) 1993 Corona Design, Inc. All rights reserved.
 *
 *	Abstract
 *		Common algebraic manipulations of 4X4 matrices and vectors.
 *		Reference: Foley & van Dam, Computer Graphics
 *	Requires C++ compiler.
 *
 *	$LOG
 */
 
#ifndef	_MATRIX_H
#define	_MATRIX_H

								// a homogenous 3D vector
typedef struct _vector
	{
	float	x;
	float	y;
	float	z;
	float	w;
								//operations
			float 	vectorLength();
								// V = V X W
			void	crossProduct( struct _vector *);
								// V = M * V
			void	matrixMultiply( struct _matrix *);
								// V = V * k
			void	scalarMultiply( float k);
	} VECTOR;


								// 4 X 4 matrix
struct _matrix
	{
	float	matrix[4][4];
								// retrieve rotation vectors
			struct _vector *getRx();
			struct _vector *getRy();
			struct _vector *getRz();
								// A *= B
			void	matrixMultiply( struct _matrix *B);
	};


								// constant identity elements
extern	VECTOR			unitVector;
extern	struct _matrix	unitMatrix;


#ifdef	_LOG
/*
 *	$Log:	matrix.h,v $
 * Revision 1.1  93/09/15  12:33:57  pkron
 * Created
 * 
 */
#endif		

#endif	// MATRIX_H

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