Points¶
Overview¶
-
struct Points¶
Structure to hold 2D scattered points data.
The
omdi::Pointsstruct stores and owns vectors of x and y coordinates representing scattered (non-gridded) 2D points. Data is copied into the struct on construction, so the caller does not need to keep the source arrays alive after creating aomdi::Pointsinstance.It is typically used in plotting operations such as scatter plots, line plots, or marking features on 2D domains.
Usage example¶
Basic usage with std::vector arrays:
auto xs = std::vector<float> { 0.0f, 1.0f, 2.0f };
auto ys = std::vector<float> { 1.0f, 0.5f, 0.25f };
auto pts = omdi::Points(xs, ys, 3);
// pts.x and pts.y are independent copies of xs and ys.
// The source vectors may safely go out of scope.
Data members¶
-
std::vector<float> Points::x¶
Vector of X coordinates.
Contains
omdi::Points::npointselements.
-
std::vector<float> Points::y¶
Vector of Y coordinates.
Contains
omdi::Points::npointselements.
Constructor¶
-
Points::Points(const std::vector<float> &x, const std::vector<float> &y, size_t npoints)¶
Construct a
omdi::Pointsobject from coordinate vectors.- Parameters:
x – Vector of X coordinates (length
npoints).y – Vector of Y coordinates (length
npoints).npoints – Number of points in the arrays.
Both vectors are copied into the struct; the caller is free to modify or destroy the originals after construction.
Notes¶
omdi::Pointsowns its coordinate data; no external arrays need to remain alive after construction.Both vectors must contain at least
omdi::Points::npointselements.The struct is suitable for passing point clouds into plotting primitives, proximity queries, or geometric algorithms.