OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
coordijk.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016-2018 Uber Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
30 #ifndef COORDIJK_H
31 #define COORDIJK_H
32 
33 // #include "geoCoord.h"
36 
42 #define I_INDEX 0
43 #define J_INDEX 1
44 #define K_INDEX 2
45 #define CoordIJK(variable_name) int variable_name[3]
46 #define CoordIJK_ptr(variable_name) int* variable_name
47 #define CoordIJK_clone(ijk) \
48  { ijk[I_INDEX], ijk[J_INDEX], ijk[K_INDEX] }
49 #define CoordIJK_copy(dest_ijk, src_ijk) \
50  dest_ijk[I_INDEX] = src_ijk[I_INDEX]; \
51  dest_ijk[J_INDEX] = src_ijk[J_INDEX]; \
52  dest_ijk[K_INDEX] = src_ijk[K_INDEX];
53 #define CoordIJKArray(variable_name, size) int variable_name[size][3]
54 // typedef struct {
55 // int i; ///< i component
56 // int j; ///< j component
57 // int k; ///< k component
58 // } CoordIJK;
59 
62 DEVICE static const CoordIJKArray(UNIT_VECS, 7) = {
63  {0, 0, 0}, // direction 0
64  {0, 0, 1}, // direction 1
65  {0, 1, 0}, // direction 2
66  {0, 1, 1}, // direction 3
67  {1, 0, 0}, // direction 4
68  {1, 0, 1}, // direction 5
69  {1, 1, 0} // direction 6
70 };
71 
75 typedef enum {
95 } Direction;
96 
97 // Internal functions
98 
99 EXTENSION_INLINE bool _setIJK(CoordIJK(ijk), int i, int j, int k);
101 EXTENSION_INLINE bool _ijkToHex2d(const CoordIJK(h), Vec2d(v));
102 EXTENSION_INLINE int _ijkMatches(const CoordIJK(c1), const CoordIJK(c2));
103 EXTENSION_INLINE bool _ijkAdd(const CoordIJK(h1), const CoordIJK(h2), CoordIJK(sum));
104 EXTENSION_INLINE bool _ijkSub(const CoordIJK(h1), const CoordIJK(h2), CoordIJK(diff));
105 EXTENSION_INLINE bool _ijkScale(CoordIJK(c), int factor);
112 // void _downAp3(CoordIJK* ijk);
113 // void _downAp3r(CoordIJK* ijk);
114 EXTENSION_NOINLINE bool _neighbor(CoordIJK(ijk), int digit);
117 EXTENSION_NOINLINE int _rotate60ccw(int digit);
118 EXTENSION_NOINLINE int _rotate60cw(int digit);
119 // int ijkDistance(const CoordIJK* a, const CoordIJK* b);
120 // void ijkToIj(const CoordIJK* ijk, CoordIJ* ij);
121 // void ijToIjk(const CoordIJ* ij, CoordIJK* ijk);
122 // void ijkToCube(CoordIJK* ijk);
123 // void cubeToIjk(CoordIJK* ijk);
124 
126 
127 #endif
EXTENSION_NOINLINE int _unitIjkToDigit(const CoordIJK(ijk))
Definition: coordijk.hpp:266
#define EXTENSION_NOINLINE
Definition: heavydbTypes.h:58
2D floating point vector functions.
EXTENSION_INLINE bool _ijkSub(const CoordIJK(h1), const CoordIJK(h2), CoordIJK(diff))
Definition: coordijk.hpp:198
EXTENSION_NOINLINE bool _neighbor(CoordIJK(ijk), int digit)
Definition: coordijk.hpp:372
EXTENSION_NOINLINE bool _ijkRotate60ccw(CoordIJK(ijk))
Definition: coordijk.hpp:385
EXTENSION_INLINE int _ijkMatches(const CoordIJK(c1), const CoordIJK(c2))
Definition: coordijk.hpp:172
EXTENSION_NOINLINE bool _downAp7r(CoordIJK(ijk))
Definition: coordijk.hpp:348
EXTENSION_NOINLINE bool _ijkRotate60cw(CoordIJK(ijk))
Definition: coordijk.hpp:407
EXTENSION_INLINE bool _ijkScale(CoordIJK(c), int factor)
Definition: coordijk.hpp:211
EXTENSION_NOINLINE bool _hex2dToCoordIJK(const Vec2d(v), CoordIJK(h))
Definition: coordijk.hpp:54
#define DEVICE
EXTENSION_NOINLINE int _rotate60ccw(int digit)
Definition: coordijk.hpp:429
#define CoordIJKArray(variable_name, size)
Definition: coordijk.h:53
#define EXTENSION_INLINE
Definition: heavydbTypes.h:57
#define Vec2d(variable_name)
Definition: vec2d.h:28
EXTENSION_INLINE bool _ijkAdd(const CoordIJK(h1), const CoordIJK(h2), CoordIJK(sum))
Definition: coordijk.hpp:184
EXTENSION_INLINE bool _ijkToHex2d(const CoordIJK(h), Vec2d(v))
Definition: coordijk.hpp:155
Direction
H3 digit representing ijk+ axes direction. Values will be within the lowest 3 bits of an integer...
Definition: coordijk.h:75
EXTENSION_NOINLINE int _rotate60cw(int digit)
Definition: coordijk.hpp:453
#define CoordIJK(variable_name)
Definition: coordijk.h:45
Primary H3 core library entry points.
EXTENSION_NOINLINE bool _downAp7(CoordIJK(ijk))
Definition: coordijk.hpp:325
EXTENSION_NOINLINE bool _upAp7(CoordIJK(ijk))
Definition: coordijk.hpp:287
EXTENSION_NOINLINE bool _upAp7r(CoordIJK(ijk))
Definition: coordijk.hpp:306
EXTENSION_INLINE bool _setIJK(CoordIJK(ijk), int i, int j, int k)
Definition: coordijk.hpp:40
EXTENSION_NOINLINE bool _ijkNormalize(CoordIJK(c))
Definition: coordijk.hpp:224