Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
PlanarDirection.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_PLANAR_DIRECTION_HPP
26 #define PHQ_PLANAR_DIRECTION_HPP
27 
28 #include <array>
29 #include <cmath>
30 #include <cstddef>
31 #include <functional>
32 #include <ostream>
33 
34 #include "Angle.hpp"
36 #include "Dyad.hpp"
37 #include "PlanarVector.hpp"
38 #include "SymmetricDyad.hpp"
39 #include "Vector.hpp"
40 
41 namespace PhQ {
42 
43 // Forward declaration for class PhQ::PlanarDirection.
44 template <typename NumericType>
45 class Area;
46 
47 // Forward declaration for class PhQ::PlanarDirection.
48 template <typename NumericType>
49 class Length;
50 
51 // Forward declaration for class PhQ::PlanarDirection.
52 template <typename NumericType>
53 class PlanarAcceleration;
54 
55 // Forward declaration for class PhQ::PlanarDirection.
56 template <typename NumericType>
57 class PlanarDisplacement;
58 
59 // Forward declaration for class PhQ::PlanarDirection.
60 template <typename NumericType>
61 class PlanarForce;
62 
63 // Forward declaration for class PhQ::PlanarDirection.
64 template <typename NumericType>
65 class PlanarHeatFlux;
66 
67 // Forward declaration for class PhQ::PlanarDirection.
68 template <typename NumericType>
69 class PlanarPosition;
70 
71 // Forward declaration for class PhQ::PlanarDirection.
72 template <typename NumericType>
73 class PlanarTemperatureGradient;
74 
75 // Forward declaration for class PhQ::PlanarDirection.
76 template <typename NumericType>
77 class PlanarTraction;
78 
79 // Forward declaration for class PhQ::PlanarDirection.
80 template <typename NumericType>
81 class PlanarVelocity;
82 
83 // Forward declaration for class PhQ::PlanarDirection.
84 template <typename NumericType>
85 class ScalarAcceleration;
86 
87 // Forward declaration for class PhQ::PlanarDirection.
88 template <typename NumericType>
89 class ScalarForce;
90 
91 // Forward declaration for class PhQ::PlanarDirection.
92 template <typename NumericType>
93 class ScalarHeatFlux;
94 
95 // Forward declaration for class PhQ::PlanarDirection.
96 template <typename NumericType>
98 
99 // Forward declaration for class PhQ::PlanarDirection.
100 template <typename NumericType>
101 class ScalarTraction;
102 
103 // Forward declaration for class PhQ::PlanarDirection.
104 template <typename NumericType>
105 class Speed;
106 
107 /// \brief two-dimensional Euclidean direction vector in the XY plane. Contains two components in
108 /// Cartesian coordinates: x and y. Guaranteed to be either a unit vector or the zero vector (0, 0).
109 /// For a three-dimensional Euclidean direction vector, see PhQ::Direction.
110 template <typename NumericType = double>
111 class PlanarDirection : public DimensionlessPlanarVector<NumericType> {
112 public:
113  /// \brief Default constructor. Initializes a planar direction to the zero planar vector.
114  constexpr PlanarDirection()
115  : DimensionlessPlanarVector<NumericType>(PlanarVector<NumericType>::Zero()) {}
116 
117  /// \brief Constructor. Constructs a planar direction by normalizing the given x and y Cartesian
118  /// components to a unit planar vector. If x = 0 and y = 0, initializes the planar direction to
119  /// the zero planar vector.
120  PlanarDirection(const NumericType x, const NumericType y)
121  : DimensionlessPlanarVector<NumericType>() {
122  Set(x, y);
123  }
124 
125  /// \brief Constructor. Constructs a planar direction by normalizing a given array representing x
126  /// and y Cartesian components to a unit planar vector. If x = 0 and y = 0, initializes the planar
127  /// direction to the zero planar vector.
128  explicit PlanarDirection(const std::array<NumericType, 2>& x_y)
129  : DimensionlessPlanarVector<NumericType>() {
130  Set(x_y);
131  }
132 
133  /// \brief Constructor. Constructs a planar direction by normalizing the given planar vector to a
134  /// unit planar vector. If the given planar vector is the zero planar vector, initializes the
135  /// planar direction to the zero planar vector.
137  : DimensionlessPlanarVector<NumericType>() {
138  Set(value);
139  }
140 
141  /// \brief Constructor. Constructs a planar direction from a given direction by projecting the
142  /// direction onto the XY plane.
143  explicit constexpr PlanarDirection(const Direction<NumericType>& direction);
144 
145  /// \brief Constructor. Constructs a planar direction from a planar acceleration.
146  explicit PlanarDirection(const PlanarAcceleration<NumericType>& planar_acceleration);
147 
148  /// \brief Constructor. Constructs a planar direction from a planar displacement.
149  explicit PlanarDirection(const PlanarDisplacement<NumericType>& planar_displacement);
150 
151  /// \brief Constructor. Constructs a planar direction from a planar force.
152  explicit PlanarDirection(const PlanarForce<NumericType>& planar_force);
153 
154  /// \brief Constructor. Constructs a planar direction from a planar heat flux.
155  explicit PlanarDirection(const PlanarHeatFlux<NumericType>& planar_heat_flux);
156 
157  /// \brief Constructor. Constructs a planar direction from a planar position.
158  explicit PlanarDirection(const PlanarPosition<NumericType>& planar_position);
159 
160  /// \brief Constructor. Constructs a planar direction from a planar temperature gradient.
161  explicit PlanarDirection(
162  const PlanarTemperatureGradient<NumericType>& planar_temperature_gradient);
163 
164  /// \brief Constructor. Constructs a planar direction from a planar traction.
165  explicit PlanarDirection(const PlanarTraction<NumericType>& planar_traction);
166 
167  /// \brief Constructor. Constructs a planar direction from a planar velocity.
168  explicit PlanarDirection(const PlanarVelocity<NumericType>& planar_velocity);
169 
170  /// \brief Destructor. Destroys this planar direction.
171  ~PlanarDirection() noexcept = default;
172 
173  /// \brief Copy constructor. Constructs a planar direction by copying another one.
174  constexpr PlanarDirection(const PlanarDirection<NumericType>& other) = default;
175 
176  /// \brief Copy constructor. Constructs a planar direction by copying another one.
177  template <typename OtherNumericType>
178  explicit constexpr PlanarDirection(const PlanarDirection<OtherNumericType>& other)
179  : PlanarDirection(static_cast<PlanarVector<NumericType>>(other.Value())) {}
180 
181  /// \brief Move constructor. Constructs a planar direction by moving another one.
182  constexpr PlanarDirection(PlanarDirection<NumericType>&& other) noexcept = default;
183 
184  /// \brief Copy assignment operator. Assigns this planar direction by copying another one.
186  const PlanarDirection<NumericType>& other) = default;
187 
188  /// \brief Copy assignment operator. Assigns this planar direction by copying another one.
189  template <typename OtherNumericType>
191  const PlanarDirection<OtherNumericType>& other) {
192  this->value = static_cast<PlanarVector<NumericType>>(other.Value());
193  return *this;
194  }
195 
196  /// \brief Move assignment operator. Assigns the value of this planar direction by moving another
197  /// one.
199  PlanarDirection<NumericType>&& other) noexcept = default;
200 
201  /// \brief Statically creates a planar direction whose value is the zero vector.
202  [[nodiscard]] static constexpr PlanarDirection<NumericType> Zero() {
204  }
205 
206  /// \brief Returns the x Cartesian component of this planar direction.
207  [[nodiscard]] constexpr NumericType x() const noexcept {
208  return this->value.x();
209  }
210 
211  /// \brief Returns the y Cartesian component of this planar direction.
212  [[nodiscard]] constexpr NumericType y() const noexcept {
213  return this->value.y();
214  }
215 
216  /// \brief Sets the value of this planar direction by normalizing the given x and y Cartesian
217  /// components to a unit planar vector. If x = 0 and y = 0, sets the planar direction to the zero
218  /// planar vector.
219  constexpr void Set(const NumericType x, const NumericType y) {
220  const NumericType magnitude_squared{x * x + y * y};
221  if (magnitude_squared > static_cast<NumericType>(0)) {
222  const NumericType magnitude{std::sqrt(magnitude_squared)};
223  this->value = PlanarVector{x / magnitude, y / magnitude};
224  } else {
225  this->value = PlanarVector<>::Zero();
226  }
227  }
228 
229  /// \brief Sets the value of this planar direction by normalizing the given x and y Cartesian
230  /// components to a unit planar vector. If x = 0 and y = 0, sets the planar direction to the zero
231  /// planar vector.
232  constexpr void Set(const std::array<NumericType, 2>& x_y) {
233  const NumericType magnitude_squared{x_y[0] * x_y[0] + x_y[1] * x_y[1]};
234  if (magnitude_squared > static_cast<NumericType>(0)) {
235  const NumericType magnitude{std::sqrt(magnitude_squared)};
236  this->value = PlanarVector{x_y[0] / magnitude, x_y[1] / magnitude};
237  } else {
239  }
240  }
241 
242  /// \brief Sets the value of this planar direction by normalizing the given planar vector to a
243  /// unit planar vector. If the given planar vector is the zero planar vector, sets the planar
244  /// direction to the zero planar vector.
245  constexpr void Set(const PlanarVector<NumericType>& value) {
246  Set(value.x_y());
247  }
248 
249  /// \brief Returns the square of the magnitude of this planar direction. This is guaranteed to be
250  /// exactly 1 if the planar direction is not the zero planar vector, or 0 if the planar direction
251  /// is the zero planar vector.
252  [[nodiscard]] constexpr NumericType MagnitudeSquared() const noexcept {
253  return this->value.MagnitudeSquared();
254  }
255 
256  /// \brief Returns the magnitude of this planar direction. This is guaranteed to be exactly 1 if
257  /// the planar direction is not the zero planar vector, or 0 if the planar direction is the zero
258  /// planar vector.
259  [[nodiscard]] NumericType Magnitude() const noexcept {
260  return this->value.Magnitude();
261  }
262 
263  /// \brief Returns the dot product (also known as the scalar product or the inner product) of this
264  /// planar direction with the given planar vector.
265  [[nodiscard]] constexpr NumericType Dot(
266  const PlanarVector<NumericType>& planar_vector) const noexcept {
267  return this->value.Dot(planar_vector);
268  }
269 
270  /// \brief Returns the dot product (also known as the scalar product or the inner product) of this
271  /// planar direction with the given other planar direction.
272  [[nodiscard]] constexpr NumericType Dot(
273  const PlanarDirection<NumericType>& planar_direction) const noexcept {
274  return this->value.Dot(planar_direction.value);
275  }
276 
277  /// \brief Returns the cross product of this planar direction with the given planar vector.
278  [[nodiscard]] constexpr Vector<NumericType> Cross(
279  const PlanarVector<NumericType>& planar_vector) const {
280  return this->value.Cross(planar_vector);
281  }
282 
283  /// \brief Returns the cross product of this planar direction with the given other planar
284  /// direction.
285  [[nodiscard]] Direction<NumericType> Cross(
286  const PlanarDirection<NumericType>& planar_direction) const;
287 
288  /// \brief Returns the dyadic product of this planar direction with the given planar vector.
289  [[nodiscard]] constexpr Dyad<NumericType> Dyadic(
290  const PlanarVector<NumericType>& planar_vector) const {
291  return this->value.Dyadic(planar_vector);
292  }
293 
294  /// \brief Returns the dyadic product of this planar direction with the given other planar
295  /// direction.
296  [[nodiscard]] constexpr Dyad<NumericType> Dyadic(
297  const PlanarDirection<NumericType>& planar_direction) const {
298  return this->value.Dyadic(planar_direction.value);
299  }
300 
301  /// \brief Returns the angle between this planar direction and the given planar vector.
303  const PlanarVector<NumericType>& planar_vector) const {
304  return PhQ::Angle<NumericType>{*this, planar_vector};
305  }
306 
307  /// \brief Returns the angle between this planar direction and the given other planar direction.
309  const PlanarDirection<NumericType>& planar_direction) const {
310  return PhQ::Angle<NumericType>{*this, planar_direction};
311  }
312 
314  const ScalarAcceleration<NumericType>& scalar_acceleration) const;
315 
316  constexpr PlanarPosition<NumericType> operator*(const Length<NumericType>& length) const;
317 
318  constexpr PlanarForce<NumericType> operator*(const ScalarForce<NumericType>& scalar_force) const;
319 
321  const ScalarHeatFlux<NumericType>& scalar_heat_flux) const;
322 
324  const ScalarTemperatureGradient<NumericType>& scalar_temperature_gradient) const;
325 
327  const ScalarTraction<NumericType>& scalar_traction) const;
328 
329  constexpr PlanarVelocity<NumericType> operator*(const Speed<NumericType>& speed) const;
330 };
331 
332 template <typename NumericType>
333 inline constexpr bool operator==(
334  const PlanarDirection<NumericType>& left, const PlanarDirection<NumericType>& right) noexcept {
335  return left.Value() == right.Value();
336 }
337 
338 template <typename NumericType>
339 inline constexpr bool operator!=(
340  const PlanarDirection<NumericType>& left, const PlanarDirection<NumericType>& right) noexcept {
341  return left.Value() != right.Value();
342 }
343 
344 template <typename NumericType>
345 inline constexpr bool operator<(
346  const PlanarDirection<NumericType>& left, const PlanarDirection<NumericType>& right) noexcept {
347  return left.Value() < right.Value();
348 }
349 
350 template <typename NumericType>
351 inline constexpr bool operator>(
352  const PlanarDirection<NumericType>& left, const PlanarDirection<NumericType>& right) noexcept {
353  return left.Value() > right.Value();
354 }
355 
356 template <typename NumericType>
357 inline constexpr bool operator<=(
358  const PlanarDirection<NumericType>& left, const PlanarDirection<NumericType>& right) noexcept {
359  return left.Value() <= right.Value();
360 }
361 
362 template <typename NumericType>
363 inline constexpr bool operator>=(
364  const PlanarDirection<NumericType>& left, const PlanarDirection<NumericType>& right) noexcept {
365  return left.Value() >= right.Value();
366 }
367 
368 template <typename NumericType>
369 inline std::ostream& operator<<(
370  std::ostream& stream, const PhQ::PlanarDirection<NumericType>& planar_direction) {
371  stream << planar_direction.Print();
372  return stream;
373 }
374 
375 template <typename NumericType>
377  const NumericType magnitude, const PhQ::PlanarDirection<NumericType>& planar_direction)
378  : x_y_(std::array<NumericType, 2>{(planar_direction.Value() * magnitude).x_y_}) {}
379 
380 template <typename NumericType>
382  return PhQ::PlanarDirection<NumericType>{*this};
383 }
384 
385 template <typename NumericType>
386 inline constexpr NumericType PlanarVector<NumericType>::Dot(
387  const PhQ::PlanarDirection<NumericType>& planar_direction) const noexcept {
388  return Dot(planar_direction.Value());
389 }
390 
391 template <typename NumericType>
393  const PhQ::PlanarDirection<NumericType>& planar_direction) const {
394  return Cross(planar_direction.Value());
395 }
396 
397 template <typename NumericType>
399  const PhQ::PlanarDirection<NumericType>& planar_direction) const {
400  return Dyadic(planar_direction.Value());
401 }
402 
403 template <typename NumericType>
405  const SymmetricDyad<NumericType>& symmetric_dyad,
406  const PlanarDirection<NumericType>& planar_direction) {
407  return symmetric_dyad * planar_direction.Value();
408 }
409 
410 template <typename NumericType>
412  const Dyad<NumericType>& dyad, const PlanarDirection<NumericType>& planar_direction) {
413  return dyad * planar_direction.Value();
414 }
415 
416 template <typename NumericType>
418  const PhQ::PlanarDirection<NumericType>& planar_direction) const {
419  return PhQ::Angle<NumericType>{*this, planar_direction};
420 }
421 
422 template <typename NumericType>
423 inline Angle<NumericType>::Angle(const PlanarVector<NumericType>& planar_vector,
424  const PlanarDirection<NumericType>& planar_direction)
425  : Angle(std::acos(planar_vector.Dot(planar_direction) / planar_vector.Magnitude())) {}
426 
427 template <typename NumericType>
428 inline Angle<NumericType>::Angle(const PlanarDirection<NumericType>& planar_direction,
429  const PlanarVector<NumericType>& planar_vector)
430  : Angle(std::acos(planar_direction.Dot(planar_vector) / planar_vector.Magnitude())) {}
431 
432 template <typename NumericType>
433 inline Angle<NumericType>::Angle(const PlanarDirection<NumericType>& planar_direction_1,
434  const PlanarDirection<NumericType>& planar_direction_2)
435  : Angle(std::acos(planar_direction_1.Dot(planar_direction_2))) {}
436 
437 } // namespace PhQ
438 
439 namespace std {
440 
441 template <typename NumericType>
442 struct hash<PhQ::PlanarDirection<NumericType>> {
443  inline size_t operator()(const PhQ::PlanarDirection<NumericType>& planar_direction) const {
444  return hash<PhQ::PlanarVector<NumericType>>()(planar_direction.Value());
445  }
446 };
447 
448 } // namespace std
449 
450 #endif // PHQ_PLANAR_DIRECTION_HPP
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.
Abstract base class that represents any dimensionless planar vector physical quantity....
PhQ::PlanarVector< double > value
Value of this physical quantity.
constexpr const PhQ::PlanarVector< double > & Value() const noexcept
Value of this physical quantity.
std::string Print() const
Prints this physical quantity as a string.
Three-dimensional Euclidean direction vector. Contains three components in Cartesian coordinates: x,...
Definition: Direction.hpp:115
Three-dimensional Euclidean dyadic tensor. Contains nine components in Cartesian coordinates: xx,...
Definition: Dyad.hpp:51
Length, distance, or physical size. Can also represent a scalar component or magnitude of a position ...
Definition: Length.hpp:111
Two-dimensional Euclidean acceleration vector in the XY plane. Contains two components in Cartesian c...
two-dimensional Euclidean direction vector in the XY plane. Contains two components in Cartesian coor...
constexpr NumericType Dot(const PlanarDirection< NumericType > &planar_direction) const noexcept
Returns the dot product (also known as the scalar product or the inner product) of this planar direct...
constexpr PlanarDirection< NumericType > & operator=(const PlanarDirection< OtherNumericType > &other)
Copy assignment operator. Assigns this planar direction by copying another one.
constexpr NumericType y() const noexcept
Returns the y Cartesian component of this planar direction.
constexpr Dyad< NumericType > Dyadic(const PlanarDirection< NumericType > &planar_direction) const
Returns the dyadic product of this planar direction with the given other planar direction.
~PlanarDirection() noexcept=default
Destructor. Destroys this planar direction.
static constexpr PlanarDirection< NumericType > Zero()
Statically creates a planar direction whose value is the zero vector.
constexpr NumericType x() const noexcept
Returns the x Cartesian component of this planar direction.
constexpr PlanarDirection< NumericType > & operator=(PlanarDirection< NumericType > &&other) noexcept=default
Move assignment operator. Assigns the value of this planar direction by moving another one.
constexpr PlanarAcceleration< NumericType > operator*(const ScalarAcceleration< NumericType > &scalar_acceleration) const
constexpr void Set(const std::array< NumericType, 2 > &x_y)
Sets the value of this planar direction by normalizing the given x and y Cartesian components to a un...
NumericType Magnitude() const noexcept
Returns the magnitude of this planar direction. This is guaranteed to be exactly 1 if the planar dire...
constexpr void Set(const PlanarVector< NumericType > &value)
Sets the value of this planar direction by normalizing the given planar vector to a unit planar vecto...
constexpr PlanarDirection(PlanarDirection< NumericType > &&other) noexcept=default
Move constructor. Constructs a planar direction by moving another one.
constexpr NumericType Dot(const PlanarVector< NumericType > &planar_vector) const noexcept
Returns the dot product (also known as the scalar product or the inner product) of this planar direct...
PhQ::Angle< NumericType > Angle(const PlanarVector< NumericType > &planar_vector) const
Returns the angle between this planar direction and the given planar vector.
constexpr Dyad< NumericType > Dyadic(const PlanarVector< NumericType > &planar_vector) const
Returns the dyadic product of this planar direction with the given planar vector.
constexpr PlanarDirection()
Default constructor. Initializes a planar direction to the zero planar vector.
PlanarDirection(const PlanarVector< NumericType > &value)
Constructor. Constructs a planar direction by normalizing the given planar vector to a unit planar ve...
constexpr void Set(const NumericType x, const NumericType y)
Sets the value of this planar direction by normalizing the given x and y Cartesian components to a un...
constexpr NumericType MagnitudeSquared() const noexcept
Returns the square of the magnitude of this planar direction. This is guaranteed to be exactly 1 if t...
PhQ::Angle< NumericType > Angle(const PlanarDirection< NumericType > &planar_direction) const
Returns the angle between this planar direction and the given other planar direction.
constexpr PlanarDirection< NumericType > & operator=(const PlanarDirection< NumericType > &other)=default
Copy assignment operator. Assigns this planar direction by copying another one.
PlanarDirection(const std::array< NumericType, 2 > &x_y)
Constructor. Constructs a planar direction by normalizing a given array representing x and y Cartesia...
PlanarDirection(const NumericType x, const NumericType y)
Constructor. Constructs a planar direction by normalizing the given x and y Cartesian components to a...
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 displacement vector in the XY plane. Contains two components in Cartesian c...
Two-dimensional Euclidean force vector in the XY plane. Contains two components in Cartesian coordina...
Definition: PlanarForce.hpp:50
Two-dimensional Euclidean heat flux vector in the XY plane. Contains two components in Cartesian coor...
Two-dimensional Euclidean position vector in the XY plane. Contains two components in Cartesian coord...
Two-dimensional Euclidean temperature gradient vector in the XY plane. Contains two components in Car...
Two-dimensional Euclidean traction vector in the XY plane. Contains two components in Cartesian coord...
Two-dimensional Euclidean vector in the XY plane. Contains two components in Cartesian coordinates: x...
constexpr Vector< NumericType > Cross(const PlanarVector< NumericType > &other) const
Returns the cross product (also known as the vector product) of this two-dimensional planar vector an...
Definition: Vector.hpp:411
constexpr const std::array< NumericType, 2 > & x_y() const noexcept
Returns this two-dimensional planar vector's x and y Cartesian components as an array.
constexpr NumericType x() const noexcept
Returns this two-dimensional planar vector's x Cartesian component.
PlanarVector()=default
Default constructor. Constructs a two-dimensional planar vector with uninitialized x and y Cartesian ...
static constexpr PlanarVector< NumericType > Zero()
Statically creates a two-dimensional planar vector with its x and y Cartesian components initialized ...
PhQ::PlanarDirection< NumericType > PlanarDirection() const
Returns the planar direction of this two-dimensional planar vector.
constexpr NumericType Dot(const PlanarVector< NumericType > &other) const noexcept
Returns the dot product (also known as the inner product or scalar product) of this two-dimensional p...
NumericType Magnitude() const noexcept
Returns the magnitude (also known as the L2 norm) of this two-dimensional planar vector.
PhQ::Angle< NumericType > Angle(const PlanarVector< NumericType > &other) const
Returns the angle between this two-dimensional planar vector and another one.
Definition: Angle.hpp:394
std::array< NumericType, 2 > x_y_
Cartesian components of this two-dimensional planar vector.
constexpr Dyad< NumericType > Dyadic(const PlanarVector< NumericType > &other) const
Returns the dyadic tensor product (also known as the outer product) of this two-dimensional planar ve...
Definition: Dyad.hpp:722
constexpr NumericType y() const noexcept
Returns this two-dimensional planar vector's y Cartesian component.
constexpr NumericType MagnitudeSquared() const noexcept
Returns the square of the magnitude of this two-dimensional planar vector.
Two-dimensional Euclidean velocity vector in the XY plane. Contains two components in Cartesian coord...
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 vector. Contains three components in Cartesian coordinates: x,...
Definition: Vector.hpp:60
Length
Length units.
Definition: Length.hpp:53
Angle
Angle units.
Definition: Angle.hpp:53
Area
Area units.
Definition: Area.hpp:53
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)