Mir
Loading...
Searching...
No Matches
displacement.h
Go to the documentation of this file.
1/*
2 * Copyright © 2012, 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 2 or 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef MIR_GEOMETRY_DISPLACEMENT_H_
18#define MIR_GEOMETRY_DISPLACEMENT_H_
19
21#include "dimensions.h"
22#include "point.h"
23#include "size.h"
24
25namespace mir
26{
27namespace geometry
28{
29struct Displacement : generic::Displacement<detail::IntWrapper>
30{
32 using SizeType = Size;
33
35
36 long long length_squared() const
37 {
38 long long x = dx.as_int(), y = dy.as_int();
39 return x * x + y * y;
40 }
41};
42}
43}
44
45#endif /* MIR_GEOMETRY_DISPLACEMENT_H_ */
Definition: dimensions.h:34
Definition: splash_session.h:22
Definition: displacement.h:30
long long length_squared() const
Definition: displacement.h:36
Definition: point.h:30
Definition: size.h:30
Definition: displacement_generic.h:43
detail::IntWrapper< DeltaXTag > dx
Definition: displacement_generic.h:64
detail::IntWrapper< DeltaYTag > dy
Definition: displacement_generic.h:65
constexpr Displacement()
Definition: displacement_generic.h:50

Copyright © 2012-2023 Canonical Ltd.
Generated on Tue Jan 24 16:42:22 UTC 2023
This documentation is licensed under the GPL version 2 or 3.