Sha256: 37d41395a0fe2083008965fe2f0028ea999dcabf8ba8b1656120121aa0214b98

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

// -*- c++ -*-
#pragma once
#ifndef __RAYS_MATRIX_H__
#define __RAYS_MATRIX_H__


#include <rays/defs.h>
#include <rays/point.h>


namespace Rays
{


	struct Matrix
	{

		typedef Matrix This;

		enum {NROW = 4, NCOLUMN = 4, NELEM = NROW * NCOLUMN};

		union
		{
			struct
			{
				coord
					x0, y0, z0, w0,
					x1, y1, z1, w1,
					x2, y2, z2, w2,
					x3, y3, z3, w3;
			};
			Coord4 column[NCOLUMN];
			coord array[NELEM];
		};

		Matrix (coord value = 1);

		Matrix (
			coord x0, coord x1, coord x2, coord x3,
			coord y0, coord y1, coord y2, coord y3,
			coord z0, coord z1, coord z2, coord z3,
			coord w0, coord w1, coord w2, coord w3);

		Matrix (const coord* elements, size_t size);

		Matrix (void* null);

		This dup () const;

		This& reset (coord value = 1);

		This& reset (
			coord x0, coord x1, coord x2, coord x3,
			coord y0, coord y1, coord y2, coord y3,
			coord z0, coord z1, coord z2, coord z3,
			coord w0, coord w1, coord w2, coord w3);

		This& reset (const coord* elements, size_t size);

		This& translate (coord x, coord y, coord z = 0);

		This& translate (const Coord3& translate);

		This& scale (coord x, coord y, coord z = 1);

		This& scale (const Coord3& scale);

		This& rotate (float degree, coord x = 0, coord y = 0, coord z = 1);

		This& rotate (float degree, const Coord3& normalized_axis);

		coord& at (int row, int column);

		coord  at (int row, int column) const;

		String inspect () const;

		coord& operator [] (int index);

		coord  operator [] (int index) const;

		This& operator *= (const This&  rhs);

		Point operator *  (const Point& rhs) const;

		This  operator *  (const This&  rhs) const;

		friend bool operator == (const This& lhs, const This& rhs);

		friend bool operator != (const This& lhs, const This& rhs);

	};// Matrix


}// Rays


#endif//EOH

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rays-0.1.48 include/rays/matrix.h
rays-0.1.47 include/rays/matrix.h