Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Direction.hpp
Go to the documentation of this file.
1 // Copyright © 2020-2024 Alexandre Coderre-Chabot
2 //
3 // This file is part of Physical Quantities (PhQ), a C++ library of physical quantities, physical
4 // models, and units of measure for scientific computing.
5 //
6 // Physical Quantities is hosted at:
7 // https://github.com/acodcha/phq
8 //
9 // Physical Quantities is licensed under the MIT License:
10 // https://mit-license.org
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
13 // associated documentation files (the "Software"), to deal in the Software without restriction,
14 // including without limitation the rights to use, copy, modify, merge, publish, distribute,
15 // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
16 // furnished to do so, subject to the following conditions:
17 // - The above copyright notice and this permission notice shall be included in all copies or
18 // substantial portions of the Software.
19 // - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
20 // BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 
25 #ifndef PHQ_DIRECTION_HPP
26 #define PHQ_DIRECTION_HPP
27 
28 #include <array>
29 #include <cmath>
30 #include <cstddef>
31 #include <functional>
32 #include <ostream>
33 
34 #include "Angle.hpp"
35 #include "DimensionlessVector.hpp"
36 #include "Dyad.hpp"
37 #include "PlanarDirection.hpp"
38 #include "SymmetricDyad.hpp"
39 #include "Vector.hpp"
40 
41 namespace PhQ {
42 
43 // Forward declaration for class PhQ::Direction.
44 template <typename NumericType>
45 class Acceleration;
46 
47 // Forward declaration for class PhQ::Direction.
48 template <typename NumericType>
49 class Area;
50 
51 // Forward declaration for class PhQ::Direction.
52 template <typename NumericType>
53 class Displacement;
54 
55 // Forward declaration for class PhQ::Direction.
56 template <typename NumericType>
57 class Force;
58 
59 // Forward declaration for class PhQ::Direction.
60 template <typename NumericType>
61 class HeatFlux;
62 
63 // Forward declaration for class PhQ::Direction.
64 template <typename NumericType>
65 class Length;
66 
67 // Forward declaration for class PhQ::Direction.
68 template <typename NumericType>
69 class Position;
70 
71 // Forward declaration for class PhQ::Direction.
72 template <typename NumericType>
73 class ScalarAcceleration;
74 
75 // Forward declaration for class PhQ::Direction.
76 template <typename NumericType>
77 class ScalarForce;
78 
79 // Forward declaration for class PhQ::Direction.
80 template <typename NumericType>
81 class ScalarHeatFlux;
82 
83 // Forward declaration for class PhQ::Direction.
84 template <typename NumericType>
86 
87 // Forward declaration for class PhQ::Direction.
88 template <typename NumericType>
89 class ScalarTraction;
90 
91 // Forward declaration for class PhQ::Direction.
92 template <typename NumericType>
93 class Speed;
94 
95 // Forward declaration for class PhQ::Direction.
96 template <typename NumericType>
98 
99 // Forward declaration for class PhQ::Direction.
100 template <typename NumericType>
101 class Traction;
102 
103 // Forward declaration for class PhQ::Direction.
104 template <typename NumericType>
105 class VectorArea;
106 
107 // Forward declaration for class PhQ::Direction.
108 template <typename NumericType>
109 class Velocity;
110 
111 /// \brief Three-dimensional Euclidean direction vector. Contains three components in Cartesian
112 /// coordinates: x, y, and z. Guaranteed to be either a unit vector or the zero vector (0, 0, 0).
113 /// For a two-dimensional Euclidean direction vector in the XY plane, see PhQ::PlanarDirection.
114 template <typename NumericType = double>
115 class Direction : public DimensionlessVector<NumericType> {
116 public:
117  /// \brief Default constructor. Initializes a direction to the zero vector.
118  constexpr Direction() : DimensionlessVector<NumericType>(Vector<NumericType>::Zero()) {}
119 
120  /// \brief Constructor. Constructs a direction by normalizing the given x, y, and z Cartesian
121  /// components to a unit vector. If x = 0, y = 0, and z = 0, initializes the direction to the zero
122  /// vector.
123  Direction(const NumericType x, const NumericType y, const NumericType z)
124  : DimensionlessVector<NumericType>() {
125  Set(x, y, z);
126  }
127 
128  /// \brief Constructor. Constructs a direction by normalizing a given array representing x, y, and
129  /// z Cartesian components to a unit vector. If x = 0, y = 0, and z = 0, initializes the direction
130  /// to the zero vector.
131  explicit Direction(const std::array<NumericType, 3>& x_y_z) : DimensionlessVector<NumericType>() {
132  Set(x_y_z);
133  }
134 
135  /// \brief Constructor. Constructs a direction by normalizing the given vector to a unit vector.
136  /// If the given vector is the zero vector, initializes the direction to the zero vector.
137  explicit Direction(const Vector<NumericType>& value) : DimensionlessVector<NumericType>() {
138  Set(value);
139  }
140 
141  /// \brief Constructor. Constructs a direction from a given planar direction in the XY plane. This
142  /// direction's z-component is initialized to zero.
143  explicit constexpr Direction(const PlanarDirection<NumericType>& planar_direction)
144  : Direction<NumericType>(Vector<NumericType>{planar_direction.Value()}) {}
145 
146  /// \brief Constructor. Constructs a direction from an acceleration.
147  explicit Direction(const Acceleration<NumericType>& acceleration);
148 
149  /// \brief Constructor. Constructs a direction from a displacement.
150  explicit Direction(const Displacement<NumericType>& displacement);
151 
152  /// \brief Constructor. Constructs a direction from a force.
153  explicit Direction(const Force<NumericType>& force);
154 
155  /// \brief Constructor. Constructs a direction from a heat flux.
156  explicit Direction(const HeatFlux<NumericType>& heat_flux);
157 
158  /// \brief Constructor. Constructs a direction from a position.
159  explicit Direction(const Position<NumericType>& position);
160 
161  /// \brief Constructor. Constructs a direction from a temperature gradient.
162  explicit Direction(const TemperatureGradient<NumericType>& temperature_gradient);
163 
164  /// \brief Constructor. Constructs a direction from a traction.
165  explicit Direction(const Traction<NumericType>& traction);
166 
167  /// \brief Constructor. Constructs a direction from a vector area.
168  explicit Direction(const VectorArea<NumericType>& vector_area);
169 
170  /// \brief Constructor. Constructs a direction from a velocity.
171  explicit Direction(const Velocity<NumericType>& velocity);
172 
173  /// \brief Destructor. Destroys this direction.
174  ~Direction() noexcept = default;
175 
176  /// \brief Copy constructor. Constructs a direction by copying another one.
177  constexpr Direction(const Direction<NumericType>& other) = default;
178 
179  /// \brief Copy constructor. Constructs a direction by copying another one.
180  template <typename OtherNumericType>
181  explicit constexpr Direction(const Direction<OtherNumericType>& other)
182  : Direction(static_cast<Vector<NumericType>>(other.Value())) {}
183 
184  /// \brief Move constructor. Constructs a direction by moving another one.
185  constexpr Direction(Direction<NumericType>&& other) noexcept = default;
186 
187  /// \brief Copy assignment operator. Assigns this direction by copying another one.
188  constexpr Direction<NumericType>& operator=(const Direction<NumericType>& other) = default;
189 
190  /// \brief Copy assignment operator. Assigns this direction by copying another one.
191  template <typename OtherNumericType>
193  this->value = static_cast<Vector<NumericType>>(other.Value());
194  return *this;
195  }
196 
197  /// \brief Move assignment operator. Assigns the value of this direction by moving another one.
198  constexpr Direction<NumericType>& operator=(Direction<NumericType>&& other) noexcept = default;
199 
200  /// \brief Statically creates a direction whose value is the zero vector.
201  [[nodiscard]] static constexpr Direction<NumericType> Zero() {
202  return Direction<NumericType>{};
203  }
204 
205  /// \brief Returns the x Cartesian component of this direction.
206  [[nodiscard]] constexpr NumericType x() const noexcept {
207  return this->value.x();
208  }
209 
210  /// \brief Returns the y Cartesian component of this direction.
211  [[nodiscard]] constexpr NumericType y() const noexcept {
212  return this->value.y();
213  }
214 
215  /// \brief Returns the z Cartesian component of this direction.
216  [[nodiscard]] constexpr NumericType z() const noexcept {
217  return this->value.z();
218  }
219 
220  /// \brief Sets the value of this direction by normalizing the given x, y, and z Cartesian
221  /// components to a unit vector. If x = 0, y = 0, and z = 0, sets the direction to the zero
222  /// vector.
223  constexpr void Set(const NumericType x, const NumericType y, const NumericType z) {
224  const NumericType magnitude_squared{x * x + y * y + z * z};
225  if (magnitude_squared > static_cast<NumericType>(0)) {
226  const NumericType magnitude{std::sqrt(magnitude_squared)};
227  this->value = Vector{x / magnitude, y / magnitude, z / magnitude};
228  } else {
229  this->value = Vector<>::Zero();
230  }
231  }
232 
233  /// \brief Sets the value of this direction by normalizing the given x, y, and z Cartesian
234  /// components to a unit vector. If x = 0, y = 0, and z = 0, sets the direction to the zero
235  /// vector.
236  constexpr void Set(const std::array<NumericType, 3>& x_y_z) {
237  const NumericType magnitude_squared{
238  x_y_z[0] * x_y_z[0] + x_y_z[1] * x_y_z[1] + x_y_z[2] * x_y_z[2]};
239  if (magnitude_squared > static_cast<NumericType>(0)) {
240  const NumericType magnitude{std::sqrt(magnitude_squared)};
241  this->value = Vector{x_y_z[0] / magnitude, x_y_z[1] / magnitude, x_y_z[2] / magnitude};
242  } else {
243  this->value = Vector<>::Zero();
244  }
245  }
246 
247  /// \brief Sets the value of this direction by normalizing the given vector to a unit vector. If
248  /// the given vector is a zero vector, sets the direction to the zero vector.
249  constexpr void Set(const Vector<NumericType>& value) {
250  Set(value.x_y_z());
251  }
252 
253  /// \brief Returns the square of the magnitude of this direction. This is guaranteed to be exactly
254  /// 1 if the direction is not the zero vector, or 0 if the direction is the zero vector.
255  [[nodiscard]] constexpr NumericType MagnitudeSquared() const noexcept {
256  return this->value.MagnitudeSquared();
257  }
258 
259  /// \brief Returns the magnitude of this direction. This is guaranteed to be exactly 1 if the
260  /// direction is not the zero vector, or 0 if the direction is the zero vector.
261  [[nodiscard]] NumericType Magnitude() const noexcept {
262  return this->value.Magnitude();
263  }
264 
265  /// \brief Returns the dot product (also known as the scalar product or the inner product) of this
266  /// direction with the given vector.
267  [[nodiscard]] constexpr NumericType Dot(const Vector<NumericType>& vector) const noexcept {
268  return this->value.Dot(vector);
269  }
270 
271  /// \brief Returns the dot product (also known as the scalar product or the inner product) of this
272  /// direction with the given other direction.
273  [[nodiscard]] constexpr NumericType Dot(const Direction<NumericType>& direction) const noexcept {
274  return this->value.Dot(direction.value);
275  }
276 
277  /// \brief Returns the cross product of this direction with the given vector.
278  [[nodiscard]] constexpr Vector<NumericType> Cross(const Vector<NumericType>& vector) const {
279  return this->value.Cross(vector);
280  }
281 
282  /// \brief Returns the cross product of this direction with the given other direction.
283  [[nodiscard]] Direction<NumericType> Cross(const Direction<NumericType>& direction) const {
284  return Direction<NumericType>{this->value.Cross(direction.value)};
285  }
286 
287  /// \brief Returns the dyadic product of this direction with the given vector.
288  [[nodiscard]] constexpr Dyad<NumericType> Dyadic(const Vector<NumericType>& vector) const {
289  return this->value.Dyadic(vector);
290  }
291 
292  /// \brief Returns the dyadic product of this direction with the given other direction.
293  [[nodiscard]] constexpr Dyad<NumericType> Dyadic(const Direction<NumericType>& direction) const {
294  return this->value.Dyadic(direction.value);
295  }
296 
297  /// \brief Returns the angle between this direction and the given vector.
298  [[nodiscard]] PhQ::Angle<NumericType> Angle(const Vector<NumericType>& vector) const {
299  return PhQ::Angle<NumericType>{*this, vector};
300  }
301 
302  /// \brief Returns the angle between this direction and the given other direction.
303  [[nodiscard]] PhQ::Angle<NumericType> Angle(const Direction<NumericType>& direction) const {
304  return PhQ::Angle<NumericType>{*this, direction};
305  }
306 
308  const ScalarAcceleration<NumericType>& scalar_acceleration) const;
309 
310  constexpr VectorArea<NumericType> operator*(const Area<NumericType>& area) const;
311 
312  constexpr Position<NumericType> operator*(const Length<NumericType>& length) const;
313 
314  constexpr Force<NumericType> operator*(const ScalarForce<NumericType>& scalar_force) const;
315 
317  const ScalarHeatFlux<NumericType>& scalar_heat_flux) const;
318 
320  const ScalarTemperatureGradient<NumericType>& scalar_temperature_gradient) const;
321 
323  const ScalarTraction<NumericType>& scalar_traction) const;
324 
325  constexpr Velocity<NumericType> operator*(const Speed<NumericType>& speed) const;
326 };
327 
328 template <typename NumericType>
329 inline constexpr bool operator==(
330  const Direction<NumericType>& left, const Direction<NumericType>& right) noexcept {
331  return left.Value() == right.Value();
332 }
333 
334 template <typename NumericType>
335 inline constexpr bool operator!=(
336  const Direction<NumericType>& left, const Direction<NumericType>& right) noexcept {
337  return left.Value() != right.Value();
338 }
339 
340 template <typename NumericType>
341 inline constexpr bool operator<(
342  const Direction<NumericType>& left, const Direction<NumericType>& right) noexcept {
343  return left.Value() < right.Value();
344 }
345 
346 template <typename NumericType>
347 inline constexpr bool operator>(
348  const Direction<NumericType>& left, const Direction<NumericType>& right) noexcept {
349  return left.Value() > right.Value();
350 }
351 
352 template <typename NumericType>
353 inline constexpr bool operator<=(
354  const Direction<NumericType>& left, const Direction<NumericType>& right) noexcept {
355  return left.Value() <= right.Value();
356 }
357 
358 template <typename NumericType>
359 inline constexpr bool operator>=(
360  const Direction<NumericType>& left, const Direction<NumericType>& right) noexcept {
361  return left.Value() >= right.Value();
362 }
363 
364 template <typename NumericType>
365 inline std::ostream& operator<<(
366  std::ostream& stream, const PhQ::Direction<NumericType>& direction) {
367  stream << direction.Print();
368  return stream;
369 }
370 
371 template <typename NumericType>
373  const NumericType magnitude, const PhQ::Direction<NumericType>& direction)
374  : x_y_z_(std::array<NumericType, 3>{(direction.Value() * magnitude).x_y_z_}) {}
375 
376 template <typename NumericType>
378  return PhQ::Direction<NumericType>{*this};
379 }
380 
381 template <typename NumericType>
382 inline constexpr NumericType Vector<NumericType>::Dot(
383  const PhQ::Direction<NumericType>& direction) const noexcept {
384  return Dot(direction.Value());
385 }
386 
387 template <typename NumericType>
389  const PhQ::Direction<NumericType>& direction) const {
390  return Cross(direction.Value());
391 }
392 
393 template <typename NumericType>
395  const PhQ::Direction<NumericType>& direction) const {
396  return Dyadic(direction.Value());
397 }
398 
399 template <typename NumericType>
401  const SymmetricDyad<NumericType>& symmetric_dyad, const Direction<NumericType>& direction) {
402  return symmetric_dyad * direction.Value();
403 }
404 
405 template <typename NumericType>
407  const Dyad<NumericType>& dyad, const Direction<NumericType>& direction) {
408  return dyad * direction.Value();
409 }
410 
411 template <typename NumericType>
413  const PhQ::Direction<NumericType>& direction) const {
414  return PhQ::Angle<NumericType>{*this, direction};
415 }
416 
417 template <typename NumericType>
419  const Vector<NumericType>& vector, const Direction<NumericType>& direction)
420  : Angle(std::acos(vector.Dot(direction) / vector.Magnitude())) {}
421 
422 template <typename NumericType>
424  const Direction<NumericType>& direction, const Vector<NumericType>& vector)
425  : Angle(std::acos(direction.Dot(vector) / vector.Magnitude())) {}
426 
427 template <typename NumericType>
429  const Direction<NumericType>& direction1, const Direction<NumericType>& direction2)
430  : Angle(std::acos(direction1.Dot(direction2))) {}
431 
432 template <typename NumericType>
434  const Direction<NumericType>& direction)
435  : PlanarDirection(PlanarVector<NumericType>{direction.Value()}) {}
436 
437 template <typename NumericType>
439  const PlanarDirection<NumericType>& planar_direction) const {
440  return Direction<NumericType>{this->value.Cross(planar_direction.value)};
441 }
442 
443 } // namespace PhQ
444 
445 namespace std {
446 
447 template <typename NumericType>
448 struct hash<PhQ::Direction<NumericType>> {
449  inline size_t operator()(const PhQ::Direction<NumericType>& direction) const {
450  return hash<PhQ::Vector<NumericType>>()(direction.Value());
451  }
452 };
453 
454 } // namespace std
455 
456 #endif // PHQ_DIRECTION_HPP
Three-dimensional Euclidean acceleration vector. Contains three components in Cartesian coordinates: ...
Plane angle between two lines or dihedral angle between two planes.
Definition: Angle.hpp:130
Angle()=default
Default constructor. Constructs an angle with an uninitialized value.
Surface area or cross-sectional area. Can also represent a scalar component of a vector area or the m...
Definition: Area.hpp:71
PhQ::PlanarVector< NumericType > value
Value of this physical quantity.
constexpr const PhQ::PlanarVector< NumericType > & Value() const noexcept
Value of this physical quantity.
Abstract base class that represents any dimensionless vector physical quantity. Such a physical quant...
std::string Print() const
Prints this physical quantity as a string.
PhQ::Vector< double > value
Value of this physical quantity.
constexpr const PhQ::Vector< double > & Value() const noexcept
Value of this physical quantity.
Three-dimensional Euclidean direction vector. Contains three components in Cartesian coordinates: x,...
Definition: Direction.hpp:115
constexpr Direction(const PlanarDirection< NumericType > &planar_direction)
Constructor. Constructs a direction from a given planar direction in the XY plane....
Definition: Direction.hpp:143
constexpr NumericType y() const noexcept
Returns the y Cartesian component of this direction.
Definition: Direction.hpp:211
constexpr Dyad< NumericType > Dyadic(const Direction< NumericType > &direction) const
Returns the dyadic product of this direction with the given other direction.
Definition: Direction.hpp:293
~Direction() noexcept=default
Destructor. Destroys this direction.
constexpr NumericType z() const noexcept
Returns the z Cartesian component of this direction.
Definition: Direction.hpp:216
Direction(const std::array< NumericType, 3 > &x_y_z)
Constructor. Constructs a direction by normalizing a given array representing x, y,...
Definition: Direction.hpp:131
constexpr Dyad< NumericType > Dyadic(const Vector< NumericType > &vector) const
Returns the dyadic product of this direction with the given vector.
Definition: Direction.hpp:288
constexpr Direction(Direction< NumericType > &&other) noexcept=default
Move constructor. Constructs a direction by moving another one.
PhQ::Angle< NumericType > Angle(const Vector< NumericType > &vector) const
Returns the angle between this direction and the given vector.
Definition: Direction.hpp:298
constexpr void Set(const Vector< NumericType > &value)
Sets the value of this direction by normalizing the given vector to a unit vector....
Definition: Direction.hpp:249
Direction< NumericType > Cross(const Direction< NumericType > &direction) const
Returns the cross product of this direction with the given other direction.
Definition: Direction.hpp:283
constexpr Direction< NumericType > & operator=(const Direction< OtherNumericType > &other)
Copy assignment operator. Assigns this direction by copying another one.
Definition: Direction.hpp:192
Direction(const Vector< NumericType > &value)
Constructor. Constructs a direction by normalizing the given vector to a unit vector....
Definition: Direction.hpp:137
PhQ::Angle< NumericType > Angle(const Direction< NumericType > &direction) const
Returns the angle between this direction and the given other direction.
Definition: Direction.hpp:303
constexpr Direction()
Default constructor. Initializes a direction to the zero vector.
Definition: Direction.hpp:118
Direction(const NumericType x, const NumericType y, const NumericType z)
Constructor. Constructs a direction by normalizing the given x, y, and z Cartesian components to a un...
Definition: Direction.hpp:123
constexpr NumericType Dot(const Direction< NumericType > &direction) const noexcept
Returns the dot product (also known as the scalar product or the inner product) of this direction wit...
Definition: Direction.hpp:273
static constexpr Direction< NumericType > Zero()
Statically creates a direction whose value is the zero vector.
Definition: Direction.hpp:201
constexpr NumericType x() const noexcept
Returns the x Cartesian component of this direction.
Definition: Direction.hpp:206
constexpr void Set(const NumericType x, const NumericType y, const NumericType z)
Sets the value of this direction by normalizing the given x, y, and z Cartesian components to a unit ...
Definition: Direction.hpp:223
constexpr Vector< NumericType > Cross(const Vector< NumericType > &vector) const
Returns the cross product of this direction with the given vector.
Definition: Direction.hpp:278
constexpr NumericType Dot(const Vector< NumericType > &vector) const noexcept
Returns the dot product (also known as the scalar product or the inner product) of this direction wit...
Definition: Direction.hpp:267
constexpr void Set(const std::array< NumericType, 3 > &x_y_z)
Sets the value of this direction by normalizing the given x, y, and z Cartesian components to a unit ...
Definition: Direction.hpp:236
NumericType Magnitude() const noexcept
Returns the magnitude of this direction. This is guaranteed to be exactly 1 if the direction is not t...
Definition: Direction.hpp:261
constexpr NumericType MagnitudeSquared() const noexcept
Returns the square of the magnitude of this direction. This is guaranteed to be exactly 1 if the dire...
Definition: Direction.hpp:255
constexpr Acceleration< NumericType > operator*(const ScalarAcceleration< NumericType > &scalar_acceleration) const
constexpr Direction< NumericType > & operator=(const Direction< NumericType > &other)=default
Copy assignment operator. Assigns this direction by copying another one.
constexpr Direction< NumericType > & operator=(Direction< NumericType > &&other) noexcept=default
Move assignment operator. Assigns the value of this direction by moving another one.
Three-dimensional Euclidean dyadic tensor. Contains nine components in Cartesian coordinates: xx,...
Definition: Dyad.hpp:51
Three-dimensional Euclidean force vector. Contains three components in Cartesian coordinates: x,...
Definition: Force.hpp:52
Three-dimensional Euclidean heat flux vector. Contains three components in Cartesian coordinates: x,...
Definition: HeatFlux.hpp:50
Length, distance, or physical size. Can also represent a scalar component or magnitude of a position ...
Definition: Length.hpp:111
two-dimensional Euclidean direction vector in the XY plane. Contains two components in Cartesian coor...
constexpr PlanarDirection()
Default constructor. Initializes a planar direction to the zero planar vector.
constexpr Vector< NumericType > Cross(const PlanarVector< NumericType > &planar_vector) const
Returns the cross product of this planar direction with the given planar vector.
Two-dimensional Euclidean vector in the XY plane. Contains two components in Cartesian coordinates: x...
Three-dimensional Euclidean position vector. Contains three components in Cartesian coordinates: x,...
Definition: Position.hpp:50
Scalar acceleration component or magnitude of an acceleration vector. For a three-dimensional Euclide...
Scalar force component or magnitude of a force vector. For a three-dimensional Euclidean force vector...
Definition: ScalarForce.hpp:66
Scalar heat flux component or magnitude of a heat flux vector. For a three-dimensional Euclidean heat...
Scalar temperature gradient component or magnitude of a temperature gradient vector....
Scalar traction component or magnitude of a traction vector. Traction is similar to pressure; however...
Scalar velocity component or magnitude of a velocity vector. For a three-dimensional Euclidean veloci...
Definition: Speed.hpp:100
Symmetric three-dimensional Euclidean dyadic tensor. Contains six components in Cartesian coordinates...
Three-dimensional Euclidean temperature gradient vector. Contains three components in Cartesian coord...
Three-dimensional Euclidean traction vector. Contains three components in Cartesian coordinates: x,...
Definition: Traction.hpp:54
Three-dimensional Euclidean vector area. Contains three components in Cartesian coordinates: x,...
Definition: VectorArea.hpp:48
Three-dimensional Euclidean vector. Contains three components in Cartesian coordinates: x,...
Definition: Vector.hpp:60
NumericType Magnitude() const noexcept
Returns the magnitude (also known as the L2 norm) of this three-dimensional vector.
Definition: Vector.hpp:209
static constexpr Vector< NumericType > Zero()
Statically creates a three-dimensional vector with its x, y, and z Cartesian components initialized t...
Definition: Vector.hpp:126
constexpr NumericType Dot(const Vector< NumericType > &other) const noexcept
Returns the dot product (also known as the inner product or scalar product) of this three-dimensional...
Definition: Vector.hpp:218
constexpr Vector< NumericType > Cross(const Vector< NumericType > &other) const
Returns the cross product (also known as the vector product) of this three-dimensional vector and ano...
Definition: Vector.hpp:229
constexpr const std::array< NumericType, 3 > & x_y_z() const noexcept
Returns this three-dimensional vector's x, y, and z Cartesian components as an array.
Definition: Vector.hpp:134
constexpr NumericType MagnitudeSquared() const noexcept
Returns the square of the magnitude of this three-dimensional vector.
Definition: Vector.hpp:204
constexpr NumericType x() const noexcept
Returns this three-dimensional vector's x Cartesian component.
Definition: Vector.hpp:139
std::array< NumericType, 3 > x_y_z_
Cartesian components of this three-dimensional vector.
Definition: Vector.hpp:315
PhQ::Angle< NumericType > Angle(const Vector< NumericType > &other) const
Returns the angle between this three-dimensional vector and another one.
Definition: Angle.hpp:400
Vector()=default
Default constructor. Constructs a three-dimensional vector with uninitialized x, y,...
PhQ::Direction< NumericType > Direction() const
Returns the direction of this three-dimensional vector.
Definition: Direction.hpp:377
constexpr Dyad< NumericType > Dyadic(const Vector< NumericType > &other) const
Returns the dyadic tensor product (also known as the outer product) of this three-dimensional vector ...
Definition: Dyad.hpp:733
constexpr NumericType y() const noexcept
Returns this three-dimensional vector's y Cartesian component.
Definition: Vector.hpp:144
constexpr NumericType z() const noexcept
Returns this three-dimensional vector's z Cartesian component.
Definition: Vector.hpp:149
Three-dimensional Euclidean velocity vector. Contains three components in Cartesian coordinates: x,...
Definition: Velocity.hpp:55
Force
Force units.
Definition: Force.hpp:53
Length
Length units.
Definition: Length.hpp:53
Angle
Angle units.
Definition: Angle.hpp:53
Area
Area units.
Definition: Area.hpp:53
Acceleration
Acceleration units.
Namespace that encompasses all of the Physical Quantities library's content.
constexpr bool operator<(const Acceleration< NumericType > &left, const Acceleration< NumericType > &right) noexcept
constexpr bool operator<=(const Acceleration< NumericType > &left, const Acceleration< NumericType > &right) noexcept
constexpr Acceleration< NumericType > operator*(const NumericType number, const Acceleration< NumericType > &acceleration)
constexpr bool operator>(const Acceleration< NumericType > &left, const Acceleration< NumericType > &right) noexcept
constexpr bool operator==(const Acceleration< NumericType > &left, const Acceleration< NumericType > &right) noexcept
constexpr bool operator>=(const Acceleration< NumericType > &left, const Acceleration< NumericType > &right) noexcept
constexpr bool operator!=(const Acceleration< NumericType > &left, const Acceleration< NumericType > &right) noexcept
std::ostream & operator<<(std::ostream &stream, const Acceleration< NumericType > &acceleration)