Class GestureSchedule
java.lang.Object
net.paulhertz.pixelaudio.schedule.GestureSchedule
- All Implemented Interfaces:
PAGesture
Data container for a
PAGesture with immutable points and times
and an optional start time (in milliseconds).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGestureSchedule(List<processing.core.PVector> points, float[] timesMs) Creates a gesture schedule from point and time arrays. -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the schedule duration.static voidenforceNonDecreasing(float[] t) Mutates a time array so values never decrease.List<processing.core.PVector>Dense gesture points.longAbsolute start time (e.g.float[]Time offsets in ms, same length as getAllPoints(), first element typically 0.booleanisEmpty()Reports whether the gesture contains no points.static float[]normalizeTimesToStartAtZero(float[] timesMs) Returns a copy of the time array shifted so the first value is zero.voidsetStartTimeMs(long startTimeMs) Sets the absolute schedule start time.intsize()Returns the number of gesture points.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.paulhertz.pixelaudio.curves.PAGesture
getAllPointsSchedule
-
Field Details
-
points
Gesture positions. -
timesMs
public final float[] timesMsGesture time offsets in milliseconds, same length aspoints. -
startTimeMs
public long startTimeMsOptional absolute start time in milliseconds.
-
-
Constructor Details
-
GestureSchedule
Creates a gesture schedule from point and time arrays.- Parameters:
points- gesture positionstimesMs- time offsets in milliseconds, one per point
-
-
Method Details
-
getAllPoints
Description copied from interface:PAGestureDense gesture points.- Specified by:
getAllPointsin interfacePAGesture- Returns:
- gesture points
-
getTimeOffsetsMs
public float[] getTimeOffsetsMs()Description copied from interface:PAGestureTime offsets in ms, same length as getAllPoints(), first element typically 0.- Specified by:
getTimeOffsetsMsin interfacePAGesture- Returns:
- gesture time offsets in milliseconds
-
getStartTimeMs
public long getStartTimeMs()Description copied from interface:PAGestureAbsolute start time (e.g. millis() when gesture began).- Specified by:
getStartTimeMsin interfacePAGesture- Returns:
- absolute gesture start time in milliseconds
-
setStartTimeMs
public void setStartTimeMs(long startTimeMs) Sets the absolute schedule start time.- Parameters:
startTimeMs- start time in milliseconds
-
size
public int size()Description copied from interface:PAGestureReturns the number of gesture points. -
durationMs
public float durationMs()Returns the schedule duration.- Returns:
- elapsed milliseconds between first and last time offset
-
isEmpty
public boolean isEmpty()Description copied from interface:PAGestureReports whether the gesture contains no points. -
normalizeTimesToStartAtZero
public static float[] normalizeTimesToStartAtZero(float[] timesMs) Returns a copy of the time array shifted so the first value is zero.- Parameters:
timesMs- source time offsets- Returns:
- normalized time offsets
-
enforceNonDecreasing
public static void enforceNonDecreasing(float[] t) Mutates a time array so values never decrease.- Parameters:
t- time offsets to adjust in place
-