Measure Length Or Distance With An iPhone
Ever wonder how measurements of length of an object like a wall, or a distance can be performed using an iPhone. There are few apps like MagicPlan, and Theodolite that can perform these measurements. All it takes is relatively simple trigonometry relationships with 4 measurements, three angles measurements that an iPhone can perform, and one external length measurement that the user must make, that is, the height of the iPhone above the horizontal ground. Of course the apps access data from the internal sensors such as the x, y, z axis accelerometers and magnetometers built-in to the iPhone to calculate the three angles. The calculations of the angles are also based on simple trigonometry relationships from the accelerometer and magnetometer data.
Once the three angles are calculated, we show the trigonometry relationships that are needed to calculate the desired length or distance. Will not elaborate with explanations, will let a "picture speak a thousand words".
H = iPhone height above the Horizontal Ground Plane
α, β = Tilt angles to corners measured from the horizontal plane
θ1 = Angle between the tilts to corners (from one corner to other corner)
θ2 = Angle from one corner to the other corner in the horizontal plane
h1 = distance From iPhone to corner
h2 = distance from iPhone to another corner
a = horizontal distance to a corner
b = horizontal distance to another cornerL = length of wall to be measured
Wall Length “L” depends only on “H” (height of iPhone above the Horizontal Ground Plane), and 3 angles that can be measured. Vice versa, “H” depends only on “L” and 3 angles.
Therefore: To calibrate just measure “H”. Or use actual length “L” of 2 or 3 walls, then solve for “H” for each wall and take an average. Thereafter, hold iPhone at the same height “H” above ground to measure the length “L” of new walls.
If you change the height of the iPhone above the ground, you must recalibrate “H” to obtain more accurate results.
Warning: The corners to be measured must be on the Horizontal Ground Plane. Otherwise, H becomes unknown and results will be inaccurate.