Go to the documentation of this file.
18 #include "ad/physics/Distance.hpp"
19 #include "ad/physics/ParametricValue.hpp"
20 #include "ad/physics/RatioValue.hpp"
37 template <
typename Po
intType> PointType
vectorCrossProduct(PointType
const &a, PointType
const &b)
40 result.x = a.y * b.z - a.z * b.y;
41 result.y = a.z * b.x - a.x * b.z;
42 result.z = a.x * b.y - a.y * b.x;
54 template <
typename Po
intType>
double vectorDotProduct(PointType
const &a, PointType
const &b)
56 return static_cast<double>(a.x) *
static_cast<double>(b.x) +
static_cast<double>(a.y) *
static_cast<double>(b.y)
57 +
static_cast<double>(a.z) *
static_cast<double>(b.z);
79 template <
typename Po
intType> PointType
vectorMultiplyScalar(PointType
const &a, physics::Distance
const &b)
91 template <
typename Po
intType> physics::Distance
vectorLength(PointType
const &a)
93 physics::Distance
const length(std::sqrt(
static_cast<double>(
vectorDotProduct(a, a))));
104 template <
typename Po
intType> PointType
vectorNorm(PointType
const &a)
107 if (length > physics::Distance(0.))
110 result.x = a.x / length;
111 result.y = a.y / length;
112 result.z = a.z / length;
126 template <
typename Po
intType> PointType
vectorAdd(PointType
const &a, PointType
const &b)
129 result.x = a.x + b.x;
130 result.y = a.y + b.y;
131 result.z = a.z + b.z;
143 template <
typename Po
intType> PointType
vectorSub(PointType
const &a, PointType
const &b)
146 result.x = a.x - b.x;
147 result.y = a.y - b.y;
148 result.z = a.z - b.z;
163 template <
typename Po
intType>
164 PointType
vectorInterpolate(PointType
const &a, PointType
const &b, physics::ParametricValue
const &tparam)
180 template <
typename Po
intType> PointType
vectorExtrapolate(PointType
const &a, PointType
const &b,
double const &scalar)
183 result.x = (1 - scalar) * a.x + scalar * b.x;
184 result.y = (1 - scalar) * a.y + scalar * b.y;
185 result.z = (1 - scalar) * a.z + scalar * b.z;
namespace ad
Definition: GeometryStoreItem.hpp:28
double vectorDotProduct(PointType const &a, PointType const &b)
calculate the dot product of two vectors
Definition: PointOperation.hpp:54
PointType vectorAdd(PointType const &a, PointType const &b)
add two vectors
Definition: PointOperation.hpp:126
GeoPoint vectorExtrapolate(GeoPoint const &a, GeoPoint const &b, double const &scalar)
specialization of vectorExtrapolate for GeoPoint
Definition: GeoOperation.hpp:165
PointType vectorSub(PointType const &a, PointType const &b)
subtract two vectors from each right
Definition: PointOperation.hpp:143
PointType vectorInterpolate(PointType const &a, PointType const &b, physics::ParametricValue const &tparam)
Interpolates point between two points.
Definition: PointOperation.hpp:164
PointType vectorMultiplyScalar(PointType const &a, double const &b)
multiplies a vector with a scalar
Definition: PointOperation.hpp:65
physics::Distance vectorLength(PointType const &a)
calculate the length of a vector
Definition: PointOperation.hpp:91
PointType vectorCrossProduct(PointType const &a, PointType const &b)
calculate the cross product of two vectors
Definition: PointOperation.hpp:37
PointType vectorNorm(PointType const &a)
normalizes a vector
Definition: PointOperation.hpp:104