當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。