2011-09-01 22:16:37 +00:00
|
|
|
|
// This code is in the public domain -- Ignacio Casta<74>o <castano@gmail.com>
|
2008-04-17 06:58:43 +00:00
|
|
|
|
|
2010-05-27 23:19:24 +00:00
|
|
|
|
#pragma once
|
2008-04-17 06:58:43 +00:00
|
|
|
|
#ifndef NV_MATH_PLANE_H
|
|
|
|
|
#define NV_MATH_PLANE_H
|
|
|
|
|
|
2011-09-01 22:16:37 +00:00
|
|
|
|
#include "nvmath.h"
|
|
|
|
|
#include "Vector.h"
|
2008-04-17 06:58:43 +00:00
|
|
|
|
|
|
|
|
|
namespace nv
|
|
|
|
|
{
|
2010-05-27 23:19:24 +00:00
|
|
|
|
class Matrix;
|
|
|
|
|
|
|
|
|
|
class NVMATH_CLASS Plane
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Plane();
|
|
|
|
|
Plane(float x, float y, float z, float w);
|
2012-07-20 16:19:03 +00:00
|
|
|
|
Plane(const Vector4 & v);
|
|
|
|
|
Plane(const Vector3 & v, float d);
|
|
|
|
|
Plane(const Vector3 & normal, const Vector3 & point);
|
|
|
|
|
Plane(const Vector3 & v0, const Vector3 & v1, const Vector3 & v2);
|
2010-05-27 23:19:24 +00:00
|
|
|
|
|
2012-07-20 16:19:03 +00:00
|
|
|
|
const Plane & operator=(const Plane & v);
|
2010-05-27 23:19:24 +00:00
|
|
|
|
|
|
|
|
|
Vector3 vector() const;
|
2012-01-02 08:49:13 +00:00
|
|
|
|
float offset() const;
|
2018-02-06 02:55:07 +00:00
|
|
|
|
Vector3 normal() const;
|
2010-05-27 23:19:24 +00:00
|
|
|
|
|
2012-01-02 08:49:13 +00:00
|
|
|
|
void operator*=(float s);
|
2010-05-27 23:19:24 +00:00
|
|
|
|
|
2012-07-20 16:19:03 +00:00
|
|
|
|
Vector4 v;
|
2010-05-27 23:19:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
2012-07-20 16:19:03 +00:00
|
|
|
|
Plane transformPlane(const Matrix &, const Plane &);
|
2010-05-27 23:19:24 +00:00
|
|
|
|
|
2012-07-20 16:19:03 +00:00
|
|
|
|
Vector3 planeIntersection(const Plane & a, const Plane & b, const Plane & c);
|
2010-05-27 23:19:24 +00:00
|
|
|
|
|
|
|
|
|
|
2008-04-17 06:58:43 +00:00
|
|
|
|
} // nv namespace
|
|
|
|
|
|
|
|
|
|
#endif // NV_MATH_PLANE_H
|