Skip to content

Commit

Permalink
Merge pull request #59 from NYTimes/fix-compass-report
Browse files Browse the repository at this point in the history
fix compass position report
  • Loading branch information
Veronique committed Jul 20, 2017
2 parents ed29537 + 8117d31 commit f9bd0df
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sources/NYT360CameraController.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (void)stopMotionUpdates {
#pragma mark - Compass Angle

- (float)compassAngle {
return NYT360CompassAngleForEulerAngles(self.pointOfView.eulerAngles, NYT360EulerAngleCalculationDefaultReferenceCompassAngle);
return NYT360CompassAngleForEulerAngles(self.pointOfView.eulerAngles);
}

#pragma mark - Camera Control
Expand Down
2 changes: 1 addition & 1 deletion Sources/NYT360EulerAngleCalculations.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ CGFloat NYT360OptimalYFovForViewSize(CGSize viewSize);
*
* Input values in excess of one rotation will be mapped to an equivalent value within the range of plus or minus one radian, such that output values will exceed one rotation. Input values equal (or very very close to equal) to a multiple of one radian (positive or negative) will be mapped to 0.
*/
float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles, float referenceAngle);
float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles);
6 changes: 3 additions & 3 deletions Sources/NYT360EulerAngleCalculations.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#pragma mark - Constants

CGFloat const NYT360EulerAngleCalculationNoiseThresholdDefault = 0.12;
float const NYT360EulerAngleCalculationDefaultReferenceCompassAngle = 0;
float const NYT360EulerAngleCalculationDefaultReferenceCompassAngle = 3.14;

#pragma mark - Inline Functions

Expand Down Expand Up @@ -155,6 +155,6 @@ CGFloat NYT360OptimalYFovForViewSize(CGSize viewSize) {
return yFov;
}

float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles, float referenceAngle) {
return NYT360UnitRotationForCameraRotation((-1.0 * eulerAngles.y) + referenceAngle);
float NYT360CompassAngleForEulerAngles(SCNVector3 eulerAngles) {
return NYT360UnitRotationForCameraRotation((-1.0 * eulerAngles.y) + NYT360EulerAngleCalculationDefaultReferenceCompassAngle);
}

0 comments on commit f9bd0df

Please sign in to comment.