Skip to content

Instantly share code, notes, and snippets.

@mrsidique
Created December 5, 2012 00:23
Show Gist options
  • Select an option

  • Save mrsidique/4210634 to your computer and use it in GitHub Desktop.

Select an option

Save mrsidique/4210634 to your computer and use it in GitHub Desktop.
NSDictionary *notificationDictionary = [notification object];
//Extract the values
float faceDirectionAngleValue = [[notificationDictionary valueForKey:@"faceDirectionValue"]floatValue];
float backStrokeRotationAngleValue = [[notificationDictionary valueForKey:@"backStrokeRotationAngleValue"]floatValue];
float forwardStrokeRotationAngleValue = [[notificationDictionary valueForKey:@"forwardStrokeRotationAngleValue"]floatValue];
//Use the absolute value for the display
float absoluteFaceDirectionAngleValue = fabsf(faceDirectionAngleValue);
float absoluteBackStrokeRotationAngleValue = fabsf(backStrokeRotationAngleValue);
float absoluteForwardStrokeRotationAngleValue = fabsf(forwardStrokeRotationAngleValue);
//Convert the value to a string
faceDirectionValueString = [NSString stringWithFormat:@"%.1f", absoluteFaceDirectionAngleValue];
backStrokeRotationValueString = [NSString stringWithFormat:@"%.1f", absoluteBackStrokeRotationAngleValue];
forwardStrokeRotationValueString = [NSString stringWithFormat:@"%.1f", absoluteForwardStrokeRotationAngleValue];
//Transform opening/closing for all of the angle values
PuttingMetricsValueTransformer* puttingMetricsValueTransformer = [[PuttingMetricsValueTransformer alloc] init];
faceDirectionOpeningString = [puttingMetricsValueTransformer transformFaceDirectionAngle:faceDirectionAngleValue];
backStrokeRotationOpeningString = [puttingMetricsValueTransformer transformBackStrokeRotationAngle:backStrokeRotationAngleValue];
forwardStrokeRotationOpeningString =[puttingMetricsValueTransformer transformBackStrokeRotationAngle:forwardStrokeRotationAngleValue];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment