当前位置: 首页>>代码示例>>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;未经允许,请勿转载。