Stepdance Software Library
Loading...
Searching...
No Matches
PathLengthGenerator3D Class Reference

Used for generating an output proportional to the 3D path length traveled by three inputs. More...

#include <generators.hpp>

Inheritance diagram for PathLengthGenerator3D:

Public Member Functions

void begin ()
 Initialize the PathLengthGenerator3D. Must be called to set up the generator.
void set_ratio (ControlParameter ratio)
 Set the ratio between output distance and input path length.
void set_ratio (ControlParameter output_distance, ControlParameter input_distance)

Public Attributes

ControlParameter ratio = 1.0
 ControlParameter scaling output relative to input path length (output/input).
BlockPort input_1
 First input BlockPort (e.g., X position).
BlockPort input_2
 Second input BlockPort (e.g., Y position).
BlockPort input_3
 Third input BlockPort (e.g., Z position).
BlockPort output
 Output BlockPort proportional to 3D path length.

Protected Member Functions

void run ()

Detailed Description

Used for generating an output proportional to the 3D path length traveled by three inputs.

PathLengthGenerator3D measures the incremental Euclidean distance traversed by three input signals and produces an output proportional to that path length by a configurable ratio. Here's an example of how to instantiate and configure a PathLengthGenerator3D:

#define module_driver
#include "stepdance.hpp"
InputPort input_b;
Channel channel_p3;
OutputPort output_p3;
void setup(){
// Initialize OutputPort and enable drivers
output_p3.begin(OUTPUT_A);
enable_drivers();
// Initialize InputPort and map X/Y/Z to path length inputs
input_b.begin(INPUT_A);
input_b.output_x.map(path3_gen.input_1);
input_b.output_y.map(path3_gen.input_2);
input_b.output_z.map(path3_gen.input_3);
// Configure and begin generator
path3_gen.set_ratio(1.0);
path3_gen.begin();
// Map generator output to a channel
path3_gen.output.map(channel_p3.input_target_position);
channel_p3.begin(&output_p3, SIGNAL_E);
dance_start();
}
void loop(){
dance_loop();
}

Member Function Documentation

◆ set_ratio()

void PathLengthGenerator3D::set_ratio ( ControlParameter ratio)

Set the ratio between output distance and input path length.

Parameters
ratioThe proportionality constant (output / input).

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