Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

How to delete points within a line?

$
0
0

input data - https://pastebin.com/uSSvwngP

input data format example:

profile_points_raw = [(1000, 1000, 0), (1000, 500, 0), (1000, 1500, 0)]river_profile_point = [(1029.4445441834994, 944.3, 0), (1040.0288661575282, 944.3, 0)] 

I have a profile_points_raw line and river_profile_points from the river_profile_points list.

My code inserts the points from the river_profile_points list into the profile_points_raw line between tuples with coordinates nearest to the points. I then draw a triangle, creating points A1, B, and C1.

The goal is to remove all points within a1 and c1 except point B, if there are any such points

CURRENT RESULT

enter image description here

DESIRED RESULT

enter image description here

CODE:

new_profile_points = []for i in range(len(profile_points_raw)-1):    new_profile_points.append(profile_points_raw[i])    for point in river_profile_point:        if profile_points_raw[i][0] < point[0] < profile_points_raw[i+1][0]:            A = profile_points_raw[i]            C = profile_points_raw[i+1]            B = point            A1 = (B[0] - 1, A[1], A[2])            C1 = (B[0] + 1, C[1], C[2])            new_profile_points.extend([A1, B, C1])new_profile_points.append(profile_points_raw[-1])

Viewing all articles
Browse latest Browse all 14215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>