OGS
MeshLib/CoordinateSystem.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6namespace GeoLib
7{
8class AABB;
9}
10
11namespace MeshLib
12{
13class Element;
14
19{
20 enum type
21 {
22 X = 0x01,
23 Y = 0x02,
24 Z = 0x04
25 };
26};
27
34{
35public:
37 explicit CoordinateSystem(unsigned char coord) : _type(coord) {}
38
40 explicit CoordinateSystem(const Element& ele);
41
43 explicit CoordinateSystem(const GeoLib::AABB& bbox);
44
46 unsigned char getType() const { return _type; }
47
49 unsigned getDimension() const
50 {
51 if (hasZ())
52 {
53 return 3;
54 }
55 if (hasY())
56 {
57 return 2;
58 }
59
60 return 1;
61 }
62
64 bool hasX() const { return (_type & CoordinateSystemType::type::X) != 0; }
65
67 bool hasY() const { return (_type & CoordinateSystemType::type::Y) != 0; }
68
70 bool hasZ() const { return (_type & CoordinateSystemType::type::Z) != 0; }
71
72private:
73 unsigned char _type;
74};
75
76} // namespace MeshLib
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:45
unsigned char getType() const
get this coordinate type
CoordinateSystem(unsigned char coord)
User provided coordinate system.
bool hasY() const
has Y dimension
unsigned getDimension() const
get dimension size
bool hasX() const
has X dimension
bool hasZ() const
has z dimension