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


TypeScript quat.create方法代碼示例

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


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

示例1: constructor

 constructor() {
   this.children = [];
   this.localMatrix = mat4.create();
   this.modelMatrix = mat4.create();
   this.modelViewMatrix = mat4.create();
   this.matrixAutoUpdate = true;
   this.position = new Vector3();
   this.rotation = new Vector3();
   this.scale = new Vector3(1, 1, 1);
   this.isObject3D = true;
   this.quaternion = quat.create();
   this.quaternionLookAt = quat.create();
   this.lookAtUp = vec3.create(); // needs to be [0, 0, 0] although it should be [0, 1, 0]
 }
開發者ID:davidpaulrosser,項目名稱:leonardo,代碼行數:14,代碼來源:Object3D.ts

示例2: lookAt

export function lookAt(eye: vec3, target: vec3, up: vec3) {
  const quatOut = quat.create();
  const x = vec3.create();
  const y = vec3.create();
  const z = vec3.create();

  vec3.sub(z, eye, target);

  if (vec3.squaredLength(z) === 0) {
    // eye and target are in the same position
    z[2] = 1;
  }

  vec3.normalize(z, z);
  vec3.cross(x, up, z);

  if (vec3.squaredLength(x) === 0) {
    // eye and target are in the same vertical
    z[2] += 0.0001;
    vec3.cross(x, up, z);
  }

  vec3.normalize(x, x);
  vec3.cross(y, z, x);

  quat.setAxes(quatOut, z, x, y);
  quat.invert(quatOut, quatOut);

  return quatOut;
}
開發者ID:davidpaulrosser,項目名稱:leonardo,代碼行數:30,代碼來源:Utils.ts

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

示例4:

let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let quatA = quat.fromValues(1, 2, 3, 4);
let quatB = quat.fromValues(5, 6, 7, 8);

let outVec2 = vec2.create();
let outVec3 = vec3.create();
let outVec4 = vec4.create();
let outMat2 = mat2.create();
let outMat2d = mat2d.create();
let outMat3 = mat3.create();
let outMat4 = mat4.create();
let outQuat = quat.create();

let outMat2Null: mat2 | null;
let outMat2dNull: mat2d | null;
let outMat3Null: mat3 | null;
let outMat4Null: mat4 | null;

// vec2
outVec2 = vec2.create();
outVec2 = vec2.clone(vec2A);
outVec2 = vec2.fromValues(1, 2);
outVec2 = vec2.copy(outVec2, vec2A);
outVec2 = vec2.set(outVec2, 1, 2);
outVec2 = vec2.add(outVec2, vec2A, vec2B);
outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
outVec2 = vec2.sub(outVec2, vec2A, vec2B);
開發者ID:DenisCarriere,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:gl-matrix-tests.ts

示例5:

import { mat4, quat } from 'gl-matrix'
import { addSystem } from 'shared-utils/painterState'
import * as geo from 'tvs-libs/dist/math/geometry'
import { events } from './context'
import { groundHeight } from './geometries'

let time = 0

export const wallsTransform = mat4.create()
const rotation = quat.create()

export const floorTransform = mat4.create()

export const floorMirrorView = mat4.create()

const planeEquation = geo.planeFromNormalAndCoplanarPoint(
	[0, 1, 0],
	[0, groundHeight, 0]
)
export const floorMirrorMatrix = geo.mirrorMatrixFromPlane(planeEquation)

addSystem('state', (e, s) => {
	if (e === events.FRAME) {
		time += s.device.tpf

		quat.fromEuler(
			rotation,
			Math.sin(0.0007 * time) * 1.1,
			time * 0.001,
			Math.sin(0.0008 * time) * 1.1
		)
開發者ID:trivial-space,項目名稱:playground,代碼行數:31,代碼來源:state.ts

示例6: slerp

 public static slerp(q1: Quaternion, q2: Quaternion, t: number): Quaternion {
   const newQuat = quat.create();
   return new Quaternion(quat.slerp(newQuat, q1.rawElements, q2.rawElements, +t));
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:4,代碼來源:Quaternion.ts

示例7: multiply

 /**
 * Calculate multiply result of two quaternion
 */
 public static multiply(q1: Quaternion, q2: Quaternion): Quaternion {
   const newQuat = quat.create();
   return new Quaternion(quat.mul(newQuat, q1.rawElements, q2.rawElements));
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:7,代碼來源:Quaternion.ts

示例8: inverse

 public inverse(): Quaternion {
   const newQuat = quat.create();
   return new Quaternion(quat.invert(newQuat, this.rawElements));
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:4,代碼來源:Quaternion.ts

示例9: normalize

 /**
 * Get normalized quaternion
 */
 public normalize(): Quaternion {
   const newQuat = quat.create();
   return new Quaternion(quat.normalize(newQuat, this.rawElements));
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:7,代碼來源:Quaternion.ts

示例10: Conjugate

 /**
 * Get the conjugate of this quaternion
 */
 public get Conjugate(): Quaternion {
   const newQuat = quat.create();
   return new Quaternion(quat.conjugate(newQuat, this.rawElements));
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:7,代碼來源:Quaternion.ts


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