Loading [MathJax]/extensions/tex2jax.js
MeshKernel
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages Concepts
Cartesian3DPoint.hpp
1//---- GPL ---------------------------------------------------------------------
2//
3// Copyright (C) Stichting Deltares, 2011-2025.
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation version 3.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//
17// contact: delft3d.support@deltares.nl
18// Stichting Deltares
19// P.O. Box 177
20// 2600 MH Delft, The Netherlands
21//
22// All indications and logos of, and references to, "Delft3D" and "Deltares"
23// are registered trademarks of Stichting Deltares, and remain the property of
24// Stichting Deltares. All rights reserved.
25//
26//------------------------------------------------------------------------------
27
28#pragma once
29
30#include "MeshKernel/Point.hpp"
31
32namespace meshkernel
33{
34
37 {
38 double x;
39 double y;
40 double z;
41 };
42
48
53 [[nodiscard]] double InnerProduct(const Cartesian3DPoint& a, const Cartesian3DPoint& b);
54
56 Cartesian3DPoint operator*(const Cartesian3DPoint& p, const double value);
57
59 Cartesian3DPoint operator*(const double value, const Cartesian3DPoint& p);
60
62 Cartesian3DPoint operator/(const Cartesian3DPoint& p, const double value);
63
66
69
73 [[nodiscard]] Cartesian3DPoint SphericalToCartesian3D(const Point& sphericalPoint);
74
79 [[nodiscard]] Point Cartesian3DToSpherical(const Cartesian3DPoint& cartesianPoint, double referenceLongitude);
80
81} // end namespace meshkernel
82
84{
85 return {p1.x + p2.x, p1.y + p2.y, p1.z + p2.z};
86}
87
89{
90 return {p1.x - p2.x, p1.y - p2.y, p1.z - p2.z};
91}
92
94{
95 return {p.x / value, p.y / value, p.z / value};
96}
97
99{
100 return {value * p.x, value * p.y, value * p.z};
101}
102
104{
105 return value * p;
106}
107
109{
110 return a.x * b.x + a.y * b.y + a.z * b.z;
111}
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Cartesian3DPoint VectorProduct(const Cartesian3DPoint &a, const Cartesian3DPoint &b)
Defines vector product for cartesian 3D-space.
Cartesian3DPoint operator+(const Cartesian3DPoint &p1, const Cartesian3DPoint &p2)
Add Cartesian point p2 to p1.
Definition Cartesian3DPoint.hpp:83
Cartesian3DPoint SphericalToCartesian3D(const Point &sphericalPoint)
Transforms 2D point in spherical coordinates to 3D cartesian coordinates.
Point Cartesian3DToSpherical(const Cartesian3DPoint &cartesianPoint, double referenceLongitude)
Transforms 3D cartesian coordinates to 2D point in spherical coordinates.
Cartesian3DPoint operator-(const Cartesian3DPoint &p1, const Cartesian3DPoint &p2)
Subtract Cartesian point p2 from p1.
Definition Cartesian3DPoint.hpp:88
Cartesian3DPoint operator/(const Cartesian3DPoint &p, const double value)
Divide Cartesian point p by a scalar value.
Definition Cartesian3DPoint.hpp:93
double InnerProduct(const Cartesian3DPoint &a, const Cartesian3DPoint &b)
Defines inner product in cartesian 3D-space.
Definition Cartesian3DPoint.hpp:108
Cartesian3DPoint operator*(const Cartesian3DPoint &p, const double value)
Multiply Cartesian point p by a scalar value.
Definition Cartesian3DPoint.hpp:103
A struct describing the three coordinates in a cartesian projection.
Definition Cartesian3DPoint.hpp:37
double y
Y-coordinate.
Definition Cartesian3DPoint.hpp:39
double z
Z-coordinate.
Definition Cartesian3DPoint.hpp:40
double x
X-coordinate.
Definition Cartesian3DPoint.hpp:38