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


TypeScript vec2.transformMat2d方法代碼示例

本文整理匯總了TypeScript中gl-matrix.vec2.transformMat2d方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript vec2.transformMat2d方法的具體用法?TypeScript vec2.transformMat2d怎麽用?TypeScript vec2.transformMat2d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gl-matrix.vec2的用法示例。


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

示例1: viewportToTile

 /**
  * tilePos = mapToTile * squareToMap * viewportToSquare * viewportPos
  * tilePos = (mapToTile * verticalFlip) * squareToMap * (clipToSquare * verticalFlip * viewportToClip) * viewportPos
  */
 viewportToTile(...pos : number[]) : PosXY{
   let vec = pos as any as vec2;
   vec2.transformMat2d(vec, vec, this.viewportToSquareMatrix);
   vec2.transformMat2d(vec, vec, this.squareToMapMatrix);
   vec2.transformMat2d(vec, vec, this.mapToTileMatrix);
   return vec as any as PosXY;
 }
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:11,代碼來源:Perspective.ts

示例2: tileToViewport

 /**
  * viewportPos = viewportFromSquare * squareFromMap * mapFromTile * tilePos
  * viewportPos = (viewportFromClip * verticalFlip * clipFromSquare) * squareFromMap * (verticalFlip * mapFromTile) * tilePos
  */
 tileToViewport(...pos : number[]) : PosXY{
   let vec = pos as any as vec2;
   vec2.transformMat2d(vec, vec, this.mapFromTileMatrix);
   vec2.transformMat2d(vec, vec, this.squareFromMapMatrix);
   vec2.transformMat2d(vec, vec, this.viewportFromSquareMatrix);
   return vec as any as PosXY;
 }
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:11,代碼來源:Perspective.ts

示例3: reset

 /** Resets to fit tiles in viewport */
 reset({top, left, bottom, right} : Box){
   const topLeft = [left, top] as PosXY;
   const bottomRight = [right, bottom] as PosXY;
   vec2.transformMat2d(topLeft as any, topLeft, this.mapFromTileMatrix);
   vec2.transformMat2d(bottomRight as any, bottomRight, this.mapFromTileMatrix);
   this.transformMapToSquare(
     [topLeft, [-1,1]],
     [bottomRight, [ 1,-1]]
   );
 }
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:11,代碼來源:Perspective.ts

示例4:

outVal = vec2.squaredDistance(vec2A, vec2B);
outVal = vec2.sqrDist(vec2A, vec2B);
outVal = vec2.length(vec2A);
outVal = vec2.len(vec2A);
outVal = vec2.squaredLength(vec2A);
outVal = vec2.sqrLen(vec2A);
outVec2 = vec2.negate(outVec2, vec2A);
outVec2 = vec2.inverse(outVec2, vec2A);
outVec2 = vec2.normalize(outVec2, vec2A);
outVal = vec2.dot(vec2A, vec2B);
outVec2 = vec2.cross(outVec2, vec2A, vec2B);
outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
outVec2 = vec2.random(outVec2);
outVec2 = vec2.random(outVec2, 5.0);
outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
outStr = vec2.str(vec2A);
outBool = vec2.exactEquals(vec2A, vec2B);
outBool = vec2.equals(vec2A, vec2B);
outVec2 = vec2.add(outVec2, [0, 1], [2, 3]); // test one method with number array input

// vec3
outVec3 = vec3.create();
outVec3 = vec3.clone(vec3A);
outVec3 = vec3.fromValues(1, 2, 3);
outVec3 = vec3.copy(outVec3, vec3A);
outVec3 = vec3.set(outVec3, 1, 2, 3);
outVec3 = vec3.add(outVec3, vec3A, vec3B);
開發者ID:DenisCarriere,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:gl-matrix-tests.ts

示例5: viewportToSquare

 /**
  * squarePos = viewportToSquare * viewportPos
  * squarePos = (clipToSquare * viewportToClip * verticalFlip) * viewportPos
  */
 viewportToSquare(...pos : number[]) : SquarePos {
   let vec = pos as any as vec2;
   vec2.transformMat2d(vec, vec, this.viewportToSquareMatrix);
   return vec as any as PosXY;
 }
開發者ID:mariusGundersen,項目名稱:Ekkiog,代碼行數:9,代碼來源:Perspective.ts


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