30 #include "MeshKernel/BoundingBox.hpp"
31 #include "MeshKernel/Constants.hpp"
32 #include "MeshKernel/Entities.hpp"
33 #include "MeshKernel/LandBoundary.hpp"
34 #include "MeshKernel/Operations.hpp"
35 #include "MeshKernel/Utilities/LinearAlgebra.hpp"
39 class CurvilinearGrid;
60 explicit Splines(CurvilinearGrid
const& grid);
71 void AddSpline(
const std::vector<Point>& splines);
76 void Replace(
const UInt splineIndex,
const std::vector<Point>& splinePoints);
93 const int numberOfIterations = constants::numeric::defaultSnappingIterations);
105 double& crossProductIntersection,
106 Point& intersectionPoint,
107 double& firstSplineRatio,
108 double& secondSplineRatio)
const;
120 double startAdimensionalCoordinate,
121 double endAdimensionalCoordinate,
122 UInt numSamples = 100,
123 bool accountForCurvature =
false,
125 double assignedDelta = -1.0)
const;
134 double maximumGridHeight,
135 bool isSpacingCurvatureAdapted,
136 const std::vector<double>& distances)
const;
181 void AddPointInExistingSpline(
UInt splineIndex,
const Point& point);
187 std::tuple<Point, Point, double> ComputeCurvatureOnSplinePoint(
UInt splineIndex,
188 double adimensionalPointCoordinate)
const;
192 void DeleteSpline(
UInt splineIndex);
195 void AllocateSplinesProperties();
198 static std::vector<Point> ComputeSplineDerivative(
const std::vector<Point>& splinesNodes);
211 bool isSpacingCurvatureAdapted,
225 bool isSpacingCurvatureAdapted,
227 double distance) :
m_spline(splines),
241 double operator()(
double adimensionalDistanceReferencePoint)
const
245 return distanceFromReferencePoint;
270 double operator()(
double adimensionalDistanceReferencePoint)
const
Projection
Enumerator describing the supported projections.
Definition: Definitions.hpp:41
This structure is used to create a function for converting an adimensional distance on a spline to a ...
Definition: Splines.hpp:202
auto GetNumSplines() const
Get the number of splines.
Definition: Splines.hpp:163
Point m_point
The point from where the distance is calculated.
Definition: Splines.hpp:278
void SnapSpline(const size_t splineIndex, const LandBoundary &landBoundary, const int numberOfIterations=constants::numeric::defaultSnappingIterations)
Snap the spline to the land boundary (snap_spline)
void SwapSplines(const UInt firstSpline, const UInt secondSpline)
Swap all the data for two splines.
FuncDistanceFromAPoint(const Splines &splines, UInt splineIndex, Point point)
Constructor.
Definition: Splines.hpp:263
UInt Size(const UInt whichSpline) const
Get the size of a specific spline.
T ComputePointOnSplineAtAdimensionalDistance(const std::vector< T > &coordinates, const std::vector< T > &coordinatesDerivatives, double pointAdimensionalCoordinate)
Computes the coordinate of a point on a spline, given the dimensionless distance from the first corne...
Definition: Operations.hpp:488
A class defining a bounding box.
Definition: BoundingBox.hpp:39
A struct describing a point in a two-dimensional space.
Definition: Point.hpp:40
const Splines & m_spline
Reference to splines.
Definition: Splines.hpp:276
void AddSpline(const std::vector< Point > &splines, UInt start, UInt size)
Adds a new spline to m_splineCornerPoints.
A class containing the land boundary polylines.
Definition: LandBoundary.hpp:39
BoundingBox GetBoundingBox(const UInt splineIndex) const
Compute the boundary box for the spline indicated by splineIndex.
std::vector< double > m_splinesLength
The length of each spline.
Definition: Splines.hpp:174
const Splines & m_spline
Reference to splines.
Definition: Splines.hpp:248
std::vector< std::vector< Point > > m_splineNodes
The spline corner points.
Definition: Splines.hpp:172
Point Evaluate(const UInt whichSpline, const double lambda) const
Computes the coordinate of a point on a spline, given the dimensionless distance from the first corne...
Splines()=default
Default constructor.
void Replace(const UInt splineIndex, const std::vector< Point > &splinePoints)
Replaces an existing spline.
Contains the logic of the C++ static library.
Definition: AveragingInterpolation.hpp:36
double m_DimensionalDistance
Dimensional distance.
Definition: Splines.hpp:279
UInt m_splineIndex
Spline index.
Definition: Splines.hpp:249
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition: Definitions.hpp:38
void Reverse(const UInt splineId)
Reverse the order of the points in the spline.
UInt m_numSamples
Number of samples.
Definition: Splines.hpp:252
Projection m_projection
The map projection.
Definition: Splines.hpp:175
std::vector< std::vector< Point > > m_splineDerivatives
The spline derivatives at the corner points.
Definition: Splines.hpp:173
UInt m_splineIndex
Spline index.
Definition: Splines.hpp:277
FuncAdimensionalToDimensionalDistanceOnSpline(const Splines &splines, UInt splineIndex, bool isSpacingCurvatureAdapted, double h)
Constructor.
Definition: Splines.hpp:209
double ComputeDistance(const Point &firstPoint, const Point &secondPoint, const Projection &projection)
Computes the distance between two points (dbdistance)
This structure is used to compute the point on a spline closest to another point.
Definition: Splines.hpp:257
Point ComputeClosestPointOnSplineSegment(UInt index, double startSplineSegment, double endSplineSegment, Point point) const
Computes the point on a spline segment which is the closest to another point.
double m_h
When accounting for curvature, the height to use.
Definition: Splines.hpp:251
void SetDimensionalDistance(double distance)
Set dimensional distance.
Definition: Splines.hpp:235
bool GetSplinesIntersection(UInt first, UInt second, double &crossProductIntersection, Point &intersectionPoint, double &firstSplineRatio, double &secondSplineRatio) const
Computes the intersection of two splines (sect3r)
std::tuple< std::vector< Point >, std::vector< double > > ComputePointOnSplineFromAdimensionalDistance(UInt index, double maximumGridHeight, bool isSpacingCurvatureAdapted, const std::vector< double > &distances) const
Compute the points on a spline lying at certain distance.
double operator()(double adimensionalDistanceReferencePoint) const
This is the function we want to find the root of.
Definition: Splines.hpp:270
bool m_isSpacingCurvatureAdapted
Is spacing curvature adapted.
Definition: Splines.hpp:250
FuncAdimensionalToDimensionalDistanceOnSpline(const Splines &splines, UInt splineIndex, bool isSpacingCurvatureAdapted, double h, double distance)
Constructor.
Definition: Splines.hpp:223
double operator()(double adimensionalDistanceReferencePoint) const
This is the function we want to find the root of.
Definition: Splines.hpp:241
double ComputeSplineLength(UInt index, double startAdimensionalCoordinate, double endAdimensionalCoordinate, UInt numSamples=100, bool accountForCurvature=false, double height=1.0, double assignedDelta=-1.0) const
Computes the spline length in s coordinates (GETDIS)
UInt MaxSizeIndex() const
Get the index of the spline with the largest number of spline points.
double m_DimensionalDistance
Dimensional distance.
Definition: Splines.hpp:253
Point ComputeClosestPoint(UInt index, Point point) const
Computes the point on a spline segment which is the closest to another point.
A class describing splines.
Definition: Splines.hpp:47