Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I dont know how to get the angle of the camera, but I do have an app that will calculate the tilt of the phone based on the Yaw/Roll/Pitch.</p> <pre><code>namespace PhoneUtilities.Utilities { public class AccelerometerMath { public static double RadianToDegree(double radians) { return radians * (180 / Math.PI); } public static double Pitch(AccelerometerReading e) { return RadianToDegree((Math.Atan(e.Acceleration.X / Math.Sqrt(Math.Pow(e.Acceleration.Y, 2) + Math.Pow(e.Acceleration.Z, 2))))); } public static double Roll(AccelerometerReading e) { return RadianToDegree((Math.Atan(e.Acceleration.Y / Math.Sqrt(Math.Pow(e.Acceleration.X, 2) + Math.Pow(e.Acceleration.Z, 2))))); } public static double Yaw(AccelerometerReading e) { return RadianToDegree((Math.Atan(Math.Sqrt(Math.Pow(e.Acceleration.X, 2) + Math.Pow(e.Acceleration.Y, 2)) / e.Acceleration.Z))); } } } </code></pre> <p>The calculations were able to get me the angle of the tilt, here is an example I use for some trig calculation Cos(angle) = adj/hyp:</p> <pre><code>private double CalcUpAdj(AccelerometerReading reading) { double angle = PhoneUtilities.Utilities.AccelerometerMath.Yaw(reading); //Get the angleNeeded for calculation double angleNeeded = Math.Abs(angle); double adj = CalcAdj(angleNeeded); tbAngle.Text = String.Format("{0:0.00}", angleNeeded) + (char)176; textBlockAdj.Text = adj.ToString(); return adj; } private double CalcAdj(double angleNeeded) { double number; if (double.TryParse(tbHyp.Text, out number)) { double hyp = number; double adj = Math.Cos(Math.PI * angleNeeded / 180) * hyp; tbAngle.Text = String.Format("{0:0.00}", angleNeeded) + (char)176; textBlockAdj.Text = adj.ToString(); return adj; } return 0; } </code></pre> <p>I dont know if this will help you with your camera, but I imagine if you knew the dimensions of the screen you could calculate the angle based on the tilt of the phone. Hopefully you find this helpful.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload