CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::RandomPathGenerator Class Reference

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>

Collaboration diagram for cmlabs::RandomPathGenerator:
[legend]

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ RandomPathGenerator()

cmlabs::RandomPathGenerator::RandomPathGenerator ( )

Definition at line 1432 of file MathClasses.cpp.

References lastPointTime.

◆ ~RandomPathGenerator()

cmlabs::RandomPathGenerator::~RandomPathGenerator ( )

Definition at line 1437 of file MathClasses.cpp.

Member Function Documentation

◆ generateNextPoint()

PointFloat cmlabs::RandomPathGenerator::generateNextPoint ( )

◆ setDirection()

bool cmlabs::RandomPathGenerator::setDirection ( double dx,
double dy )

Set the base movement direction per step.

Returns
true.

Definition at line 1447 of file MathClasses.cpp.

References direction.

◆ setStartPoint()

bool cmlabs::RandomPathGenerator::setStartPoint ( double x,
double y )

Set the initial position.

Returns
true.

Definition at line 1440 of file MathClasses.cpp.

References cmlabs::GetTimeNow(), lastPoint, and lastPointTime.

◆ setVariation()

bool cmlabs::RandomPathGenerator::setVariation ( double var)

Set the random perturbation magnitude.

Returns
true.

Definition at line 1453 of file MathClasses.cpp.

References variation.

Member Data Documentation

◆ direction

Vector2D cmlabs::RandomPathGenerator::direction

Current movement direction.

Definition at line 792 of file MathClasses.h.

Referenced by generateNextPoint(), and setDirection().

◆ lastPoint

PointFloat cmlabs::RandomPathGenerator::lastPoint

Most recently generated position.

Definition at line 791 of file MathClasses.h.

Referenced by generateNextPoint(), and setStartPoint().

◆ lastPointTime

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().

◆ variation

Vector2D cmlabs::RandomPathGenerator::variation

Random variation applied per step.

Definition at line 793 of file MathClasses.h.

Referenced by generateNextPoint(), and setVariation().


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