Mir
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 
20 #include "displacement_generic.h"
21 #include "dimensions.h"
22 #include "point.h"
23 #include "size.h"
24 
25 namespace mir
26 {
27 namespace geometry
28 {
29 struct Displacement : generic::Displacement<detail::IntWrapper>
30 {
31  using PointType = Point;
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: 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

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue May 24 14:35:34 UTC 2022
This documentation is licensed under the GPL version 2 or 3.