msl 1.3.0
Loading...
Searching...
No Matches
Mask.h
Go to the documentation of this file.
1// Copyright 2024-2026 Julien Lamy, ICube, Université de Strasbourg-CNRS.
2// Part of msl, distributed under the terms of the MIT license.
3
4#ifndef _a4690364_ec62_4b06_aebc_5b4dc3f92f29
5#define _a4690364_ec62_4b06_aebc_5b4dc3f92f29
6
7#include <ostream>
8
9#include "msl/MaskBase.h"
10
11namespace msl
12{
13
15class Mask: public MaskBase<bool>
16{
17public:
19 Mask(Shape const & shape={}, bool value=true);
20 Mask(Mask const &) = default;
21 Mask(Mask &&) = default;
22 Mask & operator=(Mask const &) = default;
23 Mask & operator=(Mask &&) = default;
24 ~Mask() override = default;
25
27 std::size_t count() const;
28
30 Mask & enable(Point const & p);
31
33 Mask & disable(Point const & p);
34
36 bool enabled(Point const & p) const;
37
40
42 Mask & operator|=(Mask const & right);
43
45 Mask & operator&=(Mask const & right);
46
49};
50
52std::ostream & operator<<(std::ostream & stream, Mask const & mask);
53
56
58Mask operator&(Mask left, Mask const & right);
59
61Mask operator|(Mask left, Mask const & right);
62
63}
64
65#endif // _a4690364_ec62_4b06_aebc_5b4dc3f92f29
Shape const & shape() const
std::vector< Point > Points
Definition MaskBase.h:25
MaskBase(Shape const &shape={}, bool value=bool())
Vector2l Point
Definition MaskBase.h:20
Vector2l Shape
Definition MaskBase.h:22
A two dimensional binary mask.
Definition Mask.h:16
Mask & operator|=(Mask const &right)
In-place union of two masks.
Mask & enable(Point const &p)
Enable a point.
Mask(Shape const &shape={}, bool value=true)
Create a constant mask.
Mask & disable(Point const &p)
Disable a point.
Mask & operator&=(Mask const &right)
In-place intersection of two masks.
Mask & flip()
Switch the status of all points (enabled ↔ disabled).
Points enabledPoints() const
Return a vector of enabled points.
std::size_t count() const
Return the number of enabled points.
bool enabled(Point const &p) const
Check whether the point is enabled.
Top-level namespace of the msl library.
Definition acceleration.h:17
Mask operator&(Mask left, Mask const &right)
Intersection of two masks.
Mask operator!(Mask mask)
Retrun a switched mask (enabled ↔ disabled).
std::ostream & operator<<(std::ostream &stream, iPATMask const &mask)
Visual representation of the mask.
Mask operator|(Mask left, Mask const &right)
Union of two masks.