Calculate Paint Line length

Viewed 194

I had a question, I just can't find the answer. There is an onTouchEvent(event: MotionEvent) and inside I draw a line using Paint. I can't figure out how to get the length of the paint line and find out the refraction, or rather how many degrees like on a picture.

enter image description here

1 Answers

Take a look at PathMeasure to get length/points along an arc. Here is an example of an approach you could use.

As for the degrees of an arc, you will need to decide which points to use to produce the tangents you want to compute the value of the angle - different tangents may produce different values.

Related