當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript numeric.dot函數代碼示例

本文整理匯總了TypeScript中numeric.dot函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript dot函數的具體用法?TypeScript dot怎麽用?TypeScript dot使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了dot函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 polygon.forEach(function (point) {
     // rotate with cycle mat
     var p = numeric.dot(mm, point)
     // rotate point
     var rotp = numeric.dot(U, p)
     point[0] = rotp[0]
     point[1] = rotp[1]
     point[2] = rotp[2]
 })
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:9,代碼來源:bbgenerator.ts

示例2: distanceToPlane

/**
 * Computes distance from ray's origin to the plane
 *
 * @param ray
 * @returns zero if ray is coplanar with plane, null if something strange
 * happened, scalar value representing distance from ray's origin to the
 * plane if everything is OK
 */
function distanceToPlane(ray: Ray) {
    var denominator = numeric.dot(slicingPlaneNormal, ray.direction)
    if (denominator === 0) {
        // ray is coplanar, return 0
        return distanceToPoint(ray.origin) === 0 ? 0 : null
    }

    var t = -(numeric.dot(ray.origin, slicingPlaneNormal)) / denominator
    return t >= 0 ? t : null
}
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:18,代碼來源:bbgenerator.ts

示例3: polyListForBeachBall

function polyListForBeachBall(lambda: number[], patternRotation: number[], U: number[][], lonstep: number = 5, latstep: number = 5) {
    // clone lambda
    var lambdaClone = lambda.slice(0)
    var cycleDot = numeric.dot(cycleMat(lambda), lambdaClone)
    var polyList = basicPolygons(range(0, 360, lonstep), range(0, 90, latstep))
    var polys = polyListForBeachball0(cycleDot, polyList)
    var coloredPolys: Array<{ vertices: number[][], compressional: boolean }> = []
    polys.forEach(function (polygon) {
        var mm = numeric.transpose(cycleMat(lambda))
        polygon.vertices.forEach(function (point) {
            // rotate with cycle mat
            var p = numeric.dot(mm, point)
            // rotate point
            var rotp = numeric.dot(U, p)
            point[0] = rotp[0]
            point[1] = rotp[1]
            point[2] = rotp[2]
        })

        polygon.tesselatedPolygons.forEach(polygon => {
            polygon.forEach(function (point) {
                // rotate with cycle mat
                var p = numeric.dot(mm, point)
                // rotate point
                var rotp = numeric.dot(U, p)
                point[0] = rotp[0]
                point[1] = rotp[1]
                point[2] = rotp[2]
            })
        })

        let xmean = 0
        let ymean = 0
        let zmean = 0
        polygon.vertices.forEach(function (point) {
            xmean += point[0]
            ymean += point[1]
            zmean += point[2]
        })
        xmean /= polygon.vertices.length
        ymean /= polygon.vertices.length
        zmean /= polygon.vertices.length

        let isCompressional = isColored([xmean, ymean, zmean], patternRotation)
        let tesselated =polygon.tesselatedPolygons.map(polygon => {
            return {
                vertices: polygon,
                compressional: isCompressional
            }
        })

        tesselated.forEach(polygon => coloredPolys.push(polygon))

    })
    return coloredPolys
}
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:56,代碼來源:bbgenerator.ts

示例4: sds2slip

/**
 * Converts strike/dip/slip to slip vector
 *
 * @param mt - moment tensor represented by object with strike/dip/slip
 * properties
 * @returns slip vector in coordinate system where x points east,
 * y points north, z points up
 */
function sds2slip(mt: { strike: number, dip: number, slip: number }) {
    // compute x,y,z in coordinates system where x points west,
    // y points north and z point up
    var x = bbmath.cosd(mt.slip) * bbmath.cosd(mt.strike) + bbmath.sind(mt.slip) * bbmath.cosd(mt.dip) * bbmath.sind(mt.strike)
    var y = -bbmath.cosd(mt.slip) * bbmath.sind(mt.strike) + bbmath.sind(mt.slip) * bbmath.cosd(mt.dip) * bbmath.cosd(mt.strike)
    var z = bbmath.sind(mt.slip) * bbmath.sind(mt.dip)
    // compute vector position in coordinate system where x points east,
    // y points north, z points up
    return numeric.dot(ZROT, [x, y, z])
}
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:18,代碼來源:bbgenerator.ts

示例5: mt_undiag

/**
 * De-diagonalizes moment tensor into Harvard orientation using eigenvectors in
 * vec
 * @param mt - moment tensor matrix
 * @param vec - eigenvectors
 */
function mt_undiag(mt: number[][], vec: number[][]) {
    mt = numeric.dot(vec, numeric.dot(mt, numeric.transpose(vec)))
    // floating point asymmetry fix
    mt = numeric.add(mt, numeric.transpose(numeric.clone(mt)))
    return mt.map(row => row.map(item => item / 2))
}
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:12,代碼來源:bbutils.ts

示例6: patternRotationMatrix

/**
 * Returns rotation matrix for beachball pattern - changes position
 * of colored polygons in beachball
 *
 * @param U rotation matrix consisting of eigenvectors which are columns
 * of rotation matrix. Matrix must be orthonormal, dot(u2,slip) must be
 * equal to 0 (90 degrees between u2 and slip vector).
 *
 * @param lambda vector with moment tensor eigenvalues
 * @returns rotation matrix for beachball pattern - changes position
 * of colored polygons in beachball
 *
 */
function patternRotationMatrix(U: number[][], lambda: number[]) {
    // matrix = dot(dot(U, diag(lambda)),transposed(U)
    return numeric.dot(numeric.dot(U, numeric.diag(lambda)), numeric.transpose(U))
}
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:17,代碼來源:bbgenerator.ts

示例7: xyztp

 return polygon.map(function (point) {
     var point3D = xyztp(point[0], point[1])
     point3D = numeric.dot(zref, point3D)
     return point3D
 })
開發者ID:timofeevda,項目名稱:seismic-beachballs,代碼行數:5,代碼來源:bbgenerator.ts


注:本文中的numeric.dot函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。