I was wondering if someone was managed to identify vertical planes ahead of the device in realtime using the ARCore SDK.
I was managed to achieve decent result by defining a wall using a line equation:
z = Multiplier * x + Constant (For every y)
by "for every y" comment I meant that I ignore the y axis(looking at the wall from above as in 2d mapping of a room) in order to calculate a line that defines the wall.
the Multiplier is the rotation between the points:
let angleDeg = Float((360 - angle + 360) % 360) * Float.pi / 180.0;
The all computation is:
let angle: Int = Int((atan2(pointA.z - pointB.z, pointA.x - pointB.x) * 180) / Float.pi) % 360
yRotation = Float((360 - angle + 360) % 360) * Float.pi / 180.0
if pointA.x == pointB.x {
multiplier = Float.infinity
} else {
multiplier = (pointA.z - pointB.z) / (pointA.x - pointB.x)
}
constant = pointA.z - multiplier * pointA.x
}
Now I trigger that computation while the user is walking around and samples many point cloud's points.
The results are good but not as accurate as the horizontal plane detection of the ARCore.