
# ifndef PM_GROWTH_CURVE_H
# define PM_GROWTH_CURVE_H

typedef struct
{
    psVector *radius;
    psVector *apMag;
    psF32 refRadius;
    psF32 maxRadius;
    psF32 fitMag;
    psF32 apRef;   // apMag[refRadius]
    psF32 apLoss;  // fitMag - apRef
}
pmGrowthCurve;

pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius);
int psVectorBracket (psVector *index, psF32 key, bool above);
psF32 psVectorInterpolate (psVector *index, psVector *value, psF32 key);
psF32 pmGrowthCurveCorrect (pmGrowthCurve *growth, psF32 radius);

// XXX psVectorBracket,Interpolate should be put in pslib

# endif /* PM_GROWTH_CURVE_H */
