gore-and-ash-1.1.0.1: Core of FRP game engine called Gore&Ash

Copyright(c) 2013 Ertugrul Soeylemez
LicenseBSD3
MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone
LanguageHaskell2010

FRP.Netwire.Analyze

Contents

Description

 

Synopsis

Linear graphs

lAvg Source

Arguments

:: (Fractional a, Fractional t, HasTime t s) 
=> t

Interval size.

-> Wire s e m a a 

Calculate the average of the signal over the given interval (from now). This is done by calculating the integral of the corresponding linearly interpolated graph and dividing it by the interval length. See linAvg for details.

Linear interpolation can be slow. If you don't need it, you can use the staircase variant sAvg.

Example: lAvg 2

  • Complexity: O(s) space, O(s) time wrt number of samples in the interval.
  • Depends: now.

lGraph Source

Arguments

:: (Fractional a, Fractional t, HasTime t s) 
=> [t]

Data points to produce.

-> Wire s e m a [a] 

Produce a linearly interpolated graph for the given points in time, where the magnitudes of the points are distances from now.

Linear interpolation can be slow. If you don't need it, you can use the faster staircase variant sGraph.

Example: lGraph [0, 1, 2] will output the interpolated inputs at now, one second before now and two seconds before now.

  • Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
  • Depends: now.

lGraphN Source

Arguments

:: (Fractional a, Fractional t, HasTime t s) 
=> t

Interval to graph from now.

-> Int

Number of data points to produce.

-> Wire s e m a [a] 

Graph the given interval from now with the given number of evenly distributed points in time. Convenience interface to lGraph.

Linear interpolation can be slow. If you don't need it, you can use the faster staircase variant sGraphN.

  • Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
  • Depends: now.

Staircase graphs

sAvg Source

Arguments

:: (Fractional a, Fractional t, HasTime t s) 
=> t

Interval size.

-> Wire s e m a a 

Calculate the average of the signal over the given interval (from now). This is done by calculating the integral of the corresponding staircase graph and dividing it by the interval length. See scAvg for details.

See also lAvg.

Example: sAvg 2

  • Complexity: O(s) space, O(s) time wrt number of samples in the interval.
  • Depends: now.

sGraph Source

Arguments

:: (Fractional t, HasTime t s) 
=> [t]

Data points to produce.

-> Wire s e m a [a] 

Produce a staircase graph for the given points in time, where the magnitudes of the points are distances from now.

See also lGraph.

Example: sGraph [0, 1, 2] will output the inputs at now, one second before now and two seconds before now.

  • Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
  • Depends: now.

sGraphN Source

Arguments

:: (Fractional t, HasTime t s) 
=> t

Interval to graph from now.

-> Int

Number of data points to produce.

-> Wire s e m a [a] 

Graph the given interval from now with the given number of evenly distributed points in time. Convenience interface to sGraph.

See also lGraphN.

  • Complexity: O(s) space, O(n * log s) time, where s = number of samples in the interval, n = number of requested data points.
  • Depends: now.

Peaks

highPeak :: Ord a => Wire s e m a a Source

High peak.

  • Depends: now.

highPeakBy :: (a -> a -> Ordering) -> Wire s e m a a Source

High peak with respect to the given comparison function.

  • Depends: now.

lowPeak :: Ord a => Wire s e m a a Source

Low peak.

  • Depends: now.

lowPeakBy :: (a -> a -> Ordering) -> Wire s e m a a Source

Low peak with respect to the given comparison function.

  • Depends: now.

Debug

avgFps Source

Arguments

:: (RealFloat b, HasTime t s) 
=> Int

Number of samples.

-> Wire s e m a b 

Average framerate over the last given number of samples. One important thing to note is that the value of this wire will generally disagree with sAvg composed with framerate. This is expected, because this wire simply calculates the arithmetic mean, whereas sAvg will actually integrate the framerate graph.

Note: This wire is for debugging purposes only, because it exposes discrete time. Do not taint your application with discrete time.

  • Complexity: O(n) time and space wrt number of samples.

framerate :: (Eq b, Fractional b, HasTime t s, Monoid e) => Wire s e m a b Source

Current framerate.

Note: This wire is for debugging purposes only, because it exposes discrete time. Do not taint your application with discrete time.

  • Inhibits: when the clock stopped ticking.