I have two lines. namely (x1,y1)
and (x2,y2)
. I need to calculate the distance between the points. see my code snippets below
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
x1= np.array([525468.80914272, 525468.70536016])
y1= np.array([175517.80433391, 175517.75493122])
x2= np.array([525468.81174, 525468.71252])
y2= np.array([175517.796305, 175517.74884 ])
Here is the code for the plot:
fig= go.Figure()
fig.add_trace(go.Scatter(x=x1, y=y1, name="point1"))
fig.add_trace(go.Scatter(x=x2, y=y2, name="point2"))
See the figure here
The black line is the distance I want to calculate
my expectations are: (0.008438554274975979, 0.0085878435595034274819)
question from:
https://stackoverflow.com/questions/65915301/how-to-calculate-the-distance-between-two-points-on-lines-in-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…