diff options
author | Jonathan Duran | 2012-07-17 09:30:22 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-07-17 09:30:22 -0700 |
commit | 53051672a62208fbc96957719d8285fac6431ed6 (patch) | |
tree | 79d542ee811044e8af2ef84aa0d6662c6eb895c4 /js/helper-classes/RDGE/src/core/script/math/vec3.js | |
parent | 7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff) | |
parent | 5146f224258929415adf4a8022e492454b4e2476 (diff) | |
download | ninja-53051672a62208fbc96957719d8285fac6431ed6.tar.gz |
Merge branch 'refs/heads/NINJA-master' into TimelineUber
Conflicts:
js/panels/Timeline/DragDrop.js
js/panels/Timeline/Keyframe.reel/Keyframe.js
js/panels/Timeline/Layer.reel/Layer.js
js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
js/panels/Timeline/Span.reel/Span.js
js/panels/Timeline/Style.reel/Style.js
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
js/panels/Timeline/Track.reel/Track.html
js/panels/Timeline/Track.reel/Track.js
js/panels/Timeline/Track.reel/css/Track.css
js/panels/Timeline/TrackSpacer.reel/TrackSpacer.html
js/panels/Timeline/TrackSpacer.reel/TrackSpacer.js
js/panels/Timeline/TrackSpacer.reel/css/TrackSpacer.css
js/panels/Timeline/Tween.reel/Tween.js
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/math/vec3.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/math/vec3.js | 749 |
1 files changed, 375 insertions, 374 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/math/vec3.js b/js/helper-classes/RDGE/src/core/script/math/vec3.js index c50df00c..da7c7cff 100755 --- a/js/helper-classes/RDGE/src/core/script/math/vec3.js +++ b/js/helper-classes/RDGE/src/core/script/math/vec3.js | |||
@@ -1,374 +1,375 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | 4 | |
5 | 5 | Redistribution and use in source and binary forms, with or without | |
6 | Redistribution and use in source and binary forms, with or without | 6 | modification, are permitted provided that the following conditions are met: |
7 | modification, are permitted provided that the following conditions are met: | 7 | |
8 | 8 | * Redistributions of source code must retain the above copyright notice, | |
9 | - Redistributions of source code must retain the above copyright notice, | 9 | this list of conditions and the following disclaimer. |
10 | this list of conditions and the following disclaimer. | 10 | |
11 | - Redistributions in binary form must reproduce the above copyright | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
12 | notice, this list of conditions and the following disclaimer in the | 12 | this list of conditions and the following disclaimer in the documentation |
13 | documentation and/or other materials provided with the distribution. | 13 | and/or other materials provided with the distribution. |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 14 | |
15 | may be used to endorse or promote products derived from this software | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | without specific prior written permission. | 16 | contributors may be used to endorse or promote products derived from this |
17 | 17 | software without specific prior written permission. | |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 18 | |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | </copyright> */ | 29 | POSSIBILITY OF SUCH DAMAGE. |
30 | 30 | </copyright> */ | |
31 | 31 | ||
32 | /** | 32 | |
33 | * RDGE.vec3 = {} | 33 | /** |
34 | * This library contains functions for operating on 3D vectors. Any JS array | 34 | * RDGE.vec3 = {} |
35 | * containing at least 3 numeric components can represent a 3D vector. | 35 | * This library contains functions for operating on 3D vectors. Any JS array |
36 | * | 36 | * containing at least 3 numeric components can represent a 3D vector. |
37 | * For example, all of these are valid RDGE.vec3 declarations: | 37 | * |
38 | * var a = [0, 0, 1]; | 38 | * For example, all of these are valid RDGE.vec3 declarations: |
39 | * var b = RDGE.vec3.zero(); | 39 | * var a = [0, 0, 1]; |
40 | * var c = RDGE.vec3.up(); | 40 | * var b = RDGE.vec3.zero(); |
41 | * | 41 | * var c = RDGE.vec3.up(); |
42 | */ | 42 | * |
43 | var RDGE = RDGE || {}; | 43 | */ |
44 | RDGE.vec3 = {}; | 44 | var RDGE = RDGE || {}; |
45 | 45 | RDGE.vec3 = {}; | |
46 | /** | 46 | |
47 | * RDGE.vec3.string | 47 | /** |
48 | */ | 48 | * RDGE.vec3.string |
49 | RDGE.vec3.string = function (v) { | 49 | */ |
50 | return "{ " + v[0] + ", " + v[1] + ", " + v[2] + " }"; | 50 | RDGE.vec3.string = function (v) { |
51 | }; | 51 | return "{ " + v[0] + ", " + v[1] + ", " + v[2] + " }"; |
52 | 52 | }; | |
53 | /** | 53 | |
54 | * RDGE.vec3.verify | 54 | /** |
55 | * This function is provided for debugging purposes only. It is not recommended | 55 | * RDGE.vec3.verify |
56 | * to be used in performance critical areas of the code. | 56 | * This function is provided for debugging purposes only. It is not recommended |
57 | */ | 57 | * to be used in performance critical areas of the code. |
58 | RDGE.vec3.verify = function (v) { | 58 | */ |
59 | if (v == undefined || v.length == undefined || v.length < 3) { | 59 | RDGE.vec3.verify = function (v) { |
60 | return false; | 60 | if (v == undefined || v.length == undefined || v.length < 3) { |
61 | } | 61 | return false; |
62 | if (typeof (v[0]) != "number" || typeof (v[1]) != "number" || typeof (v[2]) != "number") { | 62 | } |
63 | return false; | 63 | if (typeof (v[0]) != "number" || typeof (v[1]) != "number" || typeof (v[2]) != "number") { |
64 | } | 64 | return false; |
65 | return true; | 65 | } |
66 | }; | 66 | return true; |
67 | 67 | }; | |
68 | /** | 68 | |
69 | * RDGE.vec3.inplace_copy | 69 | /** |
70 | */ | 70 | * RDGE.vec3.inplace_copy |
71 | RDGE.vec3.inplace_copy = function (dst, src) { | 71 | */ |
72 | dst[0] = src[0]; | 72 | RDGE.vec3.inplace_copy = function (dst, src) { |
73 | dst[1] = src[1]; | 73 | dst[0] = src[0]; |
74 | dst[2] = src[2]; | 74 | dst[1] = src[1]; |
75 | }; | 75 | dst[2] = src[2]; |
76 | 76 | }; | |
77 | /** | 77 | |
78 | * RDGE.vec3.copy | 78 | /** |
79 | */ | 79 | * RDGE.vec3.copy |
80 | RDGE.vec3.copy = function (v) { | 80 | */ |
81 | if (v.length == undefined) { | 81 | RDGE.vec3.copy = function (v) { |
82 | return [v, v, v]; | 82 | if (v.length == undefined) { |
83 | } | 83 | return [v, v, v]; |
84 | 84 | } | |
85 | return [v[0], v[1], v[2]]; | 85 | |
86 | }; | 86 | return [v[0], v[1], v[2]]; |
87 | 87 | }; | |
88 | /** | 88 | |
89 | * RDGE.vec3.translation | 89 | /** |
90 | * description : returns a vector containing the translation vector of m. | 90 | * RDGE.vec3.translation |
91 | */ | 91 | * description : returns a vector containing the translation vector of m. |
92 | RDGE.vec3.translation = function (m) { | 92 | */ |
93 | return [m[12], m[13], m[14]]; | 93 | RDGE.vec3.translation = function (m) { |
94 | }; | 94 | return [m[12], m[13], m[14]]; |
95 | 95 | }; | |
96 | /** | 96 | |
97 | * RDGE.vec3.basisX = function( m ) | 97 | /** |
98 | * description : returns a vector containing the translation vector of m. | 98 | * RDGE.vec3.basisX = function( m ) |
99 | */ | 99 | * description : returns a vector containing the translation vector of m. |
100 | RDGE.vec3.basisX = function (m) { | 100 | */ |
101 | return [m[0], m[1], m[2]]; | 101 | RDGE.vec3.basisX = function (m) { |
102 | }; | 102 | return [m[0], m[1], m[2]]; |
103 | 103 | }; | |
104 | /** | 104 | |
105 | * RDGE.vec3.basisY = function( m ) | 105 | /** |
106 | * description : returns a vector containing the translation vector of m. | 106 | * RDGE.vec3.basisY = function( m ) |
107 | */ | 107 | * description : returns a vector containing the translation vector of m. |
108 | RDGE.vec3.basisY = function (m) { | 108 | */ |
109 | return [m[4], m[5], m[6]]; | 109 | RDGE.vec3.basisY = function (m) { |
110 | }; | 110 | return [m[4], m[5], m[6]]; |
111 | 111 | }; | |
112 | /** | 112 | |
113 | * RDGE.vec3.basisZ = function( m ) | 113 | /** |
114 | * description : returns a vector containing the translation vector of m. | 114 | * RDGE.vec3.basisZ = function( m ) |
115 | */ | 115 | * description : returns a vector containing the translation vector of m. |
116 | RDGE.vec3.basisZ = function (m) { | 116 | */ |
117 | return [m[8], m[9], m[10]]; | 117 | RDGE.vec3.basisZ = function (m) { |
118 | }; | 118 | return [m[8], m[9], m[10]]; |
119 | 119 | }; | |
120 | /** | 120 | |
121 | * RDGE.vec3.zero | 121 | /** |
122 | */ | 122 | * RDGE.vec3.zero |
123 | RDGE.vec3.zero = function () { | 123 | */ |
124 | return [0.0, 0.0, 0.0]; | 124 | RDGE.vec3.zero = function () { |
125 | }; | 125 | return [0.0, 0.0, 0.0]; |
126 | 126 | }; | |
127 | /** | 127 | |
128 | * RDGE.vec3.up | 128 | /** |
129 | */ | 129 | * RDGE.vec3.up |
130 | RDGE.vec3.up = function () { | 130 | */ |
131 | return [0.0, 1.0, 0.0]; | 131 | RDGE.vec3.up = function () { |
132 | }; | 132 | return [0.0, 1.0, 0.0]; |
133 | 133 | }; | |
134 | /** |