OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vec3d.hpp File Reference
+ Include dependency graph for vec3d.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

EXTENSION_INLINE double _square (double x)
 
EXTENSION_NOINLINE double _pointSquareDist (const Vec3d(v1), const Vec3d(v2))
 
EXTENSION_NOINLINE bool _geoToVec3d (const GeoCoord(geo), Vec3d(v))
 

Function Documentation

EXTENSION_NOINLINE bool _geoToVec3d ( const   GeoCoordgeo,
Vec3d(v)   
)

Calculate the 3D coordinate on unit sphere from the latitude and longitude.

Parameters
geoThe latitude and longitude of the point.
vThe 3D coordinate of the point.

Definition at line 52 of file vec3d.hpp.

References LAT_INDEX, LON_INDEX, X_INDEX, Y_INDEX, and Z_INDEX.

Referenced by _geoToHex2d().

52  {
53  double r = cos(geo[LAT_INDEX]);
54 
55  v[Z_INDEX] = sin(geo[LAT_INDEX]);
56  v[X_INDEX] = cos(geo[LON_INDEX]) * r;
57  v[Y_INDEX] = sin(geo[LON_INDEX]) * r;
58 
59  return true;
60 }
#define Z_INDEX
Definition: vec3d.h:28
#define LAT_INDEX
Definition: h3api.h:92
#define X_INDEX
Definition: vec2d.h:26
#define LON_INDEX
Definition: h3api.h:93
#define Y_INDEX
Definition: vec2d.h:27

+ Here is the caller graph for this function:

EXTENSION_NOINLINE double _pointSquareDist ( const   Vec3dv1,
const   Vec3dv2 
)

Calculate the square of the distance between two 3D coordinates.

Parameters
v1The first 3D coordinate.
v2The second 3D coordinate.
Returns
The square of the distance between the given points.

Definition at line 41 of file vec3d.hpp.

References _square(), X_INDEX, Y_INDEX, and Z_INDEX.

Referenced by _geoToHex2d().

41  {
42  return _square(v1[X_INDEX] - v2[X_INDEX]) + _square(v1[Y_INDEX] - v2[Y_INDEX]) +
43  _square(v1[Z_INDEX] - v2[Z_INDEX]);
44 }
#define Z_INDEX
Definition: vec3d.h:28
#define X_INDEX
Definition: vec2d.h:26
EXTENSION_INLINE double _square(double x)
Definition: vec3d.hpp:30
#define Y_INDEX
Definition: vec2d.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

EXTENSION_INLINE double _square ( double  x)

Square of a number

Parameters
xThe input number.
Returns
The square of the input number.

Definition at line 30 of file vec3d.hpp.

Referenced by _pointSquareDist().

30  {
31  return x * x;
32 }

+ Here is the caller graph for this function: