|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Generates a smoothly wandering 2D path: each call to generateNextPoint() advances the last point along a direction vector perturbed by a random variation, useful for simulated motion in tests/demos. More...
#include <MathClasses.h>
Public Member Functions | |
| RandomPathGenerator () | |
| ~RandomPathGenerator () | |
| bool | setStartPoint (double x, double y) |
| Set the initial position. | |
| bool | setDirection (double dx, double dy) |
| Set the base movement direction per step. | |
| bool | setVariation (double var) |
| Set the random perturbation magnitude. | |
| PointFloat | generateNextPoint () |
| Advance one step and return the new position. | |
Public Attributes | |
| uint64 | lastPointTime |
| Timestamp of the last generated point (ms). | |
| PointFloat | lastPoint |
| Most recently generated position. | |
| Vector2D | direction |
| Current movement direction. | |
| Vector2D | variation |
| Random variation applied per step. | |
Generates a smoothly wandering 2D path: each call to generateNextPoint() advances the last point along a direction vector perturbed by a random variation, useful for simulated motion in tests/demos.
Definition at line 779 of file MathClasses.h.
| cmlabs::RandomPathGenerator::RandomPathGenerator | ( | ) |
Definition at line 1432 of file MathClasses.cpp.
References lastPointTime.
| cmlabs::RandomPathGenerator::~RandomPathGenerator | ( | ) |
Definition at line 1437 of file MathClasses.cpp.
| PointFloat cmlabs::RandomPathGenerator::generateNextPoint | ( | ) |
Advance one step and return the new position.
Definition at line 1458 of file MathClasses.cpp.
References direction, cmlabs::GetTimeAge(), cmlabs::GetTimeNow(), lastPoint, lastPointTime, cmlabs::utils::RandomValue(), variation, cmlabs::PointFloat::x, and cmlabs::PointFloat::y.
| bool cmlabs::RandomPathGenerator::setDirection | ( | double | dx, |
| double | dy ) |
Set the base movement direction per step.
Definition at line 1447 of file MathClasses.cpp.
References direction.
| bool cmlabs::RandomPathGenerator::setStartPoint | ( | double | x, |
| double | y ) |
Set the initial position.
Definition at line 1440 of file MathClasses.cpp.
References cmlabs::GetTimeNow(), lastPoint, and lastPointTime.
| bool cmlabs::RandomPathGenerator::setVariation | ( | double | var | ) |
Set the random perturbation magnitude.
Definition at line 1453 of file MathClasses.cpp.
References variation.
| Vector2D cmlabs::RandomPathGenerator::direction |
Current movement direction.
Definition at line 792 of file MathClasses.h.
Referenced by generateNextPoint(), and setDirection().
| PointFloat cmlabs::RandomPathGenerator::lastPoint |
Most recently generated position.
Definition at line 791 of file MathClasses.h.
Referenced by generateNextPoint(), and setStartPoint().
| uint64 cmlabs::RandomPathGenerator::lastPointTime |
Timestamp of the last generated point (ms).
Definition at line 790 of file MathClasses.h.
Referenced by generateNextPoint(), RandomPathGenerator(), and setStartPoint().
| Vector2D cmlabs::RandomPathGenerator::variation |
Random variation applied per step.
Definition at line 793 of file MathClasses.h.
Referenced by generateNextPoint(), and setVariation().