Is it possible to draw a line from Point A(where user touched first) and Point B(where user touched second) in android over a camera.
The user can touch first point and rotate his camera in other direction to tap second point.
I am using gyroscope
, accelerometer
and magnetometer
(Sensor Fusion) and I get x,y,z co-ordinates on touch.
But can we draw a 3D image on canvas where ever the user touches. Something similar to what MagicPlan
app is doing.
Thanks @chipopo but the real concern is, is it possible to actually draw a line >between two points given by gyroscope sensor.
Short answer,no. Gyroscope is a rate sensor, not a position sensor. You need to do math to get Points.
Since your in Android, I would recommend Orientation once you have this you need to decide on a radius that best fits your use case and also establish a reference orientation. Once you grab two orientations its up to you how to map shperical points to a 2d canvas.
One method I have used in the past is just plotting the delta pitch on Y and the delta heading on X, however you may need to think about what roll means to you in the context of what your app is trying to do.
You should probably use openGL, but you probably want a drawing library of some sort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With