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


TypeScript gl-matrix.vec3类代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: angleAxis

 /**
 * Calculate the rotation quaternion represented as pair of angle and axis.
 */
 public static angleAxis(angle: number, axis: Vector3): Quaternion {
   const axisVec = vec3.create();
   axisVec[0] = axis.X;
   axisVec[1] = axis.Y;
   axisVec[2] = axis.Z;
   const newQuat = quat.create();
   return new Quaternion(quat.setAxisAngle(newQuat, axisVec, +angle));
 }
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:11,代码来源:Quaternion.ts

示例6: needRecomputeMovePath

    private needRecomputeMovePath(): boolean {
        var terrain  = lookupEntity<Terrain>(this.state, this.target.terrainId)
          , tpos     = getWorldCoordinates(terrain, this.target.terrainPosition)
          , fpos     = finalPosition(this.owner)
          , distance = Math.abs(vec3.length(vec3.subtract(vec3.create(), tpos, fpos)))
          , diff     = distance - (this.distance + this.target.boundingRadius);

        return 0.1 < diff;

        function finalPosition(entity: WorldObject): Vec3 {
            if (entity.movePath) {
                return entity.movePath.finalPosition;
            } else {
                return getWorldCoordinates(terrain, entity.terrainPosition);
            }
        }
    }
开发者ID:rmx,项目名称:encounter,代码行数:17,代码来源:follow.ts

示例7: 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

示例8: constructor

 constructor(
   readonly type: BoneType,
   readonly basis: Triple<vec3>,
   readonly prevJoint: vec3,
   readonly nextJoint: vec3,
   readonly width: number
 ) {
   const difference = vec3.subtract(vec3.create(), this.nextJoint, this.prevJoint);
   this.length = vec3.length(difference);
   this.basisMatrix = mat3.fromValues(
     this.basis[0][0], this.basis[0][1], this.basis[0][2],
     this.basis[1][0], this.basis[1][1], this.basis[1][2],
     this.basis[2][0], this.basis[2][1], this.basis[2][2]
   );
   this.left = mat3.determinant(this.basisMatrix) < 0;
   this.center = vec3.lerp(vec3.create(), this.prevJoint, this.nextJoint, 0.5);
   this.direction = Bone.createBoneDirection(this.basisMatrix);
   this.matrix = Bone.createBoneMatrix(this.basisMatrix, this.center, this.left);
 }
开发者ID:alexeden,项目名称:dotstar-node,代码行数:19,代码来源:bone.ts

示例9: convert

 public convert(hex: string | number) {
   let rgb;
   if (typeof hex === 'number') {
     rgb = this.hexIntToRgb(hex);
   }
   if (typeof hex === 'string') {
     rgb = this.hexStringToRgb(hex);
   }
   vec3.copy(this.v, this.normalize(rgb));
   return this;
 }
开发者ID:davidpaulrosser,项目名称:leonardo,代码行数:11,代码来源:Color.ts

示例10: 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


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