I wanna draw a bezier curve between two location points. I can draw some curve following some answers on stackoverflow, but the point for bezier control points are placed wrong for some cases although I'm using the same simple formula for a bezier curve.
What I'm doing to put two bezier control points at right point, - make a line that is always supposed to cross the linear line between two locations orthogonally. - make two bezier control points(+ and -) that are in the middle of somewhere on the orthogonal line and each of two locations.
But for some cases(two locations are not located horizontal or vertical), the line doesn't go orthogonally like below since control point is not on the orthogonal line and I'm wondering if there is difference between latitudeDelta scale and longitudeDelta scale, which causes the problem, but not sure.
and my calculation looks like this.
const slopeOfLinearLine = (destination.latitude - origin.latitude) / (destination.longitude - origin.longitude)
const slopeOfOrthogonalLine = -1 / slopeOfLinearLine
const x = some x value to move right or left.
const y = slopeOfOrthogonalLine * x
const topOfTriangle = { latitude: midLinearLine.latitude + y, longitude: midLinearLine.longitude + x }
Please let me know anyone has any idea about this issue. Thanks!