@@ -17,6 +17,7 @@ Curves are an integral part of openage's event-based game simulation.
1717 2 . [ Container] ( #container )
1818 1 . [ Queue] ( #queue )
1919 2 . [ Unordered Map] ( #unordered-map )
20+ 3 . [ Array] ( #array )
2021
2122
2223## Motivation
@@ -256,33 +257,38 @@ allows access to all key-value pairs that were in the map at time `t`.
256257
257258
258259#### Array
259- Array curve containers are the equivalent to the ` std::array ` C++ containers. Unlike other curve containers,
260- each element of the underlying std::array is a ` keyframecontainer ` and when a value is added to the ` Array curve `
261- at a given index they are added to the respective ` keyframecontainer ` at that index as a keyframe.
260+
261+ Array curve containers store a fixed number of ` n ` elements where ` n ` is determined at compile-time.
262+ They are the curve equivalent to the ` std::array ` C++ containers. In comparison to ` std::array ` each
263+ element in the array curve container is tracked individually over time. Hence, each index is associated
264+ with its own ` KeyframeContainer ` whose keyframes can be updated independent from other indices.
265+ When a value is added to the ` Array ` curve at a given index, a new keyframe is added to the respective
266+ ` KeyframeContainer ` stored at that index.
262267
263268** Read**
264269
265270Read operations retrieve values for a specific point in time.
266271
267- | Method | Description |
268- | ----------------- | --------------------------------------- ---------------------------------|
269- | ` get(t, i) ` | Get value of index ` i ` at time <= ` t ` |
270- | ` get(t) ` | Get array of keyframes at time <= ` t ` |
271- | ` size() ` | Get size of the array |
272- | ` frame(t, i) ` | Get the time and value of the keyframe at index ` i ` with time <= ` t ` |
273- | ` next_frame(t, i) ` | Get the time and value of the first keyframe at index ` i ` with time > ` t ` |
272+ | Method | Description |
273+ | ------------------ | ------------------------------------------------------------------------ |
274+ | ` get(t, i) ` | Get value of element at index ` i ` at time <= ` t ` |
275+ | ` get(t) ` | Get array of values at time <= ` t ` |
276+ | ` size() ` | Get the number of elements in the array |
277+ | ` frame(t, i) ` | Get the previous keyframe ( time and value) at index ` i ` before or at ` t ` |
278+ | ` next_frame(t, i) ` | Get the next keyframe ( time and value) at index ` i ` after ` t ` |
274279
275280** Modify**
276281
277282Modify operations insert values for a specific point in time.
278283
279- | Method | Description |
280- | ------------------------- | ------------------------------------------------------------------------------------------|
281- | ` set_insert(t, i, value) ` | Insert a new keyframe(` t ` , ` value ` ) at index ` i ` |
282- | ` set_last(t, i, value) ` | Insert a new keyframe(` t ` , ` value ` ) at index ` i ` ; delete all keyframes after time ` t ` |
283- | ` set_replace(t, i, value) ` | Insert a new keyframe(` t ` , ` value ` ) at index ` i ` ; remove all other keyframes with time ` t ` |
284+ | Method | Description |
285+ | -------------------------- | ------------------------------------------------------------------------------------------ |
286+ | ` set_insert(t, i, value) ` | Insert a new keyframe(` t ` , ` value ` ) at index ` i ` |
287+ | ` set_last(t, i, value) ` | Insert a new keyframe(` t ` , ` value ` ) at index ` i ` ; delete all keyframes after time ` t ` |
288+ | ` set_replace(t, i, value) ` | Insert a new keyframe(` t ` , ` value ` ) at index ` i ` ; remove all other keyframes with time ` t ` |
284289
285290** Copy**
291+
286292| Method | Description |
287- | ---------------- | ------------------------------------------------------------------------------------------------ |
293+ | ---------------- | ------------------------------------------------------------------------------------------------ |
288294| ` sync(Curve, t) ` | Replace all keyframes from self after time ` t ` with keyframes from source ` Curve ` after time ` t ` |
0 commit comments