How to solve the area of 3D trajectory segment by Python?

you need to use Python to implement an algorithm to calculate the area surrounded by two tracks in three-dimensional space, as follows:

clipboard.png

,(x,y,t):

clipboard.png

but there is a problem with this, that is, how the sequence of points of the two tracks form a triangle. Here, I would like to ask you if there are any good methods or good suggestions, thank you! (Note: the number of point sequences of the two tracks may be different, that is, one track may have only 3 points, while the other track may have 5 points)

Mar.13,2021

I took a look. There is a regularity in your triangle construction. I use a pseudo code to represent two trajectories, and set the coordinates of each point as:

dot_nt = (x,y,z) -sharp nn in (1,2);tn in [0,n]

then for track 1, it can be formed:

[dot_10,dot_11,dot_12,...]

for track 2, it can be formed:

[dot_20,dot_21,dot_22,...]

then, you can see a

[dot_10,dot_20,dot_11],[dot_11,dot_21,dot_12],[dot_12,dot_22,dot_13],...

such a regular data, and then according to this law, you can use the program to form a triangle. If you think the train of thought is right, you can try to achieve it. I think this should be what it looks like

.

two points: the triangle is a, b take turns; the trajectory sequence may not be equal in length.

def find_triangle(a, b):
    -sharp 
    la, lb = len(a), len(b)
    if la > lb:
        a, b = b, a
        la, lb = lb, la
    -sharp ab    
    triangles = []
    for i in range(la - 1):
        triangles.append((b[i], a[i], b[i + 1]))
        triangles.append((a[i], b[i + 1], a[i + 1]))
    -sharp 
    more = b[la - 1:]
    for j in range(len(more) - 1):
        triangles.append((more[j], a[la - 1], more[j + 1]))
    return triangles
>>> S1 = ['a1', 'a2', 'a3']
>>> S2 = ['b1', 'b2', 'b3', 'b4', 'b5']
>>> print(find_triangle(S1, S2))
[('b1', 'a1', 'b2'), ('a1', 'b2', 'a2'), ('b2', 'a2', 'b3'), ('a2', 'b3', 'a3'), ('b3', 'a3', 'b4'), ('b4', 'a3', 'b5')]
>>> print(find_triangle(S2, S1))
[('b1', 'a1', 'b2'), ('a1', 'b2', 'a2'), ('b2', 'a2', 'b3'), ('a2', 'b3', 'a3'), ('b3', 'a3', 'b4'), ('b4', 'a3', 'b5')]

Total area = area of all triangles with black background + area of all triangles with red background
focus on three points of triangles
Black dots are numbered as b0~b4
Red dots are numbered as r0~r4
Triangles with black bottoms are b0b1r0Magne. B 3 b 4 r 3
the three points of the red background triangle are r 0 r 1 r 1 Magi. R3, R4, R4
come up with the rest and then continue to think about it

.

part of the code can be written like this

class Point:

__slots__=('x','y','z')
def __init__(self,x,y,z):
    self.x,self.y,self.z=x,y,z

red_point,black_point=list (range (4)), list (range (4))
blacktria= [(for iMagne1) for iLigue j in zip (black_point [: 4], red_point [: 4])
redtria= [(jGram1 for iMagn1) for iLING j in zip (black_point [: 4], red_point [: 4])
print (blacktria,'n',redtria)

The contents of

blacktria and redtria are as follows:
[(0,1,0), (1,2,1), (2,3,2), (3,4,3)]
[(0,1,1), (1,2,2), (2,3,3), (3,4,4)]

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5f598-45812.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5f598-45812.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?