Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compass position report #59

Merged
merged 1 commit into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}