three.js中makeBasis和extractBasis的区别

three.js中makeBasis和extractBasis的区别,three.js,Three.js,从three.js文档: 这两种方法有什么区别 makeBasis看起来有点奇怪。创建基础矩阵,然后返回当前矩阵?没有任何意义 通过查看Matrix4.js的源代码,您的问题的答案应该很清楚 extractBasis: function ( xAxis, yAxis, zAxis ) { var te = this.elements; xAxis.set( te[ 0 ], te[ 1 ], te[ 2 ] ); yAxis.set( te[ 4 ], te[ 5 ]

从three.js文档:

这两种方法有什么区别


makeBasis
看起来有点奇怪。创建基础矩阵,然后返回当前矩阵?没有任何意义

通过查看
Matrix4.js
的源代码,您的问题的答案应该很清楚

extractBasis: function ( xAxis, yAxis, zAxis ) {

    var te = this.elements;

    xAxis.set( te[ 0 ], te[ 1 ], te[ 2 ] );
    yAxis.set( te[ 4 ], te[ 5 ], te[ 6 ] );
    zAxis.set( te[ 8 ], te[ 9 ], te[ 10 ] );

    return this;

},

makeBasis: function ( xAxis, yAxis, zAxis ) {

    this.set(
        xAxis.x, yAxis.x, zAxis.x, 0,
        xAxis.y, yAxis.y, zAxis.y, 0,
        xAxis.z, yAxis.z, zAxis.z, 0,
        0,       0,       0,       1
    );

    return this;

},
3.js r.73

extractBasis: function ( xAxis, yAxis, zAxis ) {

    var te = this.elements;

    xAxis.set( te[ 0 ], te[ 1 ], te[ 2 ] );
    yAxis.set( te[ 4 ], te[ 5 ], te[ 6 ] );
    zAxis.set( te[ 8 ], te[ 9 ], te[ 10 ] );

    return this;

},

makeBasis: function ( xAxis, yAxis, zAxis ) {

    this.set(
        xAxis.x, yAxis.x, zAxis.x, 0,
        xAxis.y, yAxis.y, zAxis.y, 0,
        xAxis.z, yAxis.z, zAxis.z, 0,
        0,       0,       0,       1
    );

    return this;

},