SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Clipper.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2009 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 /*
30  * @file Clipper.h
31  * @author Michael Callahan
32  * @date September 2001
33  */
34 
35 #ifndef CORE_DATATYPES_CLIPPER_H
36 #define CORE_DATATYPES_CLIPPER_H 1
37 
38 #include <Core/Containers/LockingHandle.h>
40 #include <Core/Datatypes/Mesh.h>
41 #include <Core/Datatypes/VMesh.h>
42 #include <Core/Geometry/Transform.h>
43 #include <Core/Containers/LockingHandle.h>
44 
45 #include <Core/Datatypes/share.h>
46 
47 namespace SCIRun {
48 
49 class SCISHARE Clipper : public Datatype
50 {
51 public:
52  virtual ~Clipper();
53 
54  virtual bool inside_p(const Point &p);
55  virtual bool mesh_p() { return false; }
56 
58  virtual std::string dynamic_type_name() const { return type_id.type; }
59  void io(Piostream &stream);
60 };
61 
62 
63 typedef LockingHandle<Clipper> ClipperHandle;
64 
65 
66 
68 {
69 private:
70  ClipperHandle clipper0_;
71  ClipperHandle clipper1_;
72 
73 public:
75 
76  virtual bool inside_p(const Point &p);
77 
79  virtual std::string dynamic_type_name() const { return type_id.type; }
80  void io(Piostream &stream);
81 };
82 
83 
85 {
86 private:
87  ClipperHandle clipper0_;
88  ClipperHandle clipper1_;
89 
90 public:
92 
93  virtual bool inside_p(const Point &p);
94 
96  virtual std::string dynamic_type_name() const { return type_id.type; }
97  void io(Piostream &stream);
98 };
99 
100 
102 {
103 private:
104  ClipperHandle clipper_;
105 
106 public:
107  InvertClipper(ClipperHandle clipper);
108 
109  virtual bool inside_p(const Point &p);
110 
112  virtual std::string dynamic_type_name() const { return type_id.type; }
113  void io(Piostream &stream);
114 };
115 
116 
118 {
119 private:
120  Transform trans_;
121 
122 public:
123  BoxClipper(Transform &t);
124 
125  virtual bool inside_p(const Point &p);
126 
128  virtual std::string dynamic_type_name() const { return type_id.type; }
129  void io(Piostream &stream);
130 };
131 
132 
133 class MeshClipper : public Clipper
134 {
135 private:
136  VMesh* mesh_;
137 
138 public:
139  MeshClipper(VMesh* mesh) : mesh_(mesh) {
141  }
142 
143  virtual bool inside_p(const Point &p)
144  {
146  return mesh_->locate(idx, p);
147  }
148  virtual bool mesh_p() { return true; }
149 
150  void io(Piostream&) {}
151 };
152 
153 
154 
155 } // end namespace SCIRun
156 
157 #endif // Clipper_h
158 
159 
Definition: Clipper.h:133
static PersistentTypeID type_id
Definition: Clipper.h:127
Definition: Mesh.h:85
Distinct type for elem index.
Definition: FieldVIndex.h:228
static PersistentTypeID type_id
Definition: Clipper.h:111
void io(Piostream &)
Definition: Clipper.h:150
Definition: Persistent.h:89
FieldHandle mesh()
Definition: BuildTDCSMatrixTests.cc:56
virtual bool locate(VMesh::Node::index_type &i, const Core::Geometry::Point &point) const
Definition: VMesh.cc:509
Definition: Point.h:49
#define SCISHARE
Definition: share.h:39
virtual bool mesh_p()
Definition: Clipper.h:55
static PersistentTypeID type_id
Definition: Clipper.h:57
LockingHandle< Clipper > ClipperHandle
Definition: Clipper.h:63
virtual std::string dynamic_type_name() const
Definition: Clipper.h:79
virtual std::string dynamic_type_name() const
Definition: Clipper.h:128
virtual std::string dynamic_type_name() const
Definition: Clipper.h:96
Definition: Transform.h:53
Definition: Clipper.h:117
Definition: Datatype.h:56
Definition: Clipper.h:49
Definition: Clipper.h:84
virtual std::string dynamic_type_name() const
Definition: Clipper.h:58
virtual bool inside_p(const Point &p)
Definition: Clipper.h:143
Definition: Persistent.h:64
static PersistentTypeID type_id
Definition: Clipper.h:78
static PersistentTypeID type_id
Definition: Clipper.h:95
Definition: Clipper.h:101
MeshClipper(VMesh *mesh)
Definition: Clipper.h:139
Definition: VMesh.h:53
virtual bool synchronize(unsigned int sync)
This call is for synchronizing tables of precomputed elements.
Definition: VMesh.cc:815
Definition: Clipper.h:67
virtual bool mesh_p()
Definition: Clipper.h:148
virtual std::string dynamic_type_name() const
Definition: Clipper.h:112