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);
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;
241 double operator()(
double adimensionalDistanceReferencePoint)
const {
…}
270 double operator()(
double adimensionalDistanceReferencePoint)
const
270 double operator()(
double adimensionalDistanceReferencePoint)
const {
…}
A class defining a bounding box.
Definition BoundingBox.hpp:40
A class containing the land boundary polylines.
Definition LandBoundary.hpp:40
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
A class describing splines.
Definition Splines.hpp:48
std::vector< std::vector< Point > > m_splineDerivatives
The spline derivatives at the corner points.
Definition Splines.hpp:173
UInt Size(const UInt whichSpline) const
Get the size of a specific spline.
void AddSpline(const std::vector< Point > &splines)
Adds a new spline to m_splineCornerPoints.
UInt MaxSizeIndex() const
Get the index of the spline with the largest number of spline points.
void Replace(const UInt splineIndex, const std::vector< Point > &splinePoints)
Replaces an existing spline.
void SnapSpline(const size_t splineIndex, const LandBoundary &landBoundary, const int numberOfIterations=constants::numeric::defaultSnappingIterations)
Snap the spline to the land boundary (snap_spline)
BoundingBox GetBoundingBox(const UInt splineIndex) const
Compute the boundary box for the spline indicated by splineIndex.
void Reverse(const UInt splineId)
Reverse the order of the points in the spline.
auto GetNumSplines() const
Get the number of splines.
Definition Splines.hpp:163
Splines()=default
Default constructor.
bool GetSplinesIntersection(UInt first, UInt second, double &crossProductIntersection, Point &intersectionPoint, double &firstSplineRatio, double &secondSplineRatio) const
Computes the intersection of two splines (sect3r)
void AddSpline(const std::vector< Point > &splines, UInt start, UInt size)
Adds a new spline to m_splineCornerPoints.
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...
std::vector< double > m_splinesLength
The length of each spline.
Definition Splines.hpp:174
Point ComputeClosestPoint(UInt index, Point point) const
Computes the point on a spline segment which is the closest to another point.
Projection m_projection
The map projection.
Definition Splines.hpp:175
std::vector< std::vector< Point > > m_splineNodes
The spline corner points.
Definition Splines.hpp:172
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.
Splines(Projection projection)
Ctor, set projection.
Splines(CurvilinearGrid const &grid)
Ctor from grids, each gridline is converted to spline, first the first m_n horizontal lines then the ...
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 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)
void SwapSplines(const UInt firstSpline, const UInt secondSpline)
Swap all the data for two splines.
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43
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:502
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39
double ComputeDistance(const Point &firstPoint, const Point &secondPoint, const Projection &projection)
Computes the distance between two points (dbdistance)
This structure is used to create a function for converting an adimensional distance on a spline to a ...
Definition Splines.hpp:203
bool m_isSpacingCurvatureAdapted
Is spacing curvature adapted.
Definition Splines.hpp:250
double operator()(double adimensionalDistanceReferencePoint) const
This is the function we want to find the root of.
Definition Splines.hpp:241
FuncAdimensionalToDimensionalDistanceOnSpline(const Splines &splines, UInt splineIndex, bool isSpacingCurvatureAdapted, double h, double distance)
Constructor.
Definition Splines.hpp:223
double m_DimensionalDistance
Dimensional distance.
Definition Splines.hpp:253
void SetDimensionalDistance(double distance)
Set dimensional distance.
Definition Splines.hpp:235
double m_h
When accounting for curvature, the height to use.
Definition Splines.hpp:251
UInt m_splineIndex
Spline index.
Definition Splines.hpp:249
const Splines & m_spline
Reference to splines.
Definition Splines.hpp:248
FuncAdimensionalToDimensionalDistanceOnSpline(const Splines &splines, UInt splineIndex, bool isSpacingCurvatureAdapted, double h)
Constructor.
Definition Splines.hpp:209
UInt m_numSamples
Number of samples.
Definition Splines.hpp:252
This structure is used to compute the point on a spline closest to another point.
Definition Splines.hpp:258
double m_DimensionalDistance
Dimensional distance.
Definition Splines.hpp:279
double operator()(double adimensionalDistanceReferencePoint) const
This is the function we want to find the root of.
Definition Splines.hpp:270
Point m_point
The point from where the distance is calculated.
Definition Splines.hpp:278
UInt m_splineIndex
Spline index.
Definition Splines.hpp:277
const Splines & m_spline
Reference to splines.
Definition Splines.hpp:276
FuncDistanceFromAPoint(const Splines &splines, UInt splineIndex, Point point)
Constructor.
Definition Splines.hpp:263