1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How can I transform the points into a fixed form, regardless of their rotation?

Discussão em 'Python' iniciado por Stack, Outubro 5, 2024 às 10:12.

  1. Stack

    Stack Membro Participativo

    We have several points in 3D space. Two of these points lie exactly on the Y-axis. The problem is that the points may have been rotated. Now, how can I transform the points, regardless of their rotation, into a fixed form?

    In other words, regardless of the direction in which it has been rotated, it should be transformed into a standard and fixed form.


    I would really appreciate your help.

    points = np.array([[0.,0.,0.]
    [-0.075135,0.538134,-0.323848]
    [-0.,0.697979,-0.]
    [-0.105474,0.11303,-0.087109]
    [-0.169698,0.267493,-0.465798]])

    # points = rotate_points_around_point(points, 180, "y", points[0])

    points = np.array([[0.,0.,0.]
    [ 0.075135,0.538134,0.323848]
    [-0.,0.697979,0.]
    [ 0.105474,0.11303,0.087109]
    [ 0.169698,0.267493,0.465798]])}

    # points = rotate_points_around_point(points, 20, "y", points[0])

    points = np.array([[0.,0.,0.]
    [ 0.181367,0.538134,0.27862]
    [-0.,0.697979,0.]
    [ 0.128906,0.11303,0.045782]
    [ 0.318777,0.267493,0.379667]])


    If the points are input into a function with any rotation, the output should be in a fixed form. To give another example, if we imagine a car, the wheels of the car should always be on the ground. The standard form of the car is such that the wheels are on the ground.

    [​IMG]

    [​IMG]

    This is just an example with 5 points. There may be 100 points. The important thing is that, with any rotation around the Y-axis, it should be transformed into a fixed form.

    What came to my mind is to check which plane the points are closest to. For example, if they are closer to the XZ plane, rotate the points so that they have the least distance from that plane. This idea might not be correct, though.

    For example, regardless of the rotation of the input, the output should be transformed as follows:

    [[ 0. 0. 0. ]
    [ 0.075135 0.538134 0.323848]
    [-0. 0.697979 0. ]
    [ 0.105474 0.11303 0.087109]
    [ 0.169698 0.267493 0.465798]]


    I value the insights and guidance you provide.

    Continue reading...

Compartilhe esta Página