python - test if two segments are roughly collinear using numpy
I want to test if two segments are roughly collinear using numpy.cross
. I have the coordinates in meters of the segments.
import numpy as np
segment_A_x1 = -8020537.5158307655
segment_A_y1 = 5674541.918222183
segment_A_x2 = -8020547.42095263
segment_A_y2 = 5674500.781350276
segment_B_x1 = -8020556.569040865
segment_B_y1 = 5674462.788207927
segment_B_x2 = -8020594.740831952
segment_B_y2 = 5674328.095911447
a = np.array([[segment_A_x1, segment_A_y1], [segment_A_x2, segment_A_y2]])
b = np.array([[segment_B_x1, segment_B_y1], [segment_B_x2, segment_B_y2]])
crossproduct = np.cross(a, b)
>>>array([7.42783487e+08, 1.65354844e+09])
The crossproduct
values are pretty high even if I would say those two segments are roughly collinear. Why?
How can I determine if the segments are colinear with the crossproduct
result?
Is there a possibility of using a tolerance in meters to tell if the segments are roughly collinear?
from Recent Questions - Stack Overflow https://ift.tt/3nEVhpb
https://ift.tt/eA8V8J
Comments
Post a Comment