build/module/lib/geometries/dataFromVectorN.js
/**
 * This seems a bit hacky. Maybe we need an abstraction that recognizes the existence of
 * geometric numbers for vertex attributes, but allows us to extract the vector (grade-1) part?
 * @hidden
 */
This seems a bit hacky. Maybe we need an abstraction that recognizes the existence of
geometric numbers for vertex attributes, but allows us to extract the vector (grade-1) part.
@hidden
This seems a bit hacky . Maybe we need an abstraction that recognizes the existence of geometric numbers for vertex attributes but allows us to extract the vector ( grade - 1 ) part . @hidden
function dataFromVectorN(source) {
    if (source instanceof Geometric3) {
        var g3 = source;
        return [g3.x, g3.y, g3.z];
    }
    else if (source instanceof Geometric2) {
        var g2 = source;
        return [g2.x, g2.y];
    }
    else if (source instanceof Vector3) {
        var v3 = source;
        return [v3.x, v3.y, v3.z];
    }
    else if (source instanceof Vector2) {
        var v2 = source;
        return [v2.x, v2.y];
    }
    else {
        return source.toArray();
    }
}
function dataFromVectorN ( source ) { if ( source instanceof Geometric3 ) { var g3 = source ; return [ g3 . x , g3 . y , g3 . z ] ; } else if ( source instanceof Geometric2 ) { var g2 = source ; return [ g2 . x , g2 . y ] ; } else if ( source instanceof Vector3 ) { var v3 = source ; return [ v3 . x , v3 . y , v3 . z ] ; } else if ( source instanceof Vector2 ) { var v2 = source ; return [ v2 . x , v2 . y ] ; } else { return source . toArray ( ) ; } }
This seems a bit hacky.
This seems a bit hacky .
// console.warn("dataFromVectorN(source: VectorN<number>): number[], source.length => " + source.length)