src/kalidokit/utils/vector.js
//find roll pitch yaw of plane formed by 3 points
find roll pitch yaw of plane formed by 3 points
find roll pitch yaw of plane formed by 3 points
static rollPitchYaw(a, b, c) {
        if (!c) {
            return new Vector(
                Vector.normalizeAngle(Vector.find2DAngle(a.z, a.y, b.z, b.y)),
                Vector.normalizeAngle(Vector.find2DAngle(a.z, a.x, b.z, b.x)),
                Vector.normalizeAngle(Vector.find2DAngle(a.x, a.y, b.x, b.y))
            );
        }
        let qb = b.subtract(a);
        let qc = c.subtract(a);
        let n = qb.cross(qc);
        let unitZ = n.unit();
        let unitX = qb.unit();
        let unitY = unitZ.cross(unitX);
        let beta = Math.asin(unitZ.x) || 0;
        let alpha = Math.atan2(-unitZ.y, unitZ.z) || 0;
        let gamma = Math.atan2(-unitY.x, unitX.x) || 0;
        return new Vector(Vector.normalizeAngle(alpha), Vector.normalizeAngle(beta), Vector.normalizeAngle(gamma));
    }
static rollPitchYaw ( a , b , c ) { if ( ! c ) { return new Vector ( Vector . normalizeAngle ( Vector . find2DAngle ( a . z , a . y , b . z , b . y ) ) , Vector . normalizeAngle ( Vector . find2DAngle ( a . z , a . x , b . z , b . x ) ) , Vector . normalizeAngle ( Vector . find2DAngle ( a . x , a . y , b . x , b . y ) ) ) ; } let qb = b . subtract ( a ) ; let qc = c . subtract ( a ) ; let n = qb . cross ( qc ) ; let unitZ = n . unit ( ) ; let unitX = qb . unit ( ) ; let unitY = unitZ . cross ( unitX ) ; let beta = Math . asin ( unitZ . x ) || 0 ; let alpha = Math . atan2 ( - unitZ . y , unitZ . z ) || 0 ; let gamma = Math . atan2 ( - unitY . x , unitX . x ) || 0 ; return new Vector ( Vector . normalizeAngle ( alpha ) , Vector . normalizeAngle ( beta ) , Vector . normalizeAngle ( gamma ) ) ; }
find roll pitch yaw of plane formed by 3 points
find roll pitch yaw of plane formed by 3 points