Fade2.5D Documentation pages v2.16.8
Delaunay Features
Test Data Generators

Random object generators for automated software stress tests. More...

Functions

CLASS_DECLSPEC void GEOM_FADE25D::generateCircle (int numPoints, double x, double y, double z, double radiusX, double radiusY, std::vector< Point2 > &vCirclePointsOut)
 Generate points on a circle. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateRandomNumbers (size_t num, double min, double max, std::vector< double > &vRandomNumbersOut, unsigned int seed=0)
 Generate (reproducible) random numbers. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateRandomPoints (size_t numRandomPoints, double min, double max, std::vector< Point2 > &vRandomPointsOut, unsigned int seed=0)
 Generate (reproducible) random points. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateRandomPoints3D (size_t numRandomPoints, double min, double max, std::vector< Point2 > &vRandomPointsOut, unsigned int seed=0)
 Generate (reproducible) random 3D points. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateRandomPolygon (size_t numSegments, double min, double max, std::vector< Segment2 > &vPolygonOut, unsigned int seed=0)
 Generate a (reproducible) random polygon. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateRandomSegments (size_t numSegments, double min, double max, double maxLen, std::vector< Segment2 > &vSegmentsOut, unsigned int seed)
 Generate (reproducible) random line segments. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateRandomSurfacePoints (size_t numX, size_t numY, size_t numCenters, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, std::vector< Point2 > &vSurfacePointsOut, unsigned int seed, bool bGrid=true)
 Generate a (reproducible) random surface. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::generateSineSegments (int numSegments, int numPeriods, double xOffset, double yOffset, double xFactor, double yFactor, bool bSwapXY, std::vector< Segment2 > &vSineSegmentsOut)
 Generate segments from a sine function. More...
 
CLASS_DECLSPEC void GEOM_FADE25D::shear (std::vector< Point2 > &vPointsInOut, double shearX, double shearY)
 Apply shear transformation to points. More...
 

Detailed Description

Random objects (points, lines, polygons, polylines)

Theory, careful programming, and automated stress tests are essential. None of these can replace the others. Testing with random data helps to uncover unexpected bugs early. Fade provides random object generators to assist with automated stress tests, including:

These tools allow you to reproduce specific error conditions. The random object generators accept a seed value to initialize the random number generator. Using the same seed value will always generate the same sequence of objects. Only the seed value 0 will produce different sequences with each execution.

Function Documentation

◆ generateCircle()

CLASS_DECLSPEC void GEOM_FADE25D::generateCircle ( int  numPoints,
double  x,
double  y,
double  z,
double  radiusX,
double  radiusY,
std::vector< Point2 > &  vCirclePointsOut 
)

This function generates points evenly distributed on the circumference of an ellipse or circle, centered at the specified coordinates.

Parameters
numPointsThe number of points to generate along the circle's circumference.
xThe x-coordinate of the circle's center.
yThe y-coordinate of the circle's center.
zThe z-coordinate of the circle's center.
radiusXThe radius along the x-axis.
radiusYThe radius along the y-axis.
vCirclePointsOut[out] A vector to store the generated points.
Note
If radiusX equals radiusY, the points will form a circle. For other values, the points form an ellipse.

◆ generateRandomNumbers()

CLASS_DECLSPEC void GEOM_FADE25D::generateRandomNumbers ( size_t  num,
double  min,
double  max,
std::vector< double > &  vRandomNumbersOut,
unsigned int  seed = 0 
)

This function generates a specified number of random numbers within a given range and stores them in the output vector.

Parameters
[in]numThe number of random numbers to generate.
[in]minThe lower bound for the random numbers.
[in]maxThe upper bound for the random numbers.
[out]vRandomNumbersOutThe output vector that will store the generated random numbers.
[in]seedInitializes the random number generator (RNG).
  • 0 (default): Uses a random seed, resulting in non-reproducible sequences.
  • Otherwise: Uses the given value for reproducible sequences.
Note
Reproducible random numbers are useful for testing software with random geometric constructions. Providing a seed value other than 0 ensures the output sequence can be reproduced. Conversely, a seed value of 0 maps to random initialization, leading to a unique output sequence for each function call.

◆ generateRandomPoints()

CLASS_DECLSPEC void GEOM_FADE25D::generateRandomPoints ( size_t  numRandomPoints,
double  min,
double  max,
std::vector< Point2 > &  vRandomPointsOut,
unsigned int  seed = 0 
)

This function generates a specified number of random points within a given range and stores them in the output vector.

Parameters
numRandomPointsThe number of random points to generate.
minThe lower bound for both x and y coordinates.
maxThe upper bound for both x and y coordinates.
[out]vRandomPointsOutThe output vector to store the generated random points.
seedInitializes the random number generator (RNG).
  • 0 (default): Uses a random seed, resulting in non-reproducible sequences.
  • Non-zero: Uses the given value for reproducible sequences.
Note
Reproducible random points are useful for testing applications involving random geometric constructions. Providing a seed value other than 0 ensures the output sequence can be reproduced. Conversely, a seed value of 0 maps to random initialization, leading to a unique output sequence for each function call.
Point generator

◆ generateRandomPoints3D()

CLASS_DECLSPEC void GEOM_FADE25D::generateRandomPoints3D ( size_t  numRandomPoints,
double  min,
double  max,
std::vector< Point2 > &  vRandomPointsOut,
unsigned int  seed = 0 
)
Parameters
numRandomPointsNumber of points to be generated.
minLower bound (x, y, z) coordinates.
maxUpper bound (x, y, z) coordinates.
[out]vRandomPointsOutThe output vector to store the generated random points.
seedInitializes the random number generator (RNG).
  • Default: 0 (mapped to a random seed for unique sequences).
  • Other values: Use for constant initialization and reproducible sequences.

◆ generateRandomPolygon()

CLASS_DECLSPEC void GEOM_FADE25D::generateRandomPolygon ( size_t  numSegments,
double  min,
double  max,
std::vector< Segment2 > &  vPolygonOut,
unsigned int  seed = 0 
)

This function generates a random simple polygon.

Parameters
numSegmentsThe number of segments to be generated.
minLower bound for (x, y) coordinates.
maxUpper bound for (x, y) coordinates.
[out]vPolygonOutThe output vector that stores the generated polygon's segments.
seedInitializes the random number generator (RNG).
  • Default: 0 (mapped to a random seed for unique sequences).
  • Other values: Use for constant initialization and reproducible sequences.
Polygon generator: Random simple polygon

◆ generateRandomSegments()

CLASS_DECLSPEC void GEOM_FADE25D::generateRandomSegments ( size_t  numSegments,
double  min,
double  max,
double  maxLen,
std::vector< Segment2 > &  vSegmentsOut,
unsigned int  seed 
)
Parameters
numSegmentsThe number of segments to be generated.
minLower bound for (x, y) coordinates.
maxUpper bound for (x, y) coordinates.
maxLenThe maximum length of each segment.
[out]vSegmentsOutThe output vector storing the generated segments.
seedInitializes the random number generator (RNG):
  • Default: 0 (mapped to a random seed for unique sequences).
  • Other values: Use for constant initialization and reproducible sequences.
Segment generator: Random line segments

◆ generateRandomSurfacePoints()

CLASS_DECLSPEC void GEOM_FADE25D::generateRandomSurfacePoints ( size_t  numX,
size_t  numY,
size_t  numCenters,
double  xmin,
double  ymin,
double  zmin,
double  xmax,
double  ymax,
double  zmax,
std::vector< Point2 > &  vSurfacePointsOut,
unsigned int  seed,
bool  bGrid = true 
)
Parameters
numX,numYSpecifies the grid dimensions. Both must be >1, resulting in numX*numY points.
numCentersThe number of extreme points
xmin,ymin,zmin,xmax,ymax,zmaxDefines the geometric bounds for the surface.
[out]vSurfacePointsOutThe output vector storing the generated surface points.
seedInitializes the random number generator:
  • Default: 0 (mapped to a random seed for unique sequences).
  • Other values: Use for constant initialization and reproducible sequences.
bGridSpecifies whether points are placed exactly on a grid or slightly randomized.
  • Default: true (grid-aligned points).

◆ generateSineSegments()

CLASS_DECLSPEC void GEOM_FADE25D::generateSineSegments ( int  numSegments,
int  numPeriods,
double  xOffset,
double  yOffset,
double  xFactor,
double  yFactor,
bool  bSwapXY,
std::vector< Segment2 > &  vSineSegmentsOut 
)

This function generates segments from a sine function.

Parameters
numSegmentsNumber of segments to be generated
numPeriodsNumber of periods of the sine function
xOffsetOffset of the output x-coordinates
yOffsetOffset of the output y-coordinates
xFactorFactor to scale the sine function in x direction
yFactorFactor to scale the sine function in y direction
bSwapXYSwap the x and y coordinate of the function
[out]vSineSegmentsOutis the output vector
Polyline generator: Polylines from sine functions

◆ shear()

CLASS_DECLSPEC void GEOM_FADE25D::shear ( std::vector< Point2 > &  vPointsInOut,
double  shearX,
double  shearY 
)

Applies a shear transformation to a set of points, modifying their coordinates based on the specified shear factors.

Parameters
[in,out]vPointsInOutThe input points to be sheared. These points are modified in place.
[in]shearX,shearYThe shear factors in x and y direction.
Note
The shear transformation modifies the original points in place. The result will be stored in the same vector.