Sha256: 25d702fd514efe798592668b8554d2954cbb96de0449d2c44b5ad30ddb7aff83

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

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


#include <rays/defs.h>


namespace Rays
{


	struct Coord2
	{

		union
		{
			struct {coord x, y;};
			coord array[2];
		};

		Coord2& reset (coord value = 0);

		Coord2& reset (coord x, coord y);

		      coord& operator [] (size_t index);

		const coord& operator [] (size_t index) const;

	};// Coord2


	struct Coord3
	{

		union
		{
			struct {coord x, y, z;};
			coord array[3];
		};

		Coord3& reset (coord value = 0);

		Coord3& reset (coord x, coord y, coord z = 0);

		      coord& operator [] (size_t index);

		const coord& operator [] (size_t index) const;

	};// Coord3


	struct Point : public Coord3
	{

		Point (coord value = 0);

		Point (coord x, coord y, coord z = 0);

		Point dup () const;

		Point& move_to (coord x, coord y, coord z = 0);

		Point& move_to (const Point& point);

		Point& move_by (coord x, coord y, coord z = 0);

		Point& move_by (const Point& point);

		coord length () const;

		void  normalize ();

		Point normal () const;

		String inspect () const;

		Point operator - () const;

		Point& operator += (const Point& rhs);

		Point& operator -= (const Point& rhs);

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

		Point& operator /= (const Point& rhs);

		Point& operator /= (coord rhs);

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

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

		friend Point operator + (const Point& lhs, const Point& rhs);

		friend Point operator - (const Point& lhs, const Point& rhs);

		friend Point operator * (const Point& lhs, const Point& rhs);

		friend Point operator / (const Point& lhs, const Point& rhs);

		friend Point operator / (const Point& lhs, coord        rhs);

	};// Point


}// Rays


#endif//EOH

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rays-0.1.12 include/rays/point.h
rays-0.1.11 include/rays/point.h
rays-0.1.10 include/rays/point.h
rays-0.1.9 include/rays/point.h