objective c - Drop a pin to location on the line between 2 points in MapView iOS -
objective c - Drop a pin to location on the line between 2 points in MapView iOS -
i have problem: have a store location , 1 pin annotation radius = 2km. when user move pin annotation exceed radius 2km store location. want jump pin on line store location , old pin annotation in order circle radius cover store location. how can that? please give me advice. much.
keeping store location covered means constraining pin within 2km circle around around store. if store @ (0,0) , point @ (dx,dy), find distance: r=sqrt(dx * dx + dy * dy).
now if r>2km, find factor scale distance by: s = 2km/r.
now move point (s * dx, s * dy), on 2km circle around store, store on 2km circle around pin.
ios objective-c annotations location mapkit
Comments
Post a Comment