summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmath/Plane.h
blob: dc468b28e204acc5c8df65ea1a92627e50feade1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This code is in the public domain -- Ignacio Castaño <castano@gmail.com>

#pragma once
#ifndef NV_MATH_PLANE_H
#define NV_MATH_PLANE_H

#include "nvmath.h"
#include "Vector.h"

namespace nv
{
    class Matrix;

    class NVMATH_CLASS Plane
    {
    public:
        Plane();
        Plane(float x, float y, float z, float w);
        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);

        const Plane & operator=(const Plane & v);

        Vector3 vector() const;
        float offset() const;
        Vector3 normal() const;

        void operator*=(float s);

        Vector4 v;
    };

    Plane transformPlane(const Matrix &, const Plane &);

    Vector3 planeIntersection(const Plane & a, const Plane & b, const Plane & c);


} // nv namespace

#endif // NV_MATH_PLANE_H