3D point rotation algorithm

前端 未结 2 1224
南方客
南方客 2020-12-09 14:23

I\'m currently working on a JavaScript project which involves 3D point rotation. Using simple trigonometry, I have sketched my own 3D point rotation algorithm, but I have to

2条回答
  •  天命终不由人
    2020-12-09 14:53

    From wikipedia:

    If you multiply your points by each of these matrices they will be rotated by the amount you want.

    For example, if I want to rotate point [1, 0, 0] by 90° around the z axis (in the xy plane), sin(90) = 1 and cos(90) = 0 so you get this:

    | 0 -1  0 |   |1|   |0|
    | 1  0  0 | * |0| = |1|
    | 0  0  1 |   |0|   |0|
    

提交回复
热议问题