libSplash
libSplash
src
include
splash
domains
Domain.hpp
1
23
#ifndef DOMAIN_HPP
24
#define DOMAIN_HPP
25
26
#include <string>
27
#include <sstream>
28
#include <stdint.h>
29
30
#include "splash/Dimensions.hpp"
31
32
namespace
splash
33
{
34
39
class
Domain
40
{
41
public
:
42
46
Domain
() :
47
offset(0, 0, 0),
48
size(1, 1, 1)
49
{
50
51
}
52
59
Domain
(
Dimensions
offset_,
Dimensions
size_) :
60
offset(offset_),
61
size(size_)
62
{
63
64
}
65
71
uint32_t
getDims
()
const
72
{
73
return
size.
getDims
();
74
}
75
81
Dimensions
&
getSize
()
82
{
83
return
size;
84
}
85
91
const
Dimensions
getSize
()
const
92
{
93
return
size;
94
}
95
101
Dimensions
&
getOffset
()
102
{
103
return
offset;
104
}
105
111
const
Dimensions
getOffset
()
const
112
{
113
return
offset;
114
}
115
122
Dimensions
getBack
()
const
123
{
124
return
offset + size -
Dimensions
(1, 1, 1);
125
}
126
127
bool
operator==(
Domain
const
& other)
const
128
{
129
return
offset == other.
getOffset
() && size == other.
getSize
();
130
}
131
132
bool
operator!=(
Domain
const
& other)
const
133
{
134
return
!(*
this
== other);
135
}
136
142
std::string
toString
()
const
143
{
144
std::stringstream stream;
145
stream <<
"(offset: "
<< offset.
toString
() <<
", size: "
<< size.
toString
() <<
")"
;
146
return
stream.str();
147
}
148
156
static
bool
testIntersection
(
const
Domain
& d1,
const
Domain
& d2)
157
{
158
Dimensions
d1_offset = d1.
getOffset
();
159
Dimensions
d2_offset = d2.
getOffset
();
160
Dimensions
d1_end = d1.
getBack
();
161
Dimensions
d2_end = d2.
getBack
();
162
163
return
(d1_offset[0] <= d2_end[0] && d1_end[0] >= d2_offset[0] &&
164
d1_offset[1] <= d2_end[1] && d1_end[1] >= d2_offset[1] &&
165
d1_offset[2] <= d2_end[2] && d1_end[2] >= d2_offset[2]) ||
166
(d2_offset[0] <= d1_end[0] && d2_end[0] >= d1_offset[0] &&
167
d2_offset[1] <= d1_end[1] && d2_end[1] >= d1_offset[1] &&
168
d2_offset[2] <= d1_end[2] && d2_end[2] >= d1_offset[2]);
169
}
170
171
protected
:
172
Dimensions
offset;
173
Dimensions
size;
174
};
175
176
}
177
178
#endif
/* DOMAIN_HPP */
splash::Domain::toString
std::string toString() const
Definition:
Domain.hpp:142
splash::Dimensions::toString
std::string toString() const
Definition:
Dimensions.hpp:181
splash::Domain
Definition:
Domain.hpp:39
splash::Dimensions::getDims
uint32_t getDims(void) const
Definition:
Dimensions.hpp:252
splash::Domain::Domain
Domain()
Definition:
Domain.hpp:46
splash::Domain::getOffset
Dimensions & getOffset()
Definition:
Domain.hpp:101
splash::Domain::getBack
Dimensions getBack() const
Definition:
Domain.hpp:122
splash
Definition:
AttributeInfo.cpp:29
splash::Domain::getDims
uint32_t getDims() const
Definition:
Domain.hpp:71
splash::Domain::getSize
Dimensions & getSize()
Definition:
Domain.hpp:81
splash::Domain::Domain
Domain(Dimensions offset_, Dimensions size_)
Definition:
Domain.hpp:59
splash::Domain::testIntersection
static bool testIntersection(const Domain &d1, const Domain &d2)
Definition:
Domain.hpp:156
splash::Dimensions
Definition:
Dimensions.hpp:38
splash::Domain::getOffset
const Dimensions getOffset() const
Definition:
Domain.hpp:111
splash::Domain::getSize
const Dimensions getSize() const
Definition:
Domain.hpp:91
Generated by
1.8.13