OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vec3d.h File Reference

3D floating point vector functions. More...

+ Include dependency graph for vec3d.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Z_INDEX   2
 
#define Vec3d(variable_name)   double variable_name[3]
 
#define Vec3dArray(variable_name, size)   double variable_name[size][3]
 

Functions

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

Detailed Description

3D floating point vector functions.

Definition in file vec3d.h.

Macro Definition Documentation

#define Vec3d (   variable_name)    double variable_name[3]

Definition at line 29 of file vec3d.h.

Referenced by _geoToHex2d().

#define Vec3dArray (   variable_name,
  size 
)    double variable_name[size][3]

Definition at line 30 of file vec3d.h.

#define Z_INDEX   2

Definition at line 28 of file vec3d.h.

Referenced by _geoToVec3d(), and _pointSquareDist().

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: