BoolSPts.hh 4.38 KB
Newer Older
Will Schroeder's avatar
Will Schroeder committed
1
2
/*=========================================================================

Ken Martin's avatar
Ken Martin committed
3
  Program:   Visualization Toolkit
Will Schroeder's avatar
Will Schroeder committed
4
5
6
7
8
  Module:    BoolSPts.hh
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

Ken Martin's avatar
Ken Martin committed
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

Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.

This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
The following terms apply to all files associated with the software unless
explicitly disclaimed in individual files. This copyright specifically does
not apply to the related textbook "The Visualization Toolkit" ISBN
013199837-4 published by Prentice Hall which is covered by its own copyright.

The authors hereby grant permission to use, copy, and distribute this
software and its documentation for any purpose, provided that existing
copyright notices are retained in all copies and that this notice is included
verbatim in any distributions. Additionally, the authors grant permission to
modify this software and its documentation for any purpose, provided that
such modifications are not distributed without the explicit consent of the
authors and that existing copyright notices are retained in all copies. Some
of the algorithms implemented by this software are patented, observe all
applicable patent law.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
"AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Will Schroeder's avatar
Will Schroeder committed
38
39
40
41
42
or its contents may be copied, reproduced or altered in any way
without the express written consent of the authors.


=========================================================================*/
Ken Martin's avatar
Ken Martin committed
43
// .NAME vtkBooleanStructuredPoints - combine two or more structured point sets
Will Schroeder's avatar
Will Schroeder committed
44
// .SECTION Description
Ken Martin's avatar
Ken Martin committed
45
// vtkBooleanStructuredPoints is a filter that performs boolean combinations on
Will Schroeder's avatar
Will Schroeder committed
46
47
48
49
// two or more input structured point sets. Operations supported include union,
// intersection, and difference. A special method is provided that allows 
// incremental appending of data to the filter output.

Ken Martin's avatar
Ken Martin committed
50
51
#ifndef __vtkBooleanStructuredPoints_h
#define __vtkBooleanStructuredPoints_h
Will Schroeder's avatar
Will Schroeder committed
52
53
54
55
56
57
58
59
60

#include "Filter.hh"
#include "StrPts.hh"
#include "StrPtsC.hh"

#define UNION_OPERATOR 0
#define INTERSECTION_OPERATOR 1
#define DIFFERENCE_OPERATOR 2

Ken Martin's avatar
Ken Martin committed
61
class vtkBooleanStructuredPoints : public vtkStructuredPoints, public vtkFilter
Will Schroeder's avatar
Will Schroeder committed
62
63
{
public:
Ken Martin's avatar
Ken Martin committed
64
65
66
67
  vtkBooleanStructuredPoints();
  ~vtkBooleanStructuredPoints();
  char *GetClassName() {return "vtkBooleanStructuredPoints";};
  void PrintSelf(ostream& os, vtkIndent indent);
Will Schroeder's avatar
Will Schroeder committed
68

Ken Martin's avatar
Ken Martin committed
69
70
71
72
73
  void AddInput(vtkStructuredPoints *in);
  void AddInput(vtkStructuredPoints &in) {this->AddInput(&in);};
  void RemoveInput(vtkStructuredPoints *in);
  void RemoveInput(vtkStructuredPoints &in) {this->RemoveInput(&in);};
  vtkStructuredPointsCollection *GetInput() {return &(this->InputList);};
Will Schroeder's avatar
Will Schroeder committed
74
75

  // filter interface
76
  unsigned long int GetMTime();
Will Schroeder's avatar
Will Schroeder committed
77
78
79
  void Update();

  // alternative method to boolean data
Ken Martin's avatar
Ken Martin committed
80
  void Append(vtkStructuredPoints *);
Will Schroeder's avatar
Will Schroeder committed
81
  
Will Schroeder's avatar
Will Schroeder committed
82
83
  // Description:
  // Specify the type of boolean operation.
Ken Martin's avatar
Ken Martin committed
84
85
  vtkSetClampMacro(OperationType,int,UNION_OPERATOR,DIFFERENCE_OPERATOR);
  vtkGetMacro(OperationType,int);
Will Schroeder's avatar
Will Schroeder committed
86
87
88

  void SetSampleDimensions(int i, int j, int k);
  void SetSampleDimensions(int dim[3]);
Ken Martin's avatar
Ken Martin committed
89
  vtkGetVectorMacro(SampleDimensions,int,3);
Will Schroeder's avatar
Will Schroeder committed
90
91
92

  void SetModelBounds(float *bounds);
  void SetModelBounds(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax);
Ken Martin's avatar
Ken Martin committed
93
  vtkGetVectorMacro(ModelBounds,float,6);
Will Schroeder's avatar
Will Schroeder committed
94
95
96
97

protected:
  // Usual data generation method
  void Execute();
Will Schroeder's avatar
Will Schroeder committed
98
99
100
101
102

  // Filter interface
  int GetDataReleased();
  void SetDataReleased(int flag);

Will Schroeder's avatar
Will Schroeder committed
103
104
105
  void InitializeBoolean();

  // list of data sets to append together
Ken Martin's avatar
Ken Martin committed
106
  vtkStructuredPointsCollection InputList;
Will Schroeder's avatar
Will Schroeder committed
107
108

  // pointer to operation function
Ken Martin's avatar
Ken Martin committed
109
  //BTX
Ken Martin's avatar
Ken Martin committed
110
  void (vtkBooleanStructuredPoints::*Operator)();
Ken Martin's avatar
Ken Martin committed
111
  //ETX
Will Schroeder's avatar
Will Schroeder committed
112
113
114
115
116
117
118
119
120
121

  // boolean is performed on this resolution in this space
  int SampleDimensions[3];
  float ModelBounds[6];

  // various operations
  int OperationType;
};

#endif