Geom Software - C++ Programming and Geometry Libraries
Fade2D Documentation pages v1.58
Test Data Generators

Functions

void GEOM_FADE2D::generateRandomNumbers (size_t num, double min, double max, std::vector< double > &vRandomNumbersOut, unsigned int seed=0)
 Generate random numbers. More...
 
void GEOM_FADE2D::generateRandomPoints (size_t numRandomPoints, double min, double max, std::vector< Point2 > &vRandomPointsOut, unsigned int seed=0)
 Generate random points. More...
 
void GEOM_FADE2D::generateRandomPolygon (size_t numSegments, double min, double max, std::vector< Segment2 > &vPolygonOut, unsigned int seed=0)
 Generate a random simple polygon. More...
 
void GEOM_FADE2D::generateRandomSegments (size_t numSegments, double min, double max, double maxLen, std::vector< Segment2 > &vSegmentsOut, unsigned int seed)
 Generate random line segments. More...
 
void GEOM_FADE2D::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...
 
void GEOM_FADE2D::generateCircle (int numPoints, double x, double y, double radiusX, double radiusY, std::vector< Point2 > &vCirclePointsOut)
 Generate a circle. More...
 
void GEOM_FADE2D::shear (std::vector< Point2 > &vPointsInOut, double shearX, double shearY)
 

Detailed Description

random_objects.png
Random objects (points, lines, polygons, polylines)

Generate random polygons and other test objects

Theory, careful programming and automated software stress tests. Neither of them can replace the other one. Testing with random data helps to discover errors early. Fade provides random object generators for your automated software stress tests:

If you discover an error in your software you must be able to reproduce the input data that has triggered your bug. For this reason the random object generators take a seed value to initialize the internal random number generators. A certain seed value always leads to the same sequence of objects. Only when the special seed value 0 is used then the random number generators are initialized from the system time.

Function Documentation

◆ generateCircle()

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

Returns points on a circle centered at the given coordinates

◆ generateRandomNumbers()

void GEOM_FADE2D::generateRandomNumbers ( size_t  num,
double  min,
double  max,
std::vector< double > &  vRandomNumbersOut,
unsigned int  seed = 0 
)
Parameters
numNumber of random numbers to be generated
minLower bound
maxUpper bound
[out]vRandomNumbersOutis the output vector
seedinitializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization)
Note
Reproducable random numbers are often desirable when software is tested with random geometric constructions. Thus each seed value different from 0 leads to its own, reproducible, output sequence. In contrast the seed value 0 is mapped to random initialization of the RNG. In this case the RNG will produce a different output sequence each time it is called.

◆ generateRandomPoints()

void GEOM_FADE2D::generateRandomPoints ( 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)
maxUpper bound (x,y)
[out]vRandomPointsOutis the output vector
seedinitializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization)
randomPoints.png
Point generator

◆ generateRandomPolygon()

void GEOM_FADE2D::generateRandomPolygon ( size_t  numSegments,
double  min,
double  max,
std::vector< Segment2 > &  vPolygonOut,
unsigned int  seed = 0 
)
Parameters
numSegmentsNumber of segments to be generated
minLower bound (x,y)
maxUpper bound (x,y)
[out]vPolygonOutis the output vector
seedinitializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization)
randomPolygon.png
Polygon generator: Random simple polygon

◆ generateRandomSegments()

void GEOM_FADE2D::generateRandomSegments ( size_t  numSegments,
double  min,
double  max,
double  maxLen,
std::vector< Segment2 > &  vSegmentsOut,
unsigned int  seed 
)
Parameters
numSegmentsNumber of segments to be generated
minLower bound (x,y)
maxUpper bound (x,y)
maxLenMaximal segment length
[out]vSegmentsOutis the output vector
seedinitializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization)
randomSegments.png
Segment generator: Random line segments

◆ generateSineSegments()

void GEOM_FADE2D::generateSineSegments ( int  numSegments,
int  numPeriods,
double  xOffset,
double  yOffset,
double  xFactor,
double  yFactor,
bool  bSwapXY,
std::vector< Segment2 > &  vSineSegmentsOut 
)
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
  • sinePolyline.png
    Polyline generator: Polylines from sine functions