source: trunk/packages/vizservers/nanovis/Plane.h @ 3177

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ----------------------------------------------------------------------
4 * Plane.h: plane class
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
10 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16#ifndef PLANE_H
17#define PLANE_H
18
19#include "Vector3.h"
20#include "Mat4x4.h"
21
22class Plane
23{
24    float a, b, c, d;
25public:
26
27    Plane(float a, float b, float c, float d);
28
29    Plane(float coeffs[4]);
30
31    Plane()
32    {}
33
34    void getPoint(Vector3& point);
35
36    //bool clips(float point[3]) const { return !retains(point); }
37
38    void transform(const Mat4x4& mat);
39
40    void transform(float *m)
41    {
42        Mat4x4 mat(m);
43        transform(mat);
44    }
45
46    bool retains(const Vector3& point) const
47    {
48        return ((a*point.x + b*point.y + c*point.z + d) >= 0);
49    }
50
51    Vector4 getCoeffs() const
52    {
53        return Vector4(a, b, c, d);
54    }
55
56    void setCoeffs(float a_val, float b_val, float c_val, float d_val)
57    {
58        a = a_val, b = b_val, c = c_val, d = d_val;
59    }
60
61    void getNormal(Vector3& normal) const
62    {
63        normal.x = a;
64        normal.y = b;
65        normal.z = c;
66    }
67};
68
69
70#endif
Note: See TracBrowser for help on using the repository browser.