|
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::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::shear (std::vector< Point2 > &vPointsInOut, double shearX, double shearY) |
|
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:
- Random simple polygons
- Random segments
- Random point clouds
- Random numbers.
- Polylines from sine functions
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.
◆ generateCircle()
void GEOM_FADE2D::generateCircle |
( |
int |
numPoints, |
|
|
double |
x, |
|
|
double |
y, |
|
|
double |
radiusX, |
|
|
double |
radiusY, |
|
|
std::vector< Point2 > & |
vCirclePointsOut |
|
) |
| |
Generate a circle.
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 |
|
) |
| |
Generate random numbers.
- Parameters
-
| num | Number of random numbers to be generated |
| min | Lower bound |
| max | Upper bound |
[out] | vRandomNumbersOut | is the output vector |
| seed | initializes 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 |
|
) |
| |
Generate random points.
- Parameters
-
| numRandomPoints | Number of points to be generated |
| min | Lower bound (x,y) |
| max | Upper bound (x,y) |
[out] | vRandomPointsOut | is the output vector |
| seed | initializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization) |
Point generator
◆ generateRandomPolygon()
void GEOM_FADE2D::generateRandomPolygon |
( |
size_t |
numSegments, |
|
|
double |
min, |
|
|
double |
max, |
|
|
std::vector< Segment2 > & |
vPolygonOut, |
|
|
unsigned int |
seed = 0 |
|
) |
| |
Generate a random simple polygon.
- Parameters
-
| numSegments | Number of segments to be generated |
| min | Lower bound (x,y) |
| max | Upper bound (x,y) |
[out] | vPolygonOut | is the output vector |
| seed | initializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization) |
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 |
|
) |
| |
Generate random line segments.
- Parameters
-
| numSegments | Number of segments to be generated |
| min | Lower bound (x,y) |
| max | Upper bound (x,y) |
| maxLen | Maximal segment length |
[out] | vSegmentsOut | is the output vector |
| seed | initializes the random number generator RNG (default: 0...mapped to a random seed, other values: constant initialization) |
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 |
|
) |
| |
Generate segments from a sine function.
- Parameters
-
| numSegments | Number of segments to be generated |
| numPeriods | Number of periods of the sine function |
| xOffset | Offset of the output x-coordinates |
| yOffset | Offset of the output y-coordinates |
| xFactor | Factor to scale the sine function in x direction |
| yFactor | Factor to scale the sine function in y direction |
| bSwapXY | Swap the x and y coordinate of the function |
[out] | vSineSegmentsOut | is the output vector |
Polyline generator: Polylines from sine functions