Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
66b34bbd
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
66b34bbd
编写于
1月 21, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added docs for Vector4. Also small fix to Vector4.
上级
7fd996a8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
195 addition
and
15 deletion
+195
-15
build/Three.js
build/Three.js
+2
-2
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+2
-2
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+2
-2
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+2
-2
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+2
-2
docs/api/core/Vector2.rst
docs/api/core/Vector2.rst
+5
-0
docs/api/core/Vector3.rst
docs/api/core/Vector3.rst
+9
-1
docs/api/core/Vector4.rst
docs/api/core/Vector4.rst
+169
-4
src/core/Vector4.js
src/core/Vector4.js
+2
-0
未找到文件。
build/Three.js
浏览文件 @
66b34bbd
...
...
@@ -14,8 +14,8 @@ addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
):
this
.
z
=
this
.
y
=
this
.
x
=
0
;
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthManhattan
:
function
(){
return
Math
.
abs
(
this
.
x
)
+
Math
.
abs
(
this
.
y
)
+
Math
.
abs
(
this
.
z
)},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
cross
:
function
(
a
,
b
){
this
.
x
=
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
;
this
.
y
=
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
;
this
.
x
=
c
*
a
.
z
-
d
*
a
.
y
;
this
.
y
=
d
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
c
*
a
.
x
;
return
this
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
return
(
new
THREE
.
Vector3
).
sub
(
this
,
a
).
lengthSq
()},
setPositionFromMatrix
:
function
(
a
){
this
.
x
=
a
.
n14
;
this
.
y
=
a
.
n24
;
this
.
z
=
a
.
n34
;
return
this
},
setRotationFromMatrix
:
function
(
a
){
var
b
=
Math
.
cos
(
this
.
y
);
this
.
y
=
Math
.
asin
(
a
.
n13
);
1.0
E
-
5
<
Math
.
abs
(
b
)?(
this
.
x
=
Math
.
atan2
(
-
a
.
n23
/
b
,
a
.
n33
/
b
),
this
.
z
=
Math
.
atan2
(
-
a
.
n12
/
b
,
a
.
n11
/
b
)):(
this
.
x
=
0
,
this
.
z
=
Math
.
atan2
(
a
.
n21
,
a
.
n22
));
return
this
},
equals
:
function
(
a
){
return
a
.
x
===
this
.
x
&&
a
.
y
===
this
.
y
&&
a
.
z
===
this
.
z
},
isZero
:
function
(){
return
1.0
E
-
4
>
this
.
lengthSq
()}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
THREE
.
Frustum
.
__v1
.
set
(
c
.
getColumnX
().
length
(),
c
.
getColumnY
().
length
(),
c
.
getColumnZ
().
length
()),
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
d
.
x
,
Math
.
max
(
d
.
y
,
d
.
z
)),
f
=
0
;
6
>
f
;
f
++
)
if
(
a
=
b
[
f
].
x
*
c
.
n14
+
b
[
f
].
y
*
c
.
n24
+
b
[
f
].
z
*
c
.
n34
+
b
[
f
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
...
...
build/custom/ThreeCanvas.js
浏览文件 @
66b34bbd
...
...
@@ -13,8 +13,8 @@ addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
):
this
.
z
=
this
.
y
=
this
.
x
=
0
;
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthManhattan
:
function
(){
return
Math
.
abs
(
this
.
x
)
+
Math
.
abs
(
this
.
y
)
+
Math
.
abs
(
this
.
z
)},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
cross
:
function
(
a
,
b
){
this
.
x
=
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
;
this
.
y
=
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
;
this
.
x
=
c
*
a
.
z
-
d
*
a
.
y
;
this
.
y
=
d
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
c
*
a
.
x
;
return
this
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
return
(
new
THREE
.
Vector3
).
sub
(
this
,
a
).
lengthSq
()},
setPositionFromMatrix
:
function
(
a
){
this
.
x
=
a
.
n14
;
this
.
y
=
a
.
n24
;
this
.
z
=
a
.
n34
;
return
this
},
setRotationFromMatrix
:
function
(
a
){
var
b
=
Math
.
cos
(
this
.
y
);
this
.
y
=
Math
.
asin
(
a
.
n13
);
1.0
E
-
5
<
Math
.
abs
(
b
)?(
this
.
x
=
Math
.
atan2
(
-
a
.
n23
/
b
,
a
.
n33
/
b
),
this
.
z
=
Math
.
atan2
(
-
a
.
n12
/
b
,
a
.
n11
/
b
)):(
this
.
x
=
0
,
this
.
z
=
Math
.
atan2
(
a
.
n21
,
a
.
n22
));
return
this
},
equals
:
function
(
a
){
return
a
.
x
===
this
.
x
&&
a
.
y
===
this
.
y
&&
a
.
z
===
this
.
z
},
isZero
:
function
(){
return
1.0
E
-
4
>
this
.
lengthSq
()}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
THREE
.
Frustum
.
__v1
.
set
(
c
.
getColumnX
().
length
(),
c
.
getColumnY
().
length
(),
c
.
getColumnZ
().
length
()),
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
d
.
x
,
Math
.
max
(
d
.
y
,
d
.
z
)),
e
=
0
;
6
>
e
;
e
++
)
if
(
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
...
...
build/custom/ThreeDOM.js
浏览文件 @
66b34bbd
...
...
@@ -13,8 +13,8 @@ addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
):
this
.
z
=
this
.
y
=
this
.
x
=
0
;
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthManhattan
:
function
(){
return
Math
.
abs
(
this
.
x
)
+
Math
.
abs
(
this
.
y
)
+
Math
.
abs
(
this
.
z
)},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
cross
:
function
(
a
,
b
){
this
.
x
=
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
;
this
.
y
=
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
;
this
.
x
=
c
*
a
.
z
-
d
*
a
.
y
;
this
.
y
=
d
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
c
*
a
.
x
;
return
this
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
return
(
new
THREE
.
Vector3
).
sub
(
this
,
a
).
lengthSq
()},
setPositionFromMatrix
:
function
(
a
){
this
.
x
=
a
.
n14
;
this
.
y
=
a
.
n24
;
this
.
z
=
a
.
n34
;
return
this
},
setRotationFromMatrix
:
function
(
a
){
var
b
=
Math
.
cos
(
this
.
y
);
this
.
y
=
Math
.
asin
(
a
.
n13
);
1.0
E
-
5
<
Math
.
abs
(
b
)?(
this
.
x
=
Math
.
atan2
(
-
a
.
n23
/
b
,
a
.
n33
/
b
),
this
.
z
=
Math
.
atan2
(
-
a
.
n12
/
b
,
a
.
n11
/
b
)):(
this
.
x
=
0
,
this
.
z
=
Math
.
atan2
(
a
.
n21
,
a
.
n22
));
return
this
},
equals
:
function
(
a
){
return
a
.
x
===
this
.
x
&&
a
.
y
===
this
.
y
&&
a
.
z
===
this
.
z
},
isZero
:
function
(){
return
1.0
E
-
4
>
this
.
lengthSq
()}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
THREE
.
Frustum
.
__v1
.
set
(
c
.
getColumnX
().
length
(),
c
.
getColumnY
().
length
(),
c
.
getColumnZ
().
length
()),
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
d
.
x
,
Math
.
max
(
d
.
y
,
d
.
z
)),
e
=
0
;
6
>
e
;
e
++
)
if
(
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
...
...
build/custom/ThreeSVG.js
浏览文件 @
66b34bbd
...
...
@@ -13,8 +13,8 @@ addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
):
this
.
z
=
this
.
y
=
this
.
x
=
0
;
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthManhattan
:
function
(){
return
Math
.
abs
(
this
.
x
)
+
Math
.
abs
(
this
.
y
)
+
Math
.
abs
(
this
.
z
)},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
cross
:
function
(
a
,
b
){
this
.
x
=
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
;
this
.
y
=
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
;
this
.
x
=
c
*
a
.
z
-
d
*
a
.
y
;
this
.
y
=
d
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
c
*
a
.
x
;
return
this
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
return
(
new
THREE
.
Vector3
).
sub
(
this
,
a
).
lengthSq
()},
setPositionFromMatrix
:
function
(
a
){
this
.
x
=
a
.
n14
;
this
.
y
=
a
.
n24
;
this
.
z
=
a
.
n34
;
return
this
},
setRotationFromMatrix
:
function
(
a
){
var
b
=
Math
.
cos
(
this
.
y
);
this
.
y
=
Math
.
asin
(
a
.
n13
);
1.0
E
-
5
<
Math
.
abs
(
b
)?(
this
.
x
=
Math
.
atan2
(
-
a
.
n23
/
b
,
a
.
n33
/
b
),
this
.
z
=
Math
.
atan2
(
-
a
.
n12
/
b
,
a
.
n11
/
b
)):(
this
.
x
=
0
,
this
.
z
=
Math
.
atan2
(
a
.
n21
,
a
.
n22
));
return
this
},
equals
:
function
(
a
){
return
a
.
x
===
this
.
x
&&
a
.
y
===
this
.
y
&&
a
.
z
===
this
.
z
},
isZero
:
function
(){
return
1.0
E
-
4
>
this
.
lengthSq
()}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
THREE
.
Frustum
.
__v1
.
set
(
c
.
getColumnX
().
length
(),
c
.
getColumnY
().
length
(),
c
.
getColumnZ
().
length
()),
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
d
.
x
,
Math
.
max
(
d
.
y
,
d
.
z
)),
e
=
0
;
6
>
e
;
e
++
)
if
(
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
...
...
build/custom/ThreeWebGL.js
浏览文件 @
66b34bbd
...
...
@@ -13,8 +13,8 @@ addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
):
this
.
z
=
this
.
y
=
this
.
x
=
0
;
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthManhattan
:
function
(){
return
Math
.
abs
(
this
.
x
)
+
Math
.
abs
(
this
.
y
)
+
Math
.
abs
(
this
.
z
)},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
cross
:
function
(
a
,
b
){
this
.
x
=
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
;
this
.
y
=
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
;
this
.
x
=
c
*
a
.
z
-
d
*
a
.
y
;
this
.
y
=
d
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
c
*
a
.
x
;
return
this
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
return
(
new
THREE
.
Vector3
).
sub
(
this
,
a
).
lengthSq
()},
setPositionFromMatrix
:
function
(
a
){
this
.
x
=
a
.
n14
;
this
.
y
=
a
.
n24
;
this
.
z
=
a
.
n34
;
return
this
},
setRotationFromMatrix
:
function
(
a
){
var
b
=
Math
.
cos
(
this
.
y
);
this
.
y
=
Math
.
asin
(
a
.
n13
);
1.0
E
-
5
<
Math
.
abs
(
b
)?(
this
.
x
=
Math
.
atan2
(
-
a
.
n23
/
b
,
a
.
n33
/
b
),
this
.
z
=
Math
.
atan2
(
-
a
.
n12
/
b
,
a
.
n11
/
b
)):(
this
.
x
=
0
,
this
.
z
=
Math
.
atan2
(
a
.
n21
,
a
.
n22
));
return
this
},
equals
:
function
(
a
){
return
a
.
x
===
this
.
x
&&
a
.
y
===
this
.
y
&&
a
.
z
===
this
.
z
},
isZero
:
function
(){
return
1.0
E
-
4
>
this
.
lengthSq
()}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
void
0
!==
a
.
w
?
a
.
w
:
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):(
this
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
THREE
.
Frustum
.
__v1
.
set
(
c
.
getColumnX
().
length
(),
c
.
getColumnY
().
length
(),
c
.
getColumnZ
().
length
()),
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
d
.
x
,
Math
.
max
(
d
.
y
,
d
.
z
)),
e
=
0
;
6
>
e
;
e
++
)
if
(
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
...
...
docs/api/core/Vector2.rst
浏览文件 @
66b34bbd
...
...
@@ -17,8 +17,13 @@ Vector2 - 2D vector
.. ...............................................................................
.. attribute:: Vector2.x
float - default ``0``
.. attribute:: Vector2.y
float - default ``0``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
...
...
docs/api/core/Vector3.rst
浏览文件 @
66b34bbd
...
...
@@ -18,9 +18,17 @@ Vector3 - 3D vector
.. ...............................................................................
.. attribute:: Vector3.x
float - default ``0``
.. attribute:: Vector3.y
float - default ``0``
.. attribute:: Vector3.z
float - default ``0``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
...
...
@@ -112,7 +120,7 @@ Vector3 - 3D vector
:param float s: scalar
:returns: This vector
:rtype: :class:`Vector
2
`
:rtype: :class:`Vector
3
`
.. function:: Vector3.divideScalar( s )
...
...
docs/api/core/Vector4.rst
浏览文件 @
66b34bbd
Vector4 - 4D vector
-------------------
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: Vector4()
.. class:: Vector4(
x, y, z, w
)
4D vector
:param float x: x-coordinate
:param float y: y-coordinate
:param float z: z-coordinate
:param float w: w-coordinate
.. ...............................................................................
.. rubric:: Attributes
.. ...............................................................................
.. attribute:: Vector4.x
float - default ``0``
.. attribute:: Vector4.y
float - default ``0``
.. attribute:: Vector4.z
float - default ``0``
.. attribute:: Vector4.w
float - default ``1``
.. ...............................................................................
.. rubric:: Methods
.. ...............................................................................
.. function:: Vector4.clone( )
Clones this vector
:returns: New instance identical to this vector
:rtype: :class:`Vector4`
.. function:: Vector4.set( x, y, z, w )
Sets value of this vector
:param float x: x-coordinate
:param float y: y-coordinate
:param float z: z-coordinate
:param float w: w-coordinate
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.copy( v )
Copies value of ``v`` to this vector
Sets ``w`` to 1 if ``v.w`` is undefined
:param Vector4 v: source vector
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.add( v1, v2 )
Sets this vector to ``v1 + v2``
:param Vector4 v1: source vector 1
:param Vector4 v2: source vector 2
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.addSelf( v )
Adds ``v`` to this vector
:param Vector4 v: source vector
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.sub( v1, v2 )
Sets this vector to ``v1 - v2``
:param Vector4 v1: source vector 1
:param Vector4 v2: source vector 2
.. function:: Vector4.subSelf( v )
Subtracts ``v`` from this vector
:param Vector4 v: source vector
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.multiplyScalar( s )
Multiplies this vector by scalar ``s``
:param float s: scalar
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.divideScalar( s )
Divides this vector by scalar ``s``
Set vector to ``( 0, 0, 0, 1 )`` if ``s == 0``
:param float s: scalar
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.negate( )
Inverts this vector
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.dot( v )
Computes dot product of this vector and ``v``
:param Vector4 v: vector
:returns: dot product
:rtype: float
.. function:: Vector4.lengthSq( )
Computes squared length of this vector
:returns: squared length
:rtype: float
.. function:: Vector4.length( )
Computes length of this vector
:returns: length
:rtype: float
.. function:: Vector4.normalize( )
Normalizes this vector
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.setLength( l )
Normalizes this vector and multiplies it by ``l``
:returns: This vector
:rtype: :class:`Vector4`
.. function:: Vector4.lerpSelf( v, alpha )
Linearly interpolate between this vector and ``v`` with ``alpha`` factor
:param Vector4 v: vector
:param float alpha: interpolation factor
:returns: This vector
:rtype: :class:`Vector4`
.. ...............................................................................
.. rubric:: Example
.. ...............................................................................
.. rubric:: Method
::
.. rubric:: Example(s)
\ No newline at end of file
var a = new THREE.Vector4( 1, 0, 0, 0 );
\ No newline at end of file
src/core/Vector4.js
浏览文件 @
66b34bbd
...
...
@@ -36,6 +36,8 @@ THREE.Vector4.prototype = {
this
.
z
=
v
.
z
;
this
.
w
=
(
v
.
w
!==
undefined
)
?
v
.
w
:
1
;
return
this
;
},
clone
:
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录