Android point direction with 2 locations -


i'm coding application on android , need point direction, explaination, have position fixed , position of smartphone (the 2 in longitude latitude) , want point arrow direction between two. searched hell, have compass works , tried change pointing direction changing north direction getrotationmatrix stuff after loosing brain trying don't know xd yeah need ideas , hints.

here's code in case (i past onsensorchanged func rest basic initialisations)

@override public void onsensorchanged(sensorevent event) {      if (event.sensor == maccelerometer) {         system.arraycopy(event.values, 0, mlastaccelerometer, 0, event.values.length);         mlastaccelerometerset = true;     } else if (event.sensor == mmagnetometer) {         system.arraycopy(event.values, 0, mlastmagnetometer, 0, event.values.length);         mlastmagnetometerset = true;     }     if (mlastaccelerometerset && mlastmagnetometerset) {         sensormanager.getrotationmatrix(mr, null, mlastaccelerometer, mlastmagnetometer);         sensormanager.getorientation(mr, morientation);         float azimuthinradians = morientation[0];         float azimuthindegress = (float)(math.todegrees(azimuthinradians)+360)%360;         rotateanimation ra = new rotateanimation(                 mcurrentdegree,                 -azimuthindegress,                 animation.relative_to_self, 0.5f,                 animation.relative_to_self,                 0.5f);          ra.setduration(250);          ra.setfillafter(true);          mpointer.startanimation(ra);         mcurrentdegree = -azimuthindegress;     } } 

ok managed something. took position, fixed location , third location exact same same longitude , latitude of 90. have 2 vectors 1 pointing north , 1 on straight line our location , fixed location. calculate angle between these vectors , add angle rotation animation. don't think solution didn't find else on forums post answer ^^.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -