Hi
I'm tring to convert the following 3 methods from java-actionscript to Objective C.
Part of my confusion I think is not knowing what Number types, primitives I should be using. ie in actionscript you have only Number, int, and uint. These are the 3 functions I am trying to convert
public function normalize(value:Number, minimum:Number, maximum:Number):Number
{
return (value - minimum) / (maximum - minimum);
}
public function interpolate(normValue:Number, minimum:Number, maximum:Number):Number
{
return minimum + (maximum - minimum) * normValue;
}
public function map(value:Number, min1:Number, max1:Number, min2:Number, max2:Number):Number
{
return interpolate( normalize(value, min1, max1), min2, max2);
}
This is what I have so far
-(float) normalize:(float*)value
withMinimumValue:(float*)minimum
withMaximumValue:(float*)maximum
{
return (value - minimum) / (maximum - minimum);
}
-(float) interpolate:(float*)normValue
withMinimumValue:(float*)minimum
withMaximumValue:(float*)maximum
{
return minimum + (maximum - minimum) * normValue;
}
-(float) map:(float*)value
withMinimumValue1:(float*)min1
withMaximumValue1:(float*)max1
withMinimumValue2:(float*)min2
withMaximumValue2:(float*)max2
{
return interpolate( normalize(value, min1, max1), min2, max2);
}