当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vec3.fromValues方法代码示例

本文整理汇总了TypeScript中gl-matrix.vec3.fromValues方法的典型用法代码示例。如果您正苦于以下问题:TypeScript vec3.fromValues方法的具体用法?TypeScript vec3.fromValues怎么用?TypeScript vec3.fromValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gl-matrix.vec3的用法示例。


在下文中一共展示了vec3.fromValues方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 protected constructor(
   data: PointableData
 ) {
   this.direction = vec3.fromValues(...data.direction);
   this.handId = data.handId;
   this.id = data.id;
   this.length = data.length;
   this.stabilizedTipPosition = vec3.fromValues(...data.stabilizedTipPosition);
   this.timeVisible = data.timeVisible;
   this.tipPosition = vec3.fromValues(...data.tipPosition);
   this.tipVelocity = vec3.fromValues(...data.tipVelocity);
   this.touchDistance = data.touchDistance;
   this.touchZone = data.touchZone || 'none';
   this.width = data.width;
 }
开发者ID:alexeden,项目名称:dotstar-node,代码行数:15,代码来源:pointable.ts

示例2: denormalizePoint

 denormalizePoint(normalizedPosition: [ number, number, number ]): vec3 {
   return vec3.fromValues(
     (normalizedPosition[0] - 0.5) * this.size[0] + this.center[0],
     (normalizedPosition[1] - 0.5) * this.size[1] + this.center[1],
     (normalizedPosition[2] - 0.5) * this.size[2] + this.center[2]
   );
 }
开发者ID:alexeden,项目名称:dotstar-node,代码行数:7,代码来源:interaction-box.ts

示例3: createBoneDirection

 static createBoneDirection(basis: mat3): vec3 {
   return vec3.fromValues(
     basis[6] * -1,
     basis[7] * -1,
     basis[8] * -1
   );
 }
开发者ID:alexeden,项目名称:dotstar-node,代码行数:7,代码来源:bone.ts

示例4: at

 public at(scale: number) {
   const result = vec3.fromValues(
     this.direction.v[0],
     this.direction.v[1],
     this.direction.v[2]
   );
   vec3.scale(result, result, scale);
   vec3.add(result, result, this.origin.v);
 }
开发者ID:davidpaulrosser,项目名称:leonardo,代码行数:9,代码来源:Ray.ts

示例5: hexStringToRgb

 public hexStringToRgb(hex: string) {
   const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
   return result
     ? vec3.fromValues(
         parseInt(result[1], 16),
         parseInt(result[2], 16),
         parseInt(result[3], 16)
       )
     : null;
 }
开发者ID:davidpaulrosser,项目名称:leonardo,代码行数:10,代码来源:Color.ts

示例6: constructor

  private constructor(
    data: HandData
  ) {
    this.armBasis = data.armBasis.map(basis => vec3.fromValues(...basis)) as Triple<vec3>;
    this.armWidth = data.armWidth;
    this.confidence = data.confidence;
    this.direction = vec3.fromValues(...data.direction);
    this.elbow = vec3.fromValues(...data.elbow);
    this.grabStrength = data.grabStrength;
    this.id = data.id;
    this.palmNormal = vec3.fromValues(...data.palmNormal);
    this.palmPosition = vec3.fromValues(...data.palmPosition);
    this.palmVelocity = vec3.fromValues(...data.palmVelocity);
    this.palmWidth = data.palmWidth;
    this.pinchStrength = data.pinchStrength;
    this.r = mat3.fromValues(
      data.r[0][0], data.r[0][1], data.r[0][2],
      data.r[1][0], data.r[1][1], data.r[1][2],
      data.r[2][0], data.r[2][1], data.r[2][2]
    );
    this.s = data.s;
    this.sphereCenter = vec3.fromValues(...data.sphereCenter);
    this.sphereRadius = data.sphereRadius;
    this.stabilizedPalmPosition = vec3.fromValues(...data.stabilizedPalmPosition);
    this.t = vec3.fromValues(...data.t);
    this.timeVisible = data.timeVisible;
    this.type = data.type;
    this.wrist = vec3.fromValues(...data.wrist);


    this.pointables = [];
    this.fingers = {};

    this.arm = new Bone(
      BoneType.arm,
      this.armBasis,
      this.elbow,
      this.wrist,
      this.armWidth
    );

    this.pitch = Math.atan2(this.direction[1], -this.direction[2]);
    this.yaw = Math.atan2(this.direction[0], -this.direction[2]);
    this.roll = Math.atan2(this.palmNormal[0], -this.palmNormal[1]);
  }
开发者ID:alexeden,项目名称:dotstar-node,代码行数:45,代码来源:hand.ts

示例7: normalizePoint

  normalizePoint(position: [ number, number, number ], clamp: boolean) {
    const vec = vec3.fromValues(
      ((position[0] - this.center[0]) / this.size[0]) + 0.5,
      ((position[1] - this.center[1]) / this.size[1]) + 0.5,
      ((position[2] - this.center[2]) / this.size[2]) + 0.5
    );

    if (clamp) {
      vec[0] = Math.min(Math.max(vec[0], 0), 1);
      vec[1] = Math.min(Math.max(vec[1], 0), 1);
      vec[2] = Math.min(Math.max(vec[2], 0), 1);
    }

    return vec;
  }
开发者ID:alexeden,项目名称:dotstar-node,代码行数:15,代码来源:interaction-box.ts

示例8: computeCentroid

    computeCentroid(): Vec3 {
        var Axy = 0
          , Axz = 0
          , Cx  = 0
          , Cy  = 0
          , Cz  = 0;

        this.forEachEdge(function(e) {
            var v0 = e.begin.pos
              , v1 = e.end.pos
              , xy = v0[0] * v1[1] - v1[0] * v0[1]
              , xz = v0[0] * v1[2] - v1[0] * v0[2];

            Axy += xy;
            Axz += xz;
            Cx  += (v0[0] + v1[0]) * xy;
            Cy  += (v0[1] + v1[1]) * xy;
            Cz  += (v0[2] + v1[2]) * xz;
        });

        Axy = Axy / 2;
        Axz = Axz / 2;

        if (Math.abs(Axy) > 1e-6) {
            Cx = 1 / (6 * Axy) * Cx;
            Cy = 1 / (6 * Axy) * Cy;
        } else {
            Cx = this.edge.begin.pos[0];
            Cy = this.edge.begin.pos[1];
        }

        if (Math.abs(Axz) > 1e-6) {
            Cz = 1 / (6 * Axz) * Cz;
        } else {
            Cz = this.edge.begin.pos[2];
        }

        return vec3.fromValues(Cx, Cy, Cz);
    }
开发者ID:rmx,项目名称:encounter,代码行数:39,代码来源:Navmesh.ts

示例9: constructor

    constructor(...points: Vec3[]) {
        this.min = vec3.fromValues(+Infinity, +Infinity, +Infinity);
        this.max = vec3.fromValues(-Infinity, -Infinity, -Infinity);

        points.forEach(this.extend.bind(this));
    }
开发者ID:rmx,项目名称:encounter,代码行数:6,代码来源:BoundingBox.ts

示例10: copy

 public copy(rgb: number[]) {
   vec3.copy(this.v, vec3.fromValues(rgb[0], rgb[1], rgb[2]));
   return this;
 }
开发者ID:davidpaulrosser,项目名称:leonardo,代码行数:4,代码来源:Color.ts


注:本文中的gl-matrix.vec3.fromValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。