Plane.hh 1.66 KB
Newer Older
Will Schroeder's avatar
Will Schroeder committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*=========================================================================

  Program:   Visualization Library
  Module:    Plane.hh
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

This file is part of the Visualization Library. No part of this file
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.

Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994 

=========================================================================*/
Will Schroeder's avatar
Will Schroeder committed
16
17
18
19
// .NAME vlPlane - perform various plane computations
// .SECTION Description
// vlPlane provides methods for various plane computations. These include
// projecting points onto a plane, evaluating the plane equation, and 
Will Schroeder's avatar
Will Schroeder committed
20
21
// returning plane normal. vlPlane is a concrete implementation of the 
// abstract class vlImplicitFunction.
Will Schroeder's avatar
Will Schroeder committed
22
23
24
25

#ifndef __vlPlane_h
#define __vlPlane_h

Will Schroeder's avatar
Will Schroeder committed
26
#include "ImpFunc.hh"
Will Schroeder's avatar
Will Schroeder committed
27

Will Schroeder's avatar
Will Schroeder committed
28
class vlPlane : public vlImplicitFunction
Will Schroeder's avatar
Will Schroeder committed
29
30
{
public:
Will Schroeder's avatar
Will Schroeder committed
31
  vlPlane();
Will Schroeder's avatar
Will Schroeder committed
32
33
  char *GetClassName() {return "vlPlane";};

Will Schroeder's avatar
Will Schroeder committed
34
  // project point onto plane, returning coordinates
Will Schroeder's avatar
Will Schroeder committed
35
  void ProjectPoint(float x[3], float origin[3], float normal[3], float xproj[3]);
Will Schroeder's avatar
Will Schroeder committed
36

Will Schroeder's avatar
Will Schroeder committed
37
38
39
  float Evaluate(float normal[3], float origin[3], float x[3])
    {return normal[0]*(x[0]-origin[0]) + normal[1]*(x[1]-origin[1]) + 
            normal[2]*(x[2]-origin[2]);};
Will Schroeder's avatar
Will Schroeder committed
40
41
42

  // ImplicitFunction interface
  float Evaluate(float x, float y, float z);
Will Schroeder's avatar
Will Schroeder committed
43
  void EvaluateNormal(float x, float y, float z, float n[3]);
Will Schroeder's avatar
Will Schroeder committed
44
45

  vlSetVector3Macro(Normal,float);
Will Schroeder's avatar
Will Schroeder committed
46
  vlGetVectorMacro(Normal,float,3);
Will Schroeder's avatar
Will Schroeder committed
47
48

  vlSetVector3Macro(Origin,float);
Will Schroeder's avatar
Will Schroeder committed
49
  vlGetVectorMacro(Origin,float,3);
Will Schroeder's avatar
Will Schroeder committed
50
51
52
53
54

protected:
  float Normal[3];
  float Origin[3];

Will Schroeder's avatar
Will Schroeder committed
55
56
57
58
59
};

#endif