@@ -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
@@ -198,7 +199,7 @@ e.g. angles between 0 and 360 degrees.
198199### Container
199200
200201Container curves are intended for storing changes to collections and containers.
201- The currently supported containers are ` Queue ` and ` UnorderedMap ` .
202+ The currently supported containers are ` Queue ` , ` UnorderedMap ` and ` Array ` .
202203
203204The most important distinction between regular C++ containers and curve containers
204205is that curve containers track the * lifespan* of each element, i.e. their insertion time,
@@ -253,3 +254,41 @@ Unordered map curve containers store key-value pairs while additionally keeping
253254track of element insertion time. Requests for a key ` k ` at time ` t ` will return the value
254255of ` k ` at that time. The unordered map can also be iterated over for a specific time ` t ` which
255256allows access to all key-value pairs that were in the map at time ` t ` .
257+
258+
259+ #### Array
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.
267+
268+ ** Read**
269+
270+ Read operations retrieve values for a specific point in time.
271+
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 ` |
279+
280+ ** Modify**
281+
282+ Modify operations insert values for a specific point in time.
283+
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 ` |
289+
290+ ** Copy**
291+
292+ | Method | Description |
293+ | ---------------- | ------------------------------------------------------------------------------------------------ |
294+ | ` sync(Curve, t) ` | Replace all keyframes from self after time ` t ` with keyframes from source ` Curve ` after time ` t ` |
0 commit comments