MeshKernel
|
A class describing splines. More...
#include <Splines.hpp>
Public Member Functions | |
Splines ()=default | |
Default constructor. | |
Splines (Projection projection) | |
Ctor, set projection. More... | |
Splines (CurvilinearGrid const &grid) | |
Ctor from grids, each gridline is converted to spline, first the first m_n horizontal lines then the m_m vertical lines. More... | |
void | AddSpline (const std::vector< Point > &splines, UInt start, UInt size) |
Adds a new spline to m_splineCornerPoints. More... | |
void | AddSpline (const std::vector< Point > &splines) |
Adds a new spline to m_splineCornerPoints. More... | |
void | Replace (const UInt splineIndex, const std::vector< Point > &splinePoints) |
Replaces an existing spline. More... | |
void | SwapSplines (const UInt firstSpline, const UInt secondSpline) |
Swap all the data for two splines. More... | |
void | Reverse (const UInt splineId) |
Reverse the order of the points in the 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) More... | |
bool | GetSplinesIntersection (UInt first, UInt second, double &crossProductIntersection, Point &intersectionPoint, double &firstSplineRatio, double &secondSplineRatio) const |
Computes the intersection of two splines (sect3r) More... | |
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) More... | |
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. More... | |
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. More... | |
Point | ComputeClosestPoint (UInt index, Point point) const |
Computes the point on a spline segment which is the closest to another point. More... | |
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 corner point (splint) More... | |
BoundingBox | GetBoundingBox (const UInt splineIndex) const |
Compute the boundary box for the spline indicated by splineIndex. | |
auto | GetNumSplines () const |
Get the number of splines. More... | |
UInt | Size (const UInt whichSpline) const |
Get the size of a specific spline. More... | |
UInt | MaxSizeIndex () const |
Get the index of the spline with the largest number of spline points. | |
Public Attributes | |
std::vector< std::vector< Point > > | m_splineNodes |
The spline corner points. | |
std::vector< std::vector< Point > > | m_splineDerivatives |
The spline derivatives at the corner points. | |
std::vector< double > | m_splinesLength |
The length of each spline. | |
Projection | m_projection = Projection::cartesian |
The map projection. | |
A class describing splines.
This class stores the corner points of each spline. Besides the corner points, the derivatives at the corner points are also stored. The coordinates of the points between the corner points are computed in the method Splines::ComputePointOnSplineFromAdimensionalDistance.
|
explicit |
Ctor, set projection.
[in] projection The map projection
|
explicit |
Ctor from grids, each gridline is converted to spline, first the first m_n horizontal lines then the m_m vertical lines.
[in] grid The curvilinear grid
void meshkernel::Splines::AddSpline | ( | const std::vector< Point > & | splines | ) |
Adds a new spline to m_splineCornerPoints.
[in] | splines | The spline corner points |
Adds a new spline to m_splineCornerPoints.
[in] | splines | The spline corner points |
[in] | start | The starting index in splines |
[in] | size | The number of points making up the spline(s). |
Computes the point on a spline segment which is the closest to another point.
[in] | index | The spline index |
[in] | point | The point to account for in the calculation |
Point meshkernel::Splines::ComputeClosestPointOnSplineSegment | ( | UInt | index, |
double | startSplineSegment, | ||
double | endSplineSegment, | ||
Point | point | ||
) | const |
Computes the point on a spline segment which is the closest to another point.
[in] | index | The spline index |
[in] | startSplineSegment | The begin of the spline segment to consider |
[in] | endSplineSegment | The end of the spline segment to consider |
[in] | point | The point to account for in the calculation |
std::tuple<std::vector<Point>, std::vector<double> > meshkernel::Splines::ComputePointOnSplineFromAdimensionalDistance | ( | UInt | index, |
double | maximumGridHeight, | ||
bool | isSpacingCurvatureAdapted, | ||
const std::vector< double > & | distances | ||
) | const |
Compute the points on a spline lying at certain distance.
[in] | index | The spline index |
[in] | maximumGridHeight | Maximum grid height |
[in] | isSpacingCurvatureAdapted | Is spacing-curvature adapted |
[in] | distances | The dimensional distances of each point |
double meshkernel::Splines::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)
[in] | index | The spline index |
[in] | startAdimensionalCoordinate | Adimensional start spline |
[in] | endAdimensionalCoordinate | Adimensional end spline |
[in] | numSamples | How many intervals to use between the startAdimensionalCoordinate and endAdimensionalCoordinate |
[in] | accountForCurvature | Accounting for curvature |
[in] | height | When accounting for curvature, the height to use |
[in] | assignedDelta | When larger than zero, the number of intervals the spline is divided when computing the length |
Computes the coordinate of a point on a spline, given the dimensionless distance from the first corner point (splint)
[in] | whichSpline | Spline index |
[in] | lambda | The adimensinal coordinate where to perform the interpolation |
|
inline |
Get the number of splines.
bool meshkernel::Splines::GetSplinesIntersection | ( | UInt | first, |
UInt | second, | ||
double & | crossProductIntersection, | ||
Point & | intersectionPoint, | ||
double & | firstSplineRatio, | ||
double & | secondSplineRatio | ||
) | const |
Computes the intersection of two splines (sect3r)
[in] | first | The index of the first spline |
[in] | second | The index of the second spline |
[out] | crossProductIntersection | The cross product of the intersection |
[out] | intersectionPoint | The intersection point |
[out] | firstSplineRatio | The ratio of the first spline length where the intersection occurs |
[out] | secondSplineRatio | The ratio of the second spline length where the intersection occurs |
void meshkernel::Splines::Replace | ( | const UInt | splineIndex, |
const std::vector< Point > & | splinePoints | ||
) |
Replaces an existing spline.
[in] | splineIndex | The index of the spline to be replaced |
[in] | splinePoints | The spline points |
Get the size of a specific spline.
void meshkernel::Splines::SnapSpline | ( | const size_t | splineIndex, |
const LandBoundary & | landBoundary, | ||
const int | numberOfIterations = constants::numeric::defaultSnappingIterations |
||
) |
Snap the spline to the land boundary (snap_spline)
[in] | splineIndex | The index of the spline to be snapped to boundary |
[in] | landBoundary | The boundary to which the spline will be snapped |
[in] | numberOfIterations | The maximum number of iterations that should be performed. |
Swap all the data for two splines.
On exit the contents of the two splines will be swapped