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

Last change on this file since 2720 was 2096, checked in by ldelgass, 13 years ago

Normalize line endings, set eol-style to native on *.cpp, *.h files

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