wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wEngine::MathUtils Class Reference

Provides common mathematical helper functions for plotting and geometry. More...

#include <wMathUtils.hpp>

Static Public Member Functions

static std::vector< double > linspace (double start, double end, size_t nbPoints)
 Generates a linearly spaced vector of values between two bounds.

Detailed Description

Provides common mathematical helper functions for plotting and geometry.

This utility class groups static methods that are frequently needed when working with numerical data, discretization, and rendering curves.

Note
All methods are static and do not require instantiation.
Author
Wilfried Koch

Member Function Documentation

◆ linspace()

std::vector< double > wEngine::MathUtils::linspace ( double start,
double end,
size_t nbPoints )
staticnodiscard

Generates a linearly spaced vector of values between two bounds.

This function produces a vector of evenly spaced points between start and end (inclusive).

Parameters
startStarting value.
endEnding value.
nbPointsNumber of points to generate (must be >= 2).
Returns
A std::vector< double > containing evenly spaced values.
Exceptions
std::invalid_argumentif start >= end or nbPoints < 2.
auto values = MathUtils::linspace( 0.0, 1.0, 5 );
// values = { 0.0, 0.25, 0.5, 0.75, 1.0 }
static std::vector< double > linspace(double start, double end, size_t nbPoints)
Generates a linearly spaced vector of values between two bounds.
Definition wMathUtils.cpp:17

The documentation for this class was generated from the following files: