# Almost perfect rotation quaternion

2010-09-02  来源：本站原创  分类：Tech  人气：162

The contact PV3D the engine, but also a semi-3D programming solution, so Mark two articles, to prepare for their own learning PV3D with ..
The initial value of the human matrix with 9 (Matrix), to represent a three-dimensional object rotating position. Its major flaw is the data, and can not be automatically generated between the two over the angle of view.

As the matrix description is too abstract point of view, mankind invented the three priorities of the value of pull angle (Euler). You can pull angle is a very irresponsible man, the number of rotations and rotation in order not do distinction. 3D animator one of the most offensive situations 'universal lock (Gimbal Lock)' is this guy's problem. You pull in different axis angle spinning a few times, there x, y, z 3 axis fully into the situation with, say, pull angle You can easily rotate to the end there can be rotated in one direction only case This is the terror of 'universal lock'.

Later, the clever Irish mathematician invented to study today Quaternion (Quaternion), which is three-dimensional rotation relative to date describe the perfect program.

Quaternion and Matrix, as the exchange rate does not meet the multiplication, that is, A * B is not equal B * A. Quaternion can clearly stating the reason why three-dimensional rotation, because he is actually a 'four-dimensional' algorithms. Here's 'four-dimensional' is the use of mathematics, do not need to imagine what is the four-dimensional world = _ =, just one more axis, only one more parameter.

We introduce the PV3d in Quaternion commonly used several methods and their use will not involve too deep mathematical knowledge, so do not worry. Quaternion class position in the org-papervision-core-math package.

/ / Constructor Quaternion need four values (she is called four yuan Well =_=), x, y, z is a three-dimensional vector, that 'any axis', w is a scalar, that degrees of rotation. This is the angle of rotation is almost perfect.
Quaternion why not 'absolutely perfect', because the transition rate when interpolation is not constant, and difficult to resolve. However, this compared to 'terrorist universal lock' is already a small problem.

public function Quaternion (x: Number = 0, y: Number = 0, z: Number = 0, w: Number = 1)

/ / The following two months are 'preferred translation of the Latin angle quaternion' and 'conversion from a quaternion matrix'. These are two very common methods, as long as the advantages of an object known to pull angle, or matrix, to generate the corresponding quaternion.
Pv3d in any DisplayObject3D of tranform this property is the transformation of his matrix, this matrix can be obtained from the current rotation quaternion. (Institute of Flab we used the camera rotation on these methods)
public static function createFromEuler (ax: Number, ay: Number, az: Number, useDegrees: Boolean = false)
public static function createFromMatrix (matrix: Matrix3D)
/ / And the above is just the reverse, namely, 'get the advantages of known quaternion pull angle' and 'be known quaternion matrix'
public function toEuler ()
public function get matrix ()

/ / Quaternion interpolation is the most important use of, slerp method parameter, qa position for the start of the rotation quaternion, qb position for the end of the rotation quaternion, apha can be viewed as an interpolation of the position ratio between the value at 0-1.
public static function slerp (qa: Quaternion, qb: Quaternion, alpha: Number)
Perfect rotation of thought is this:
We must first know our start position and end position, end position in many cases with a DisplayObject3D virtual, we can use it. Tranform (a matrix of values), transform into a quaternion that two of the quaternion, we only need to increase the alpha value for each Zhen (from 0-1), can be in between these two quaternions into any number of transition frames quaternion.
Chen then each of this quaternion reverse the matrix by matrix multiplication in the current location of objects, each object can be obtained by Chen's new location.

Here are all the basic quaternion operations (generally used do not need to master), Wiktionary can understand the 'quaternion' more professional interpretation.
Wiktionary - Quaternion (will open in new window)

/ / Request model, quaternion to the origin of the distance, simply means that the length of
public function get modulo ()

/ / Common Rail
public static function conjugate (a: Quaternion)
/ / Scalar multiplication
public static function dot (a: Quaternion, b: Quaternion)

/ / Fork that
public static function multiply (a: Quaternion, b: Quaternion)

public static function sub (a: Quaternion, b: Quaternion)

/ / Sum
public static function add (a: Quaternion, b: Quaternion)

• Almost perfect rotation quaternion 2010-09-02

The contact PV3D the engine, but also a semi-3D programming solution, so Mark two articles, to prepare for their own learning PV3D with .. The initial value of the human matrix with 9 (Matrix), to represent a three-dimensional object rotating positio

• [Change] Quaternions and rotation problems - get information on the Internet 2 2010-07-25

Why use quaternion To answer this question, first look at the general on the rotation (for) a description of methods - Euler description method. It uses simple x, y, z values, respectively, in x, y, z axis rotation angle, its value for the 0-360 (or

• [Change] Quaternions and rotation problems - get information on the Internet 3 2010-07-25

In the 3D program, usually to calculate the 3D objects quaternion rotation, compared with the Matrix, quaternion more efficient, take up less storage space, in addition to more convenient interpolation. In mathematics, quaternion that complex w + xi

• 3D Transform quaternion 2010-09-02

In the 3D program, usually to calculate the 3D objects quaternion rotation, compared with the Matrix, quaternion more efficient, take up less storage space, in addition to more convenient interpolation. In mathematics, quaternion that complex w + xi

• Unity3d body. Glass shader 2010-04-22

Shader "Reflective / Glass" ( Properties ( _Color ("Main Color", Color) = (1,1,1,1) _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1) _Shininess ("Shininess", Range (0.01, 1)) = 0.078125 _ReflectColor ("

• 教程:如何使用Unity制作2.5D游戏(第1部分) 2014-02-26

2.5D游戏从根本上来说是3D游戏,但是经过开发者的处理后,游戏玩法只停留在2D轴上. <超级玛丽兄弟Wii>.<小小大星球>和<Paper Monsters>都是绝妙的2.5D游戏. 制作2.5D游戏(游戏邦注:3D游戏也可以使用)的绝妙方式是使用流行.简单和廉价的游戏开发工具Unity. 所以,在本系列教程中,我将向你展示如何使用Unity来制作简单的2.5D游戏<Shark Bomber!>. 如果你是个Unity新手,而且想要学习这种工具,那么本教程

• unity实现多点触控代码 2015-04-20

这篇文章主要介绍了unity实现多点触控代码,我最近在学习Unity游戏引擎.先从Unity平面开始,本章介绍Unity 平面上的多点触摸.有需要的小伙伴参考下. 这是我在论坛看到的,unity多点触控.感觉还不错,分享给大家 //用于绑定参照物对象 var target : Transform; //缩放系数 var distance = 10.0; //左右滑动移动速度 var xSpeed = 250.0; var ySpeed = 120.0; //缩放限制系数 var yMinLimi

• 教程:如何使用Unity制作2.5D游戏(第2部分) 2014-09-04

这是关于使用Unity开发一款简单的2.5D游戏教程的第二部分内容. 在第一部分教程中我们解析了Unity的使用基础并基于C#语言编写了脚本.我们创造了一款简单的游戏,即你控制着一架能够来回穿梭的飞机并向鲨鱼投射炸弹,以此保护小丑鱼. 在本篇教程的这最后一部分中我们将进一步扩展游戏并完成最后的润色.即我们将添加一些音效和音乐,整合游戏逻辑,并添加更多不同的游戏场景. 如果你未拥有之前的内容,你可以使用我们在教程1中所完成的项目,并在Unity中打开这一内容.你点击ScenesLevelScene

• Art and Design Simulation 3.1 - Mask used to create rotation of the Earth 2010-04-03

Mask is strong. They can use many ways to achieve unlimited results. Mask to make your daily work has become very easy and can save more time, in many instances, it has become indispensable tool for you. There is a force to control two or more layers

• [Change] Quaternions and rotation problems - get information on the Internet 1 2010-07-25

Computer Graphics: Quaternions and the rotation in the discussion "quaternion", we come to think of the three-dimensional Cartesian coordinates, the rotation will have any effect in the object, you can expand the three-dimensional Cartesian coor

• Concept and Application of quaternion 2010-09-02

Learn 3D programming, quaternion is forced to learn. The introduction of the concept and definitions are more abstract, this study, and summarized as follows: Quaternions introduced before the convention as do first: 1. Right-handed coordinate system

OpenCASCADE Quaternion [email protected] Abstract. The quaternions are members of a noncommutative division algebra first invented by William Rowan Hamilton. The idea for quaternions occurred to him while he was walking along the Royal Cannal on his way

• The use of CSS perfect way to achieve vertical center 2009-04-11

The use of XHTML + CSS to achieve the vertical elements in the middle has been the front-end development of a more complex and difficult issue, as web designer or front-end development engineers, the vertical center is also the question of the skills

• Start a photo program and save the photos to the development of directories, as well as screen rotation parameters of the record 2010-03-29

_path = Environment.getExternalStorageDirectory () + "/ images / make_machine_example.jpg"; protected void startCameraActivity() { File file = new File( _path ); Uri outputFileUri = Uri.fromFile( file ); Intent intent = new Intent(android.provid

• Perfect writing singleton 2010-03-29

package com.june.study.design_pattens.singleton; / ** * To write a perfect really is not easy, thank a teacher Liang Ge Ge! * * 1. Instances of private nature and the static nature of the * 2. Constructors private nature of * 3. If it is lazy-init, t

• Js + Flash to achieve image rotation 2008-05-17

In Web pages often need this kind of image rotation effect, recorded in this, to facilitate future use of strategic! Effect 1: Effect 2:

• To determine whether the iframe loads the perfect way to complete 2009-07-24

Rpm Generally speaking, we determine whether the iframe is loaded in fact, JavaScript file is loaded to determine the completion of the approach is very similar: var iframe = document.createElement("iframe"); iframe.src = "http://www.gillio

• flash image rotation (turn) 2008-10-18

flash image rotation

• Looking to the future perfect browser, and we look forward to microsoft and google ..... 2009-11-25

Looking to the future perfect browser, and we look forward to microsoft and google ..... For me personally, I hope that the perfect browser with the following features】 【hope that we express their views: Add the following functions aimed at improving

• Removal of restrictions on the perfect line of text netbeans 2010-03-04

Removal of restrictions on the perfect line of text netbeans The network approach is limited in color the text will be replaced by a white line, this method is not perfect, because when the cursor line to see a white vertical bar, my method (transpla

1
2
3
4
5
6
7
8
9
10