Ocean
Line2.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_MATH_LINE_2_H
9 #define META_OCEAN_MATH_LINE_2_H
10 
11 #include "ocean/math/Math.h"
12 #include "ocean/math/Vector2.h"
13 #include "ocean/math/Vector3.h"
14 
15 #include <vector>
16 
17 namespace Ocean
18 {
19 
20 // Forward declaration.
21 template <typename T> class LineT2;
22 
23 /**
24  * Definition of the Line2 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single or double precision float data type.
25  * @see LineT2
26  * @ingroup math
27  */
29 
30 /**
31  * Instantiation of the LineT2 template class using a double precision float data type.
32  * @see LineT2
33  * @ingroup math
34  */
36 
37 /**
38  * Instantiation of the LineT2 template class using a single precision float data type.
39  * @see LineT2
40  * @ingroup math
41  */
43 
44 /**
45  * Definition of a typename alias for vectors with LineT2 objects.
46  * @see LineT2
47  * @ingroup math
48  */
49 template <typename T>
50 using LinesT2 = std::vector<LineT2<T>>;
51 
52 /**
53  * Definition of a vector holding Line2 objects.
54  * @see Line2
55  * @ingroup math
56  */
57 typedef std::vector<Line2> Lines2;
58 
59 /**
60  * Definition of a vector holding Line2 objects with single precision float data type.
61  * @see LineF2
62  * @ingroup math
63  */
64 typedef std::vector<LineF2> LinesF2;
65 
66 /**
67  * Definition of a vector holding Line2 objects with double precision float data type.
68  * @see LineD2
69  * @ingroup math
70  */
71 typedef std::vector<LineD2> LinesD2;
72 
73 /**
74  * This class implements an infinite line in 2D space.
75  * The implementation is realized by an (explicit) parametric equation using a point on the line and the direction of the line.<br>
76  * However, the line support conversion function to receive also an implicit equation.
77  * @tparam T Data type used to represent lines
78  * @see Line2, LineF2, LineD2, FiniteLine2, FiniteLine.
79  * @ingroup math
80  */
81 template <typename T>
82 class LineT2
83 {
84  template <typename U> friend class LineT2;
85 
86  public:
87 
88  /**
89  * Definition of the used data type.
90  */
91  typedef T Type;
92 
93  public:
94 
95  /**
96  * Creates an invalid line.
97  */
98  LineT2();
99 
100  /**
101  * Creates a line defined by a point on the line and a line direction.
102  * @param point Point on the line
103  * @param direction Vector representing the direction of the line, a unit vector might be appropriate
104  */
105  LineT2(const VectorT2<T>& point, const VectorT2<T>& direction);
106 
107  /**
108  * Creates a new line object by given (implicit) three-parameter representation of the line.
109  * The representation is given by the normal and the distance parameter of the line so that for a point (x, y) lying on the plane the following holds: [nx, ny, d] * [x, y, 1] == 0.<br>
110  * The normal must be defined as unit vector.
111  * @param parameters The three parameters given as 3D vector
112  */
113  explicit LineT2(const VectorT3<T>& parameters);
114 
115  /**
116  * Creates a new line object by a given angle of the line's normal and the distance of the line to the origin.
117  * The distance values is equal to the distance parameter of a (implicit) three-parameter representation of a line where the other two parameters define the normal of the plane.
118  * @param angle The angle of the line's normal, with normal = [cos(angle), sin(angle)], in radian
119  * @param distance The signed distance of the line to the origin, with range (-infinity, infinity)
120  * @see decomposeAngleDistance().
121  */
122  LineT2(const T angle, const T distance);
123 
124  /**
125  * Copies a line with different data type than T.
126  * @param line The line to copy
127  * @tparam U The data type of the second line
128  */
129  template <typename U>
130  inline explicit LineT2(const LineT2<U>& line);
131 
132  /**
133  * Returns a point on the line.
134  * @return Point on line
135  */
136  inline const VectorT2<T>& point() const;
137 
138  /**
139  * Returns a point on the line that is defined by a scalar.
140  * The result is determined by point() + direction() * distance;
141  * @param distance Distance to determine the line point for
142  * @return Point on line
143  */
144  inline VectorT2<T> point(const T distance) const;
145 
146  /**
147  * Returns the direction of the line.
148  * @return Direction vector
149  */
150  inline const VectorT2<T>& direction() const;
151 
152  /**
153  * Returns a normal to the direction of this line.
154  * The 2D cross product between the resulting normal and the direction of this line will be positive.
155  * @return The resulting normal
156  */
157  inline VectorT2<T> normal() const;
158 
159  /**
160  * Calculates the angle of the line's normal and the corresponding distance of this line to the origin.
161  * The resulting distance parameter is equivalent to the distance parameter of a (implicit) three-parameter representation of this line where the other two parameters define the normal of the plane.<br>
162  * @param angle Resulting angle of the line's normal which is defined by atan(normal.y() / normal.x()); with normal = [cos(angle), sin(angle)], in radian
163  * @param distance Resulting signed distance between line and origin, is positive if the normal points towards the origin and negative if the normal points away from the origin
164  */
165  inline void decomposeAngleDistance(T& angle, T& distance) const;
166 
167  /**
168  * Calculates the (implicit) three-parameters representation of this line composed of the line's normal and a distance parameter (nx, ny, d).
169  * For a point (x, y) lying on the plane the following holds: [nx, ny, d] * [x, y, 1] == 0.
170  * @param forcePositiveDistance True, to force a positive distance values; False, to accept positive and negative distance values
171  * @return The resulting three parameter representation
172  */
173  inline VectorT3<T> decomposeNormalDistance(const bool forcePositiveDistance = false) const;
174 
175  /**
176  * Returns whether a given point is part of the line.
177  * This function needs a unit vector as direction!
178  * @param point Point to check
179  * @return True, if so
180  */
181  bool isOnLine(const VectorT2<T>& point) const;
182 
183  /**
184  * Check if a point is in the left half-plane of the direction vector of a line
185  * A point @c p is located on the left side of a line, if the cross product of the direction of the line, @c d, and the vector pointing from starting point of the line, @c s, to the point @c p is positive: (d x (p - s)) > 0.
186  * It's on the line the cross product is zero and in the right half-plane it is negative.
187  * @note Keep in mind that if the point is not in the left half-plane, it doesn't necessarily mean that it's in the right half-plane because it could just as well be located on the line.
188  * @param point Point to check
189  * @return True, if the point is in the left half-plane
190  */
191  bool isLeftOfLine(const VectorT2<T>& point) const;
192 
193  /**
194  * Returns the distance between the line and a given point.
195  * This function needs a unit vector as direction!
196  * @param point Point to return the distance for
197  * @return The always positive distance between point and line, with range [0, infinity)
198  */
199  T distance(const VectorT2<T>& point) const;
200 
201  /**
202  * Returns the square distance between the line and a given point.
203  * @param point Point to return the distance for
204  * @return Square distance between point and line
205  */
206  T sqrDistance(const VectorT2<T>& point) const;
207 
208  /**
209  * Returns the point on this line nearest to an arbitrary given point.
210  * This function needs a unit vector as direction!
211  * @param point Arbitrary point outside the line
212  * @return Nearest point on the line
213  */
215 
216  /**
217  * Returns the unique intersection point of two lines.
218  * Two identical lines do not have one unique intersection point, so that this function will return 'false' in such a case.
219  * This function needs a unit vector as direction!
220  * @param right Right line for intersection calculation
221  * @param point Resulting intersection pointer
222  * @return True, if both lines are not parallel
223  */
224  bool intersection(const LineT2<T>& right, VectorT2<T>& point) const;
225 
226  /**
227  * Returns whether two lines are parallel up to a small epsilon.
228  * This function needs a unit vector as direction!
229  * @param right Second line
230  * @return True, if so
231  */
232  bool isParallel(const LineT2<T>& right) const;
233 
234  /**
235  * Returns whether this line has valid parameters.
236  * @return True, if so
237  */
238  bool isValid() const;
239 
240  /**
241  * Returns whether this line has a unit vector as direction.
242  * @return True, if so
243  */
244  inline bool hasUnitDirection() const;
245 
246  /**
247  * Returns whether two line are identical up to a small epsilon.
248  * @param right Right line
249  * @return True, if so
250  */
251  bool operator==(const LineT2<T>& right) const;
252 
253  /**
254  * Returns whether two line are identical up to a small epsilon.
255  * @param right Right line
256  * @return True, if so
257  */
258  inline bool operator!=(const LineT2<T>& right) const;
259 
260  /**
261  * Returns whether this line is valid.
262  * @return True, if so
263  */
264  explicit inline operator bool() const;
265 
266  /**
267  * Fits a line to a set of given image points by application of the least square measure.
268  * @param points The points for which the best fitting line is requested, must be valid
269  * @param size The number of given points, with range [2, infinity)
270  * @param line The resulting line
271  * @return True, if succeeded
272  */
273  static inline bool fitLineLeastSquare(const VectorT2<T>* points, const size_t size, LineT2<T>& line);
274 
275  protected:
276 
277  /// Point on the line.
279 
280  /// Direction of the line.
282 };
283 
284 template <typename T>
286  linePoint(T(0), T(0)),
287  lineDirection(T(0), T(0))
288 {
289  // nothing to do here
290 }
291 
292 template <typename T>
293 LineT2<T>::LineT2(const VectorT2<T>& point, const VectorT2<T>& direction) :
294  linePoint(point),
295  lineDirection(direction)
296 {
297  ocean_assert(isValid());
298 }
299 
300 template <typename T>
301 LineT2<T>::LineT2(const VectorT3<T>& parameters)
302 {
303  const VectorT2<T> normal(parameters.x(), parameters.y());
304  ocean_assert(NumericT<T>::isEqual(normal.length(), 1));
305 
306  lineDirection = normal.perpendicular();
307  ocean_assert(NumericT<T>::isEqual(lineDirection.length(), 1));
308 
309  linePoint = normal * -parameters.z();
310  ocean_assert(isValid());
311 }
312 
313 template <typename T>
314 LineT2<T>::LineT2(const T angle, const T distance)
315 {
316  const VectorT2<T> normal(NumericT<T>::cos(angle), NumericT<T>::sin(angle));
317  ocean_assert(NumericT<T>::isEqual(normal.length(), 1));
318 
319  lineDirection = normal.perpendicular();
320  ocean_assert(NumericT<T>::isEqual(lineDirection.length(), 1));
321 
322  linePoint = normal * -distance;
323  ocean_assert(isValid());
324 }
325 
326 template <typename T>
327 template <typename U>
328 inline LineT2<T>::LineT2(const LineT2<U>& line)
329 {
330  linePoint = VectorT2<T>(line.linePoint);
331  lineDirection = VectorT2<T>(line.lineDirection);
332 }
333 
334 template <typename T>
335 inline const VectorT2<T>& LineT2<T>::point() const
336 {
337  return linePoint;
338 }
339 
340 template <typename T>
341 inline VectorT2<T> LineT2<T>::point(const T distance) const
342 {
343  ocean_assert(isValid());
344  return linePoint + lineDirection * distance;
345 }
346 
347 template <typename T>
348 inline const VectorT2<T>& LineT2<T>::direction() const
349 {
350  return lineDirection;
351 }
352 
353 template <typename T>
355 {
356  ocean_assert(isValid());
357  VectorT2<T> result(-lineDirection.perpendicular());
358 
359  // as this line may have a direction which is not a unit vector we have to normalize our normal explicitly
360  result.normalize();
361 
362  return result;
363 }
364 
365 template <typename T>
366 inline void LineT2<T>::decomposeAngleDistance(T& angle, T& distance) const
367 {
368  ocean_assert(isValid());
369 
370  const VectorT2<T> normalVector(normal());
371 
372  angle = NumericT<T>::atan2(normalVector.y(), normalVector.x());
373  distance = -normalVector * linePoint;
374 
375  // ensure that the absolute distance is correct
376  ocean_assert_accuracy((std::is_same<T, float>::value) || NumericT<T>::isEqual(NumericT<T>::abs(distance), this->distance(VectorT2<T>(0, 0))));
377 
378  // ensure that distance is valid for the three-parameter representation of our line
379  ocean_assert_accuracy(NumericT<T>::isEqualEps(VectorT3<T>(normalVector.x(), normalVector.y(), distance) * VectorT3<T>(linePoint.x(), linePoint.y(), 1)));
380 }
381 
382 template <typename T>
383 inline VectorT3<T> LineT2<T>::decomposeNormalDistance(const bool forcePositiveDistance) const
384 {
385  ocean_assert(isValid());
386 
387  const VectorT2<T> normalVector(normal());
388  const T distance = -normalVector * linePoint;
389 
390  // ensure that the absolute distance is correct
391  ocean_assert((std::is_same<T, float>::value) || NumericT<T>::isWeakEqual(NumericT<T>::abs(distance), this->distance(VectorT2<T>(0, 0))));
392 
393  // ensure that distance is valid for the three-parameter representation of our line
394  ocean_assert((std::is_same<T, float>::value) || NumericT<T>::isWeakEqualEps(VectorT3<T>(normalVector.x(), normalVector.y(), distance) * VectorT3<T>(linePoint.x(), linePoint.y(), 1)));
395 
396  if (forcePositiveDistance && distance < T(0))
397  {
398  return VectorT3<T>(-normalVector.x(), -normalVector.y(), -distance);
399  }
400 
401  return VectorT3<T>(normalVector.x(), normalVector.y(), distance);
402 }
403 
404 template <typename T>
405 inline bool LineT2<T>::isValid() const
406 {
407  return !lineDirection.isNull();
408 }
409 
410 template <typename T>
411 inline bool LineT2<T>::hasUnitDirection() const
412 {
413  return NumericT<T>::isEqual(lineDirection.length(), T(1.0));
414 }
415 
416 template <typename T>
417 inline bool LineT2<T>::operator!=(const LineT2<T>& right) const
418 {
419  return !(*this == right);
420 }
421 
422 template <typename T>
423 inline LineT2<T>::operator bool() const
424 {
425  return isValid();
426 }
427 
428 template <typename T>
429 bool LineT2<T>::isOnLine(const VectorT2<T>& point) const
430 {
431  ocean_assert(hasUnitDirection());
432  ocean_assert(isValid());
433 
434  const VectorT2<T> offset(point - linePoint);
435  const T length = offset.length();
436 
437  if (NumericT<T>::isEqualEps(length))
438  {
439  return true;
440  }
441 
442 #ifdef OCEAN_DEBUG
443  if (!std::is_same<T, float>::value)
444  {
445  ocean_assert(NumericT<T>::isEqual(NumericT<T>::abs((offset / length) * lineDirection), T(1.0))
446  == NumericT<T>::isEqual(NumericT<T>::abs(offset * lineDirection), length, NumericT<T>::eps() * length));
447  }
448 #endif
449 
450  // we explicitly adjust the epsilon by the length of the offset vector ensuring that the result is still correct for long vectors (short vectors would have been caught before)
451  return NumericT<T>::isEqual(NumericT<T>::abs(offset * lineDirection), length, NumericT<T>::eps() * length);
452 }
453 
454 template <typename T>
455 bool LineT2<T>::isLeftOfLine(const VectorT2<T>& otherPoint) const
456 {
457  ocean_assert(isValid());
458 
459  return (direction().cross(otherPoint - point())) > NumericT<T>::weakEps();
460 }
461 
462 template <>
463 inline bool LineT2<float>::isOnLine(const VectorT2<float>& point) const
464 {
465  ocean_assert(hasUnitDirection());
466  ocean_assert(isValid());
467 
468  const VectorT2<float> offset(point - linePoint);
469  const float length = offset.length();
470 
471  if (NumericT<float>::isEqualEps(length))
472  {
473  return true;
474  }
475 
476  if (length > 1.0f)
477  {
478  // we explicitly adjust the epsilon by the length of the offset vector ensuring that the result is still correct for long vectors (short vectors would have been caught before)
479  return NumericT<float>::isEqual(NumericT<float>::abs(offset * lineDirection), length, NumericT<float>::eps() * length);
480  }
481 
482  return NumericT<float>::isEqual(NumericT<float>::abs(offset * lineDirection), length, NumericT<float>::eps());
483 }
484 
485 template <typename T>
486 T LineT2<T>::distance(const VectorT2<T>& point) const
487 {
488  ocean_assert(hasUnitDirection());
489  ocean_assert(isValid());
490 
491  const VectorT2<T> pointOnLine(nearestPoint(point));
492  ocean_assert((!std::is_same<T, double>::value) || isOnLine(pointOnLine));
493 
494  return (pointOnLine - point).length();
495 }
496 
497 template <typename T>
498 T LineT2<T>::sqrDistance(const VectorT2<T>& point) const
499 {
500  ocean_assert(hasUnitDirection());
501  ocean_assert(isValid());
502 
503  const VectorT2<T> pointOnLine(nearestPoint(point));
504 
505  return (pointOnLine - point).sqr();
506 }
507 
508 template <typename T>
510 {
511  ocean_assert(hasUnitDirection());
512  ocean_assert(isValid());
513 
514  const VectorT2<T> offset(point - linePoint);
515 
516  return linePoint + lineDirection * (lineDirection * offset);
517 }
518 
519 template <typename T>
520 bool LineT2<T>::intersection(const LineT2<T>& right, VectorT2<T>& point) const
521 {
522  ocean_assert(hasUnitDirection());
523 
524  if (isParallel(right))
525  {
526  return false;
527  }
528 
529  // direction from the right line to this line
530  const VectorT2<T> normal(nearestPoint(right.linePoint) - right.linePoint);
531 
532  // smallest distance from the right line to this line
533  const T normalLength = normal.length();
534 
535  // if the point of the right line is already on this line
536  if (NumericT<T>::isEqualEps(normalLength))
537  {
538  point = right.linePoint;
539  return true;
540  }
541 
542  const T cosValue = right.lineDirection * (normal / normalLength);
543 
544  if (NumericT<T>::isEqualEps(cosValue))
545  {
546  // both lines are too parallel, so that we wrote for no (unique) intersection
547  return false;
548  }
549 
550  const T offset = normalLength / cosValue;
551 
552  point = right.linePoint + right.lineDirection * offset;
553 
554  if constexpr (std::is_same<T, double>::value)
555  {
556  ocean_assert_accuracy(right.isOnLine(point));
557  ocean_assert_accuracy(isOnLine(point));
558  }
559 
560  return true;
561 }
562 
563 template <typename T>
564 bool LineT2<T>::isParallel(const LineT2<T>& right) const
565 {
566  ocean_assert(hasUnitDirection());
567  ocean_assert(isValid() && right.isValid());
568 
569  return lineDirection == right.lineDirection || lineDirection == -right.lineDirection;
570 }
571 
572 template <typename T>
573 bool LineT2<T>::operator==(const LineT2<T>& right) const
574 {
575  ocean_assert(isValid() && right.isValid());
576  return isParallel(right) && isOnLine(right.point());
577 }
578 
579 template <typename T>
580 bool LineT2<T>::fitLineLeastSquare(const VectorT2<T>* points, const size_t size, LineT2<T>& line)
581 {
582  static_assert(std::is_same<float, T>::value || std::is_same<double, T>::value, "Type T can be either float or double.");
583  ocean_assert(points && size >= 2);
584 
585  // average values
586  T x(0);
587  T y(0);
588 
589  // variance values
590  T x2(0);
591  T y2(0);
592 
593  // covariance
594  T xy(0);
595 
596  for (size_t i = 0; i < size; i++)
597  {
598  const VectorT2<T>& point = points[i];
599 
600  x += point[0];
601  y += point[1];
602 
603  x2 += NumericT<T>::sqr(point[0]);
604  y2 += NumericT<T>::sqr(point[1]);
605 
606  xy += point[0] * point[1];
607  }
608 
609  ocean_assert(size != 0);
610  const T invSize = T(1) / T(size);
611 
612  x *= invSize;
613  y *= invSize;
614  x2 *= invSize;
615  y2 *= invSize;
616  xy *= invSize;
617 
618  const T xSqr = x * x;
619  const T ySqr = y * y;
620 
621  const T nominator = 2 * (xy - x * y);
622  const T denominator = (x2 - xSqr) - (y2 - ySqr);
623 
624  if (NumericT<T>::isEqualEps(denominator) && NumericT<T>::isEqualEps(nominator))
625  {
626  return false;
627  }
628 
629  const Scalar angleDirection(T(0.5) * NumericT<T>::atan2(nominator, denominator));
630  const VectorT2<T> direction(NumericT<T>::cos(angleDirection), NumericT<T>::sin(angleDirection));
631 
632  const VectorT2<T> linePoint(x, y);
633 
634  line = LineT2<T>(linePoint, direction);
635 
636  return true;
637 }
638 
639 } // namespace Ocean
640 
641 #endif // META_OCEAN_MATH_LINE_2_H
This class implements an infinite line in 2D space.
Definition: Line2.h:83
const VectorT2< T > & point() const
Returns a point on the line.
Definition: Line2.h:335
bool hasUnitDirection() const
Returns whether this line has a unit vector as direction.
Definition: Line2.h:411
bool intersection(const LineT2< T > &right, VectorT2< T > &point) const
Returns the unique intersection point of two lines.
Definition: Line2.h:520
bool isParallel(const LineT2< T > &right) const
Returns whether two lines are parallel up to a small epsilon.
Definition: Line2.h:564
bool operator==(const LineT2< T > &right) const
Returns whether two line are identical up to a small epsilon.
Definition: Line2.h:573
VectorT2< T > normal() const
Returns a normal to the direction of this line.
Definition: Line2.h:354
bool isValid() const
Returns whether this line has valid parameters.
Definition: Line2.h:405
static bool fitLineLeastSquare(const VectorT2< T > *points, const size_t size, LineT2< T > &line)
Fits a line to a set of given image points by application of the least square measure.
Definition: Line2.h:580
void decomposeAngleDistance(T &angle, T &distance) const
Calculates the angle of the line's normal and the corresponding distance of this line to the origin.
Definition: Line2.h:366
VectorT3< T > decomposeNormalDistance(const bool forcePositiveDistance=false) const
Calculates the (implicit) three-parameters representation of this line composed of the line's normal ...
Definition: Line2.h:383
VectorT2< T > lineDirection
Direction of the line.
Definition: Line2.h:281
T distance(const VectorT2< T > &point) const
Returns the distance between the line and a given point.
Definition: Line2.h:486
const VectorT2< T > & direction() const
Returns the direction of the line.
Definition: Line2.h:348
friend class LineT2
Definition: Line2.h:84
T Type
Definition of the used data type.
Definition: Line2.h:91
T sqrDistance(const VectorT2< T > &point) const
Returns the square distance between the line and a given point.
Definition: Line2.h:498
VectorT2< T > linePoint
Point on the line.
Definition: Line2.h:278
bool isLeftOfLine(const VectorT2< T > &point) const
Check if a point is in the left half-plane of the direction vector of a line A point p is located on ...
Definition: Line2.h:455
VectorT2< T > nearestPoint(const VectorT2< T > &point) const
Returns the point on this line nearest to an arbitrary given point.
Definition: Line2.h:509
bool operator!=(const LineT2< T > &right) const
Returns whether two line are identical up to a small epsilon.
Definition: Line2.h:417
bool isOnLine(const VectorT2< T > &point) const
Returns whether a given point is part of the line.
Definition: Line2.h:429
This class provides basic numeric functionalities.
Definition: Numeric.h:57
static constexpr T weakEps()
Returns a weak epsilon.
static T atan2(const T y, const T x)
Returns the arctangent of a given value in radian.
Definition: Numeric.h:1632
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition: Numeric.h:2386
static constexpr T sqr(const T value)
Returns the square of a given value.
Definition: Numeric.h:1495
static constexpr bool isEqualEps(const T value)
Returns whether a value is smaller than or equal to a small epsilon.
Definition: Numeric.h:2087
This class implements a vector with two elements.
Definition: Vector2.h:96
const T & x() const noexcept
Returns the x value.
Definition: Vector2.h:698
const T & y() const noexcept
Returns the y value.
Definition: Vector2.h:710
T length() const
Returns the length of the vector.
Definition: Vector2.h:615
bool normalize()
Normalizes this vector.
Definition: Vector2.h:600
VectorT2< T > perpendicular() const
Returns a vector perpendicular to this vectors.
Definition: Vector2.h:550
This class implements a vector with three elements.
Definition: Vector3.h:97
const T & y() const noexcept
Returns the y value.
Definition: Vector3.h:812
const T & x() const noexcept
Returns the x value.
Definition: Vector3.h:800
const T & z() const noexcept
Returns the z value.
Definition: Vector3.h:824
std::vector< LineT2< T > > LinesT2
Definition of a typename alias for vectors with LineT2 objects.
Definition: Line2.h:50
float Scalar
Definition of a scalar type.
Definition: Math.h:128
LineT2< double > LineD2
Instantiation of the LineT2 template class using a double precision float data type.
Definition: Line2.h:35
std::vector< Line2 > Lines2
Definition of a vector holding Line2 objects.
Definition: Line2.h:57
LineT2< float > LineF2
Instantiation of the LineT2 template class using a single precision float data type.
Definition: Line2.h:42
LineT2< Scalar > Line2
Definition of the Line2 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single o...
Definition: Line2.h:21
std::vector< LineD2 > LinesD2
Definition of a vector holding Line2 objects with double precision float data type.
Definition: Line2.h:71
std::vector< LineF2 > LinesF2
Definition of a vector holding Line2 objects with single precision float data type.
Definition: Line2.h:64
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15