35 const Mask* other_d =
dynamic_cast< const Mask*
>( &other );
38 throw BadProperty(
"Masks must have same number of dimensions." );
47 const Mask* other_d =
dynamic_cast< const Mask*
>( &other );
50 throw BadProperty(
"Masks must have same number of dimensions." );
59 const Mask* other_d =
dynamic_cast< const Mask*
>( &other );
62 throw BadProperty(
"Masks must have same number of dimensions." );
79 for (
int i = 0; i < D; ++i )
93 return (
inside( b.lower_left ) and
inside( b.upper_right ) );
106 for (
int i = 0; i < D; ++i )
108 if ( b.upper_right[ i ] < min_values_[ i ] or b.lower_left[ i ] > max_values_[ i ] )
120 return Box< D >( min_values_, max_values_ );
136 d[ get_name() ] = maskd;
151 for (
int i = 0; i < D; ++i )
153 const double di = std::abs( p[ i ] - center_[ i ] );
161 if ( dim_sum <= radius_ )
167 return ( p - center_ ).length() <= radius_;
176 for (
int i = 0; i < D; ++i )
178 if ( b.upper_right[ i ] < center_[ i ] - radius_ or b.lower_left[ i ] > center_[ i ] + radius_ )
191 for (
int i = 0; i < D; ++i )
214 d[ get_name() ] = maskd;
226 std::vector< double > radii( 3 );
227 if ( azimuth_angle_ == 0.0 and polar_angle_ == 0.0 )
229 radii[ 0 ] = major_axis_ / 2.0;
230 radii[ 1 ] = minor_axis_ / 2.0;
231 radii[ 2 ] = polar_axis_ / 2.0;
238 const double greatest_semi_axis = std::max( major_axis_, polar_axis_ ) / 2.0;
239 radii[ 0 ] = greatest_semi_axis;
240 radii[ 1 ] = greatest_semi_axis;
241 radii[ 2 ] = greatest_semi_axis;
244 for (
int i = 0; i < D; ++i )
246 bbox_.lower_left[ i ] = center_[ i ] - radii[ i ];
247 bbox_.upper_right[ i ] = center_[ i ] + radii[ i ];
260 for (
int i = 0; i < D; ++i )
296 d[ get_name() ] = maskd;
305 return mask1_->inside( p ) and mask2_->inside( p );
312 return mask1_->inside( b ) and mask2_->inside( b );
319 return mask1_->outside( b ) or mask2_->outside( b );
328 for (
int i = 0; i < D; ++i )
353 return mask1_->inside( p ) or mask2_->inside( p );
360 return mask1_->inside( b ) or mask2_->inside( b );
367 return mask1_->outside( b ) and mask2_->outside( b );
376 for (
int i = 0; i < D; ++i )
401 return mask1_->inside( p ) and not mask2_->inside( p );
408 return mask1_->inside( b ) and mask2_->outside( b );
415 return mask1_->outside( b ) or mask2_->inside( b );
422 return mask1_->get_bbox();
436 return m_->inside( -p );
443 return m_->inside(
Box< D >( -b.upper_right, -b.lower_left ) );
450 return m_->outside(
Box< D >( -b.upper_right, -b.lower_left ) );
472 return m_->inside( p - anchor_ );
479 return m_->inside(
Box< D >( b.lower_left - anchor_, b.upper_right - anchor_ ) );
486 return m_->outside(
Box< D >( b.lower_left - anchor_, b.upper_right - anchor_ ) );
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Abstract base class for masks with unspecified dimension.
Definition mask.h:51
Mask shifted by an anchor.
Definition mask.h:677
bool outside(const Box< D > &b) const
Definition mask_impl.h:484
Box< D > get_bbox() const
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:491
bool inside(const Position< D > &p) const
Definition mask_impl.h:470
Mask< D > * clone() const
Clone method.
Definition mask_impl.h:499
Dictionary get_dict() const
Definition mask_impl.h:506
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition exceptions.h:680
Mask defining a circular or spherical region.
Definition mask.h:308
Dictionary get_dict() const override
Definition mask_impl.h:208
bool outside(const Box< D > &b) const override
Definition mask_impl.h:172
bool inside(const Position< D > &p) const override
Definition mask_impl.h:146
Mask< D > * clone() const override
Clone method.
Definition mask_impl.h:201
Box< D > get_bbox() const override
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:188
Mask defining a box region.
Definition mask.h:209
bool outside(const Box< D > &b) const override
Definition mask_impl.h:98
Box< D > get_bbox() const override
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:118
bool inside(const Position< D > &p) const override
Dictionary get_dict() const override
Definition mask_impl.h:132
Mask< D > * clone() const override
Clone method.
Definition mask_impl.h:125
Mask oriented in the opposite direction.
Definition mask.h:633
Box< D > get_bbox() const
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:455
bool inside(const Position< D > &p) const
Definition mask_impl.h:434
Mask< D > * clone() const
Clone method.
Definition mask_impl.h:463
bool outside(const Box< D > &b) const
Definition mask_impl.h:448
Mask combining two masks with a minus operation, the difference.
Definition mask.h:586
Box< D > get_bbox() const
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:420
Mask< D > * clone() const
Clone method.
Definition mask_impl.h:427
bool outside(const Box< D > &b) const
Definition mask_impl.h:413
bool inside(const Position< D > &p) const
Definition mask_impl.h:399
Mask defining an elliptical or ellipsoidal region.
Definition mask.h:369
void create_bbox_()
Definition mask_impl.h:220
Mask< D > * clone() const override
Clone method.
Definition mask_impl.h:279
Dictionary get_dict() const override
Definition mask_impl.h:286
Box< D > get_bbox() const override
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:272
bool outside(const Box< D > &b) const override
Definition mask_impl.h:253
Mask combining two masks with a Boolean AND, the intersection.
Definition mask.h:491
Box< D > get_bbox() const
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:324
Mask< D > * clone() const
Clone method.
Definition mask_impl.h:344
bool outside(const Box< D > &b) const
Definition mask_impl.h:317
bool inside(const Position< D > &p) const
Definition mask_impl.h:303
Abstract base class for masks with given dimension.
Definition mask.h:101
AbstractMask * intersect_mask(const AbstractMask &other) const override
Create the intersection of this mask with another.
Definition mask_impl.h:33
virtual bool inside(const Position< D > &) const =0
virtual bool outside(const Box< D > &b) const
Definition mask_impl.h:76
AbstractMask * minus_mask(const AbstractMask &other) const override
Create the difference of this mask and another.
Definition mask_impl.h:57
AbstractMask * union_mask(const AbstractMask &other) const override
Create the union of this mask with another.
Definition mask_impl.h:45
Mask combining two masks with a Boolean OR, the sum.
Definition mask.h:540
bool inside(const Position< D > &p) const
Definition mask_impl.h:351
Box< D > get_bbox() const
The whole mask is inside (i.e., false everywhere outside) the bounding box.
Definition mask_impl.h:372
bool outside(const Box< D > &b) const
Definition mask_impl.h:365
Mask< D > * clone() const
Clone method.
Definition mask_impl.h:392
const std::string polar_axis("polar_axis")
const std::string polar_angle("polar_angle")
const std::string anchor("anchor")
const std::string azimuth_angle("azimuth_angle")
const std::string minor_axis("minor_axis")
const std::string radius("radius")
const std::string major_axis("major_axis")
const std::string lower_left("lower_left")
const std::string upper_right("upper_right")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
bool inside(const std::vector< double > &point, const MaskPTR mask)
Definition spatial.cpp:499
A box is defined by the lower left corner (minimum coordinates) and the upper right corner (maximum c...
Definition position.h:321
Position< D > lower_left
Definition position.h:331
Position< D > upper_right
Definition position.h:332