Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
e1edb171
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
e1edb171
编写于
4月 13, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
19578522
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
25 deletion
+30
-25
build/Three.js
build/Three.js
+6
-5
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+6
-5
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+6
-5
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+6
-5
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+6
-5
未找到文件。
build/Three.js
浏览文件 @
e1edb171
...
@@ -20,7 +20,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
...
@@ -20,7 +20,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
())},
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
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
;
a
<
6
;
a
++
){
b
=
c
[
a
];
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))}};
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
;
a
<
6
;
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
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
-
a
.
geometry
.
boundingSphere
.
radius
*
c
.
getMaxScaleOnAxis
(
),
e
=
0
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
r
.
sub
(
c
,
a
);
u
=
r
.
dot
(
b
);
t
=
n
.
add
(
a
,
q
.
copy
(
b
).
multiplyScalar
(
u
));
return
y
=
c
.
distanceTo
(
t
)}
function
d
(
a
,
b
,
c
,
d
){
r
.
sub
(
d
,
b
);
n
.
sub
(
c
,
b
);
q
.
sub
(
a
,
b
);
s
=
r
.
dot
(
r
);
x
=
r
.
dot
(
n
);
D
=
r
.
dot
(
q
);
B
=
n
.
dot
(
n
);
w
=
n
.
dot
(
q
);
v
=
1
/
(
s
*
B
-
x
*
x
);
C
=
(
B
*
D
-
x
*
w
)
*
v
;
K
=
(
s
*
w
-
x
*
D
)
*
v
;
return
C
>=
0
&&
K
>=
0
&&
C
+
K
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
r
.
sub
(
c
,
a
);
u
=
r
.
dot
(
b
);
t
=
n
.
add
(
a
,
q
.
copy
(
b
).
multiplyScalar
(
u
));
return
y
=
c
.
distanceTo
(
t
)}
function
d
(
a
,
b
,
c
,
d
){
r
.
sub
(
d
,
b
);
n
.
sub
(
c
,
b
);
q
.
sub
(
a
,
b
);
s
=
r
.
dot
(
r
);
x
=
r
.
dot
(
n
);
D
=
r
.
dot
(
q
);
B
=
n
.
dot
(
n
);
w
=
n
.
dot
(
q
);
v
=
1
/
(
s
*
B
-
x
*
x
);
C
=
(
B
*
D
-
x
*
w
)
*
v
;
K
=
(
s
*
w
-
x
*
D
)
*
v
;
return
C
>=
0
&&
K
>=
0
&&
C
+
K
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
p
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
n
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
r
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
r
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
r
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
n
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
r
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
q
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
k
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
p
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
n
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
r
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
r
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
r
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
n
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
r
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
q
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
r
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
q
.
x
,
Math
.
max
(
q
.
y
,
q
.
z
)))
return
n
;
var
s
,
i
,
u
=
a
.
geometry
,
t
=
u
.
vertices
,
H
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
r
=
0
;
for
(
q
=
u
.
faces
.
length
;
r
<
q
;
r
++
){
b
=
u
.
faces
[
r
];
k
.
copy
(
this
.
origin
);
l
.
copy
(
this
.
direction
);
H
=
a
.
matrixWorld
;
p
=
H
.
multiplyVector3
(
p
.
copy
(
b
.
centroid
)).
subSelf
(
k
);
m
=
a
.
matrixRotationWorld
.
multiplyVector3
(
m
.
copy
(
b
.
normal
));
s
=
l
.
dot
(
m
);
if
(
!
(
Math
.
abs
(
s
)
<
e
)){
i
=
m
.
dot
(
p
)
/
s
;
if
(
!
(
i
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
r
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
q
.
x
,
Math
.
max
(
q
.
y
,
q
.
z
)))
return
n
;
var
s
,
i
,
u
=
a
.
geometry
,
t
=
u
.
vertices
,
H
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
r
=
0
;
for
(
q
=
u
.
faces
.
length
;
r
<
q
;
r
++
){
b
=
u
.
faces
[
r
];
k
.
copy
(
this
.
origin
);
l
.
copy
(
this
.
direction
);
H
=
a
.
matrixWorld
;
p
=
H
.
multiplyVector3
(
p
.
copy
(
b
.
centroid
)).
subSelf
(
k
);
m
=
a
.
matrixRotationWorld
.
multiplyVector3
(
m
.
copy
(
b
.
normal
));
s
=
l
.
dot
(
m
);
if
(
!
(
Math
.
abs
(
s
)
<
e
)){
i
=
m
.
dot
(
p
)
/
s
;
if
(
!
(
i
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
...
@@ -53,10 +53,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
...
@@ -53,10 +53,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
h
=
this
.
n33
,
j
=
this
.
n43
,
k
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
k
*
b
-
a
*
f
;
this
.
n21
=
k
*
c
-
a
*
g
;
this
.
n31
=
k
*
d
-
a
*
h
;
this
.
n41
=
k
*
e
-
a
*
j
;
this
.
n13
=
k
*
f
+
a
*
b
;
this
.
n23
=
k
*
g
+
a
*
c
;
this
.
n33
=
k
*
h
+
a
*
d
;
this
.
n43
=
k
*
j
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
h
=
this
.
n32
,
j
=
this
.
n42
,
k
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
k
*
b
+
a
*
f
;
this
.
n21
=
k
*
c
+
a
*
g
;
this
.
n31
=
k
*
d
+
a
*
h
;
this
.
n41
=
k
*
e
+
a
*
j
;
this
.
n12
=
k
*
f
-
a
*
b
;
this
.
n22
=
k
*
g
-
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
h
=
this
.
n33
,
j
=
this
.
n43
,
k
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
k
*
b
-
a
*
f
;
this
.
n21
=
k
*
c
-
a
*
g
;
this
.
n31
=
k
*
d
-
a
*
h
;
this
.
n41
=
k
*
e
-
a
*
j
;
this
.
n13
=
k
*
f
+
a
*
b
;
this
.
n23
=
k
*
g
+
a
*
c
;
this
.
n33
=
k
*
h
+
a
*
d
;
this
.
n43
=
k
*
j
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
h
=
this
.
n32
,
j
=
this
.
n42
,
k
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
k
*
b
+
a
*
f
;
this
.
n21
=
k
*
c
+
a
*
g
;
this
.
n31
=
k
*
d
+
a
*
h
;
this
.
n41
=
k
*
e
+
a
*
j
;
this
.
n12
=
k
*
f
-
a
*
b
;
this
.
n22
=
k
*
g
-
a
*
c
;
this
.
n32
=
k
*
h
-
a
*
d
;
this
.
n42
=
k
*
j
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
h
=
e
*
e
,
j
=
Math
.
cos
(
b
),
k
=
Math
.
sin
(
b
),
l
=
1
-
j
,
p
=
c
*
d
*
l
,
m
=
c
*
e
*
l
,
l
=
d
*
e
*
l
,
c
=
c
*
k
,
o
=
d
*
k
,
k
=
e
*
k
,
e
=
f
+
(
1
-
f
)
*
j
,
f
=
p
+
k
,
d
=
m
-
o
,
p
=
p
-
k
,
g
=
g
+
(
1
-
g
)
*
j
,
k
=
l
+
c
,
m
=
m
+
o
,
l
=
l
-
c
,
h
=
h
+
(
1
-
h
)
*
j
,
j
=
this
.
n11
,
c
=
this
.
n21
,
o
=
this
.
n31
,
r
=
this
.
n41
,
a
*
c
;
this
.
n32
=
k
*
h
-
a
*
d
;
this
.
n42
=
k
*
j
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
h
=
e
*
e
,
j
=
Math
.
cos
(
b
),
k
=
Math
.
sin
(
b
),
l
=
1
-
j
,
p
=
c
*
d
*
l
,
m
=
c
*
e
*
l
,
l
=
d
*
e
*
l
,
c
=
c
*
k
,
o
=
d
*
k
,
k
=
e
*
k
,
e
=
f
+
(
1
-
f
)
*
j
,
f
=
p
+
k
,
d
=
m
-
o
,
p
=
p
-
k
,
g
=
g
+
(
1
-
g
)
*
j
,
k
=
l
+
c
,
m
=
m
+
o
,
l
=
l
-
c
,
h
=
h
+
(
1
-
h
)
*
j
,
j
=
this
.
n11
,
c
=
this
.
n21
,
o
=
this
.
n31
,
r
=
this
.
n41
,
n
=
this
.
n12
,
q
=
this
.
n22
,
u
=
this
.
n32
,
t
=
this
.
n42
,
y
=
this
.
n13
,
s
=
this
.
n23
,
x
=
this
.
n33
,
D
=
this
.
n43
;
this
.
n11
=
e
*
j
+
f
*
n
+
d
*
y
;
this
.
n21
=
e
*
c
+
f
*
q
+
d
*
s
;
this
.
n31
=
e
*
o
+
f
*
u
+
d
*
x
;
this
.
n41
=
e
*
r
+
f
*
t
+
d
*
D
;
this
.
n12
=
p
*
j
+
g
*
n
+
k
*
y
;
this
.
n22
=
p
*
c
+
g
*
q
+
k
*
s
;
this
.
n32
=
p
*
o
+
g
*
u
+
k
*
x
;
this
.
n42
=
p
*
r
+
g
*
t
+
k
*
D
;
this
.
n13
=
m
*
j
+
l
*
n
+
h
*
y
;
this
.
n23
=
m
*
c
+
l
*
q
+
h
*
s
;
this
.
n33
=
m
*
o
+
l
*
u
+
h
*
x
;
this
.
n43
=
m
*
r
+
l
*
t
+
h
*
D
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
n
=
this
.
n12
,
q
=
this
.
n22
,
u
=
this
.
n32
,
t
=
this
.
n42
,
y
=
this
.
n13
,
s
=
this
.
n23
,
x
=
this
.
n33
,
D
=
this
.
n43
;
this
.
n11
=
e
*
j
+
f
*
n
+
d
*
y
;
this
.
n21
=
e
*
c
+
f
*
q
+
d
*
s
;
this
.
n31
=
e
*
o
+
f
*
u
+
d
*
x
;
this
.
n41
=
e
*
r
+
f
*
t
+
d
*
D
;
this
.
n12
=
p
*
j
+
g
*
n
+
k
*
y
;
this
.
n22
=
p
*
c
+
g
*
q
+
k
*
s
;
this
.
n32
=
p
*
o
+
g
*
u
+
k
*
x
;
this
.
n42
=
p
*
r
+
g
*
t
+
k
*
D
;
this
.
n13
=
m
*
j
+
l
*
n
+
h
*
y
;
this
.
n23
=
m
*
c
+
l
*
q
+
h
*
s
;
this
.
n33
=
m
*
o
+
l
*
u
+
h
*
x
;
this
.
n43
=
m
*
r
+
l
*
t
+
h
*
D
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
getMaxScaleOnAxis
:
function
(){
return
Math
.
sqrt
(
Math
.
max
(
this
.
n11
*
this
.
n11
+
this
.
n21
*
this
.
n21
+
this
.
n31
*
this
.
n31
,
Math
.
max
(
this
.
n12
*
this
.
n12
+
this
.
n22
*
this
.
n22
+
this
.
n32
*
this
.
n32
,
this
.
n13
*
this
.
n13
+
this
.
n23
*
this
.
n23
+
this
.
n33
*
this
.
n33
)))},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
h
=
a
.
z
,
j
=
e
*
f
,
k
=
e
*
g
;
this
.
set
(
j
*
f
+
c
,
j
*
g
-
d
*
h
,
j
*
h
+
d
*
g
,
0
,
j
*
g
+
d
*
h
,
k
*
g
+
c
,
k
*
h
-
d
*
f
,
0
,
j
*
h
-
d
*
g
,
k
*
h
+
d
*
f
,
e
*
h
*
h
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
h
=
a
.
z
,
j
=
e
*
f
,
k
=
e
*
g
;
this
.
set
(
j
*
f
+
c
,
j
*
g
-
d
*
h
,
j
*
h
+
d
*
g
,
0
,
j
*
g
+
d
*
h
,
k
*
g
+
c
,
k
*
h
-
d
*
f
,
0
,
j
*
h
-
d
*
g
,
k
*
h
+
d
*
f
,
e
*
h
*
h
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
g
=
b
-
a
,
h
=
c
-
d
,
j
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
h
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
h
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
j
;
this
.
n34
=-
((
f
+
e
)
/
j
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
e
,
f
){
var
g
=
b
-
a
,
h
=
c
-
d
,
j
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
h
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
h
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
j
;
this
.
n34
=-
((
f
+
e
)
/
j
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
...
...
build/custom/ThreeCanvas.js
浏览文件 @
e1edb171
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
())},
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
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
;
a
<
6
;
a
++
){
b
=
c
[
a
];
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))}};
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
;
a
<
6
;
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
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
-
a
.
geometry
.
boundingSphere
.
radius
*
c
.
getMaxScaleOnAxis
(
),
e
=
0
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
p
.
sub
(
c
,
a
);
H
=
p
.
dot
(
b
);
D
=
k
.
add
(
a
,
u
.
copy
(
b
).
multiplyScalar
(
H
));
return
L
=
c
.
distanceTo
(
D
)}
function
d
(
a
,
b
,
c
,
d
){
p
.
sub
(
d
,
b
);
k
.
sub
(
c
,
b
);
u
.
sub
(
a
,
b
);
G
=
p
.
dot
(
p
);
t
=
p
.
dot
(
k
);
E
=
p
.
dot
(
u
);
A
=
k
.
dot
(
k
);
F
=
k
.
dot
(
u
);
r
=
1
/
(
G
*
A
-
t
*
t
);
v
=
(
A
*
E
-
t
*
F
)
*
r
;
y
=
(
G
*
F
-
t
*
E
)
*
r
;
return
v
>=
0
&&
y
>=
0
&&
v
+
y
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
p
.
sub
(
c
,
a
);
H
=
p
.
dot
(
b
);
D
=
k
.
add
(
a
,
u
.
copy
(
b
).
multiplyScalar
(
H
));
return
L
=
c
.
distanceTo
(
D
)}
function
d
(
a
,
b
,
c
,
d
){
p
.
sub
(
d
,
b
);
k
.
sub
(
c
,
b
);
u
.
sub
(
a
,
b
);
G
=
p
.
dot
(
p
);
t
=
p
.
dot
(
k
);
E
=
p
.
dot
(
u
);
A
=
k
.
dot
(
k
);
F
=
k
.
dot
(
u
);
r
=
1
/
(
G
*
A
-
t
*
t
);
v
=
(
A
*
E
-
t
*
F
)
*
r
;
y
=
(
G
*
F
-
t
*
E
)
*
r
;
return
v
>=
0
&&
y
>=
0
&&
v
+
y
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
k
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
p
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
p
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
k
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
I
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
h
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
k
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
p
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
p
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
k
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
I
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
p
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
I
.
x
,
Math
.
max
(
I
.
y
,
I
.
z
)))
return
k
;
var
r
,
u
,
v
=
a
.
geometry
,
C
=
v
.
vertices
,
t
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
p
=
0
;
for
(
I
=
v
.
faces
.
length
;
p
<
I
;
p
++
){
b
=
v
.
faces
[
p
];
h
.
copy
(
this
.
origin
);
l
.
copy
(
this
.
direction
);
t
=
a
.
matrixWorld
;
o
=
t
.
multiplyVector3
(
o
.
copy
(
b
.
centroid
)).
subSelf
(
h
);
m
=
a
.
matrixRotationWorld
.
multiplyVector3
(
m
.
copy
(
b
.
normal
));
r
=
l
.
dot
(
m
);
if
(
!
(
Math
.
abs
(
r
)
<
e
)){
u
=
m
.
dot
(
o
)
/
r
;
if
(
!
(
u
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
p
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
I
.
x
,
Math
.
max
(
I
.
y
,
I
.
z
)))
return
k
;
var
r
,
u
,
v
=
a
.
geometry
,
C
=
v
.
vertices
,
t
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
p
=
0
;
for
(
I
=
v
.
faces
.
length
;
p
<
I
;
p
++
){
b
=
v
.
faces
[
p
];
h
.
copy
(
this
.
origin
);
l
.
copy
(
this
.
direction
);
t
=
a
.
matrixWorld
;
o
=
t
.
multiplyVector3
(
o
.
copy
(
b
.
centroid
)).
subSelf
(
h
);
m
=
a
.
matrixRotationWorld
.
multiplyVector3
(
m
.
copy
(
b
.
normal
));
r
=
l
.
dot
(
m
);
if
(
!
(
Math
.
abs
(
r
)
<
e
)){
u
=
m
.
dot
(
o
)
/
r
;
if
(
!
(
u
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
i
=
this
.
n33
,
j
=
this
.
n43
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
-
a
*
f
;
this
.
n21
=
h
*
c
-
a
*
g
;
this
.
n31
=
h
*
d
-
a
*
i
;
this
.
n41
=
h
*
e
-
a
*
j
;
this
.
n13
=
h
*
f
+
a
*
b
;
this
.
n23
=
h
*
g
+
a
*
c
;
this
.
n33
=
h
*
i
+
a
*
d
;
this
.
n43
=
h
*
j
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
i
=
this
.
n32
,
j
=
this
.
n42
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
+
a
*
f
;
this
.
n21
=
h
*
c
+
a
*
g
;
this
.
n31
=
h
*
d
+
a
*
i
;
this
.
n41
=
h
*
e
+
a
*
j
;
this
.
n12
=
h
*
f
-
a
*
b
;
this
.
n22
=
h
*
g
-
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
i
=
this
.
n33
,
j
=
this
.
n43
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
-
a
*
f
;
this
.
n21
=
h
*
c
-
a
*
g
;
this
.
n31
=
h
*
d
-
a
*
i
;
this
.
n41
=
h
*
e
-
a
*
j
;
this
.
n13
=
h
*
f
+
a
*
b
;
this
.
n23
=
h
*
g
+
a
*
c
;
this
.
n33
=
h
*
i
+
a
*
d
;
this
.
n43
=
h
*
j
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
i
=
this
.
n32
,
j
=
this
.
n42
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
+
a
*
f
;
this
.
n21
=
h
*
c
+
a
*
g
;
this
.
n31
=
h
*
d
+
a
*
i
;
this
.
n41
=
h
*
e
+
a
*
j
;
this
.
n12
=
h
*
f
-
a
*
b
;
this
.
n22
=
h
*
g
-
a
*
c
;
this
.
n32
=
h
*
i
-
a
*
d
;
this
.
n42
=
h
*
j
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
i
=
e
*
e
,
j
=
Math
.
cos
(
b
),
h
=
Math
.
sin
(
b
),
l
=
1
-
j
,
o
=
c
*
d
*
l
,
m
=
c
*
e
*
l
,
l
=
d
*
e
*
l
,
c
=
c
*
h
,
n
=
d
*
h
,
h
=
e
*
h
,
e
=
f
+
(
1
-
f
)
*
j
,
f
=
o
+
h
,
d
=
m
-
n
,
o
=
o
-
h
,
g
=
g
+
(
1
-
g
)
*
j
,
h
=
l
+
c
,
m
=
m
+
n
,
l
=
l
-
c
,
i
=
i
+
(
1
-
i
)
*
j
,
j
=
this
.
n11
,
c
=
this
.
n21
,
n
=
this
.
n31
,
p
=
this
.
n41
,
a
*
c
;
this
.
n32
=
h
*
i
-
a
*
d
;
this
.
n42
=
h
*
j
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
i
=
e
*
e
,
j
=
Math
.
cos
(
b
),
h
=
Math
.
sin
(
b
),
l
=
1
-
j
,
o
=
c
*
d
*
l
,
m
=
c
*
e
*
l
,
l
=
d
*
e
*
l
,
c
=
c
*
h
,
n
=
d
*
h
,
h
=
e
*
h
,
e
=
f
+
(
1
-
f
)
*
j
,
f
=
o
+
h
,
d
=
m
-
n
,
o
=
o
-
h
,
g
=
g
+
(
1
-
g
)
*
j
,
h
=
l
+
c
,
m
=
m
+
n
,
l
=
l
-
c
,
i
=
i
+
(
1
-
i
)
*
j
,
j
=
this
.
n11
,
c
=
this
.
n21
,
n
=
this
.
n31
,
p
=
this
.
n41
,
k
=
this
.
n12
,
u
=
this
.
n22
,
H
=
this
.
n32
,
D
=
this
.
n42
,
L
=
this
.
n13
,
G
=
this
.
n23
,
t
=
this
.
n33
,
E
=
this
.
n43
;
this
.
n11
=
e
*
j
+
f
*
k
+
d
*
L
;
this
.
n21
=
e
*
c
+
f
*
u
+
d
*
G
;
this
.
n31
=
e
*
n
+
f
*
H
+
d
*
t
;
this
.
n41
=
e
*
p
+
f
*
D
+
d
*
E
;
this
.
n12
=
o
*
j
+
g
*
k
+
h
*
L
;
this
.
n22
=
o
*
c
+
g
*
u
+
h
*
G
;
this
.
n32
=
o
*
n
+
g
*
H
+
h
*
t
;
this
.
n42
=
o
*
p
+
g
*
D
+
h
*
E
;
this
.
n13
=
m
*
j
+
l
*
k
+
i
*
L
;
this
.
n23
=
m
*
c
+
l
*
u
+
i
*
G
;
this
.
n33
=
m
*
n
+
l
*
H
+
i
*
t
;
this
.
n43
=
m
*
p
+
l
*
D
+
i
*
E
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
k
=
this
.
n12
,
u
=
this
.
n22
,
H
=
this
.
n32
,
D
=
this
.
n42
,
L
=
this
.
n13
,
G
=
this
.
n23
,
t
=
this
.
n33
,
E
=
this
.
n43
;
this
.
n11
=
e
*
j
+
f
*
k
+
d
*
L
;
this
.
n21
=
e
*
c
+
f
*
u
+
d
*
G
;
this
.
n31
=
e
*
n
+
f
*
H
+
d
*
t
;
this
.
n41
=
e
*
p
+
f
*
D
+
d
*
E
;
this
.
n12
=
o
*
j
+
g
*
k
+
h
*
L
;
this
.
n22
=
o
*
c
+
g
*
u
+
h
*
G
;
this
.
n32
=
o
*
n
+
g
*
H
+
h
*
t
;
this
.
n42
=
o
*
p
+
g
*
D
+
h
*
E
;
this
.
n13
=
m
*
j
+
l
*
k
+
i
*
L
;
this
.
n23
=
m
*
c
+
l
*
u
+
i
*
G
;
this
.
n33
=
m
*
n
+
l
*
H
+
i
*
t
;
this
.
n43
=
m
*
p
+
l
*
D
+
i
*
E
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
getMaxScaleOnAxis
:
function
(){
return
Math
.
sqrt
(
Math
.
max
(
this
.
n11
*
this
.
n11
+
this
.
n21
*
this
.
n21
+
this
.
n31
*
this
.
n31
,
Math
.
max
(
this
.
n12
*
this
.
n12
+
this
.
n22
*
this
.
n22
+
this
.
n32
*
this
.
n32
,
this
.
n13
*
this
.
n13
+
this
.
n23
*
this
.
n23
+
this
.
n33
*
this
.
n33
)))},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
j
=
e
*
f
,
h
=
e
*
g
;
this
.
set
(
j
*
f
+
c
,
j
*
g
-
d
*
i
,
j
*
i
+
d
*
g
,
0
,
j
*
g
+
d
*
i
,
h
*
g
+
c
,
h
*
i
-
d
*
f
,
0
,
j
*
i
-
d
*
g
,
h
*
i
+
d
*
f
,
e
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
j
=
e
*
f
,
h
=
e
*
g
;
this
.
set
(
j
*
f
+
c
,
j
*
g
-
d
*
i
,
j
*
i
+
d
*
g
,
0
,
j
*
g
+
d
*
i
,
h
*
g
+
c
,
h
*
i
-
d
*
f
,
0
,
j
*
i
-
d
*
g
,
h
*
i
+
d
*
f
,
e
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
g
=
b
-
a
,
i
=
c
-
d
,
j
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
j
;
this
.
n34
=-
((
f
+
e
)
/
j
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
e
,
f
){
var
g
=
b
-
a
,
i
=
c
-
d
,
j
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
j
;
this
.
n34
=-
((
f
+
e
)
/
j
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
...
...
build/custom/ThreeDOM.js
浏览文件 @
e1edb171
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
())},
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
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
;
a
<
6
;
a
++
){
b
=
c
[
a
];
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))}};
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
;
a
<
6
;
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
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
-
a
.
geometry
.
boundingSphere
.
radius
*
c
.
getMaxScaleOnAxis
(
),
e
=
0
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
p
.
sub
(
c
,
a
);
G
=
p
.
dot
(
b
);
w
=
o
.
add
(
a
,
q
.
copy
(
b
).
multiplyScalar
(
G
));
return
C
=
c
.
distanceTo
(
w
)}
function
d
(
a
,
b
,
c
,
d
){
p
.
sub
(
d
,
b
);
o
.
sub
(
c
,
b
);
q
.
sub
(
a
,
b
);
D
=
p
.
dot
(
p
);
r
=
p
.
dot
(
o
);
x
=
p
.
dot
(
q
);
t
=
o
.
dot
(
o
);
y
=
o
.
dot
(
q
);
H
=
1
/
(
D
*
t
-
r
*
r
);
K
=
(
t
*
x
-
r
*
y
)
*
H
;
E
=
(
D
*
y
-
r
*
x
)
*
H
;
return
K
>=
0
&&
E
>=
0
&&
K
+
E
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
p
.
sub
(
c
,
a
);
G
=
p
.
dot
(
b
);
w
=
o
.
add
(
a
,
q
.
copy
(
b
).
multiplyScalar
(
G
));
return
C
=
c
.
distanceTo
(
w
)}
function
d
(
a
,
b
,
c
,
d
){
p
.
sub
(
d
,
b
);
o
.
sub
(
c
,
b
);
q
.
sub
(
a
,
b
);
D
=
p
.
dot
(
p
);
r
=
p
.
dot
(
o
);
x
=
p
.
dot
(
q
);
t
=
o
.
dot
(
o
);
y
=
o
.
dot
(
q
);
H
=
1
/
(
D
*
t
-
r
*
r
);
K
=
(
t
*
x
-
r
*
y
)
*
H
;
E
=
(
D
*
y
-
r
*
x
)
*
H
;
return
K
>=
0
&&
E
>=
0
&&
K
+
E
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
o
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
p
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
p
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
o
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
M
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
h
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
o
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
p
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
p
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
o
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
M
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
p
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
M
.
x
,
Math
.
max
(
M
.
y
,
M
.
z
)))
return
o
;
var
q
,
r
,
t
=
a
.
geometry
,
A
=
t
.
vertices
,
u
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
p
=
0
;
for
(
M
=
t
.
faces
.
length
;
p
<
M
;
p
++
){
b
=
t
.
faces
[
p
];
h
.
copy
(
this
.
origin
);
j
.
copy
(
this
.
direction
);
u
=
a
.
matrixWorld
;
l
=
u
.
multiplyVector3
(
l
.
copy
(
b
.
centroid
)).
subSelf
(
h
);
n
=
a
.
matrixRotationWorld
.
multiplyVector3
(
n
.
copy
(
b
.
normal
));
q
=
j
.
dot
(
n
);
if
(
!
(
Math
.
abs
(
q
)
<
e
)){
r
=
n
.
dot
(
l
)
/
q
;
if
(
!
(
r
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
p
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
M
.
x
,
Math
.
max
(
M
.
y
,
M
.
z
)))
return
o
;
var
q
,
r
,
t
=
a
.
geometry
,
A
=
t
.
vertices
,
u
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
p
=
0
;
for
(
M
=
t
.
faces
.
length
;
p
<
M
;
p
++
){
b
=
t
.
faces
[
p
];
h
.
copy
(
this
.
origin
);
j
.
copy
(
this
.
direction
);
u
=
a
.
matrixWorld
;
l
=
u
.
multiplyVector3
(
l
.
copy
(
b
.
centroid
)).
subSelf
(
h
);
n
=
a
.
matrixRotationWorld
.
multiplyVector3
(
n
.
copy
(
b
.
normal
));
q
=
j
.
dot
(
n
);
if
(
!
(
Math
.
abs
(
q
)
<
e
)){
r
=
n
.
dot
(
l
)
/
q
;
if
(
!
(
r
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
i
=
this
.
n33
,
k
=
this
.
n43
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
-
a
*
f
;
this
.
n21
=
h
*
c
-
a
*
g
;
this
.
n31
=
h
*
d
-
a
*
i
;
this
.
n41
=
h
*
e
-
a
*
k
;
this
.
n13
=
h
*
f
+
a
*
b
;
this
.
n23
=
h
*
g
+
a
*
c
;
this
.
n33
=
h
*
i
+
a
*
d
;
this
.
n43
=
h
*
k
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
i
=
this
.
n32
,
k
=
this
.
n42
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
+
a
*
f
;
this
.
n21
=
h
*
c
+
a
*
g
;
this
.
n31
=
h
*
d
+
a
*
i
;
this
.
n41
=
h
*
e
+
a
*
k
;
this
.
n12
=
h
*
f
-
a
*
b
;
this
.
n22
=
h
*
g
-
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
i
=
this
.
n33
,
k
=
this
.
n43
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
-
a
*
f
;
this
.
n21
=
h
*
c
-
a
*
g
;
this
.
n31
=
h
*
d
-
a
*
i
;
this
.
n41
=
h
*
e
-
a
*
k
;
this
.
n13
=
h
*
f
+
a
*
b
;
this
.
n23
=
h
*
g
+
a
*
c
;
this
.
n33
=
h
*
i
+
a
*
d
;
this
.
n43
=
h
*
k
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
i
=
this
.
n32
,
k
=
this
.
n42
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
+
a
*
f
;
this
.
n21
=
h
*
c
+
a
*
g
;
this
.
n31
=
h
*
d
+
a
*
i
;
this
.
n41
=
h
*
e
+
a
*
k
;
this
.
n12
=
h
*
f
-
a
*
b
;
this
.
n22
=
h
*
g
-
a
*
c
;
this
.
n32
=
h
*
i
-
a
*
d
;
this
.
n42
=
h
*
k
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
i
=
e
*
e
,
k
=
Math
.
cos
(
b
),
h
=
Math
.
sin
(
b
),
j
=
1
-
k
,
l
=
c
*
d
*
j
,
n
=
c
*
e
*
j
,
j
=
d
*
e
*
j
,
c
=
c
*
h
,
m
=
d
*
h
,
h
=
e
*
h
,
e
=
f
+
(
1
-
f
)
*
k
,
f
=
l
+
h
,
d
=
n
-
m
,
l
=
l
-
h
,
g
=
g
+
(
1
-
g
)
*
k
,
h
=
j
+
c
,
n
=
n
+
m
,
j
=
j
-
c
,
i
=
i
+
(
1
-
i
)
*
k
,
k
=
this
.
n11
,
c
=
this
.
n21
,
m
=
this
.
n31
,
p
=
this
.
n41
,
a
*
c
;
this
.
n32
=
h
*
i
-
a
*
d
;
this
.
n42
=
h
*
k
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
i
=
e
*
e
,
k
=
Math
.
cos
(
b
),
h
=
Math
.
sin
(
b
),
j
=
1
-
k
,
l
=
c
*
d
*
j
,
n
=
c
*
e
*
j
,
j
=
d
*
e
*
j
,
c
=
c
*
h
,
m
=
d
*
h
,
h
=
e
*
h
,
e
=
f
+
(
1
-
f
)
*
k
,
f
=
l
+
h
,
d
=
n
-
m
,
l
=
l
-
h
,
g
=
g
+
(
1
-
g
)
*
k
,
h
=
j
+
c
,
n
=
n
+
m
,
j
=
j
-
c
,
i
=
i
+
(
1
-
i
)
*
k
,
k
=
this
.
n11
,
c
=
this
.
n21
,
m
=
this
.
n31
,
p
=
this
.
n41
,
o
=
this
.
n12
,
q
=
this
.
n22
,
G
=
this
.
n32
,
w
=
this
.
n42
,
C
=
this
.
n13
,
D
=
this
.
n23
,
r
=
this
.
n33
,
x
=
this
.
n43
;
this
.
n11
=
e
*
k
+
f
*
o
+
d
*
C
;
this
.
n21
=
e
*
c
+
f
*
q
+
d
*
D
;
this
.
n31
=
e
*
m
+
f
*
G
+
d
*
r
;
this
.
n41
=
e
*
p
+
f
*
w
+
d
*
x
;
this
.
n12
=
l
*
k
+
g
*
o
+
h
*
C
;
this
.
n22
=
l
*
c
+
g
*
q
+
h
*
D
;
this
.
n32
=
l
*
m
+
g
*
G
+
h
*
r
;
this
.
n42
=
l
*
p
+
g
*
w
+
h
*
x
;
this
.
n13
=
n
*
k
+
j
*
o
+
i
*
C
;
this
.
n23
=
n
*
c
+
j
*
q
+
i
*
D
;
this
.
n33
=
n
*
m
+
j
*
G
+
i
*
r
;
this
.
n43
=
n
*
p
+
j
*
w
+
i
*
x
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
o
=
this
.
n12
,
q
=
this
.
n22
,
G
=
this
.
n32
,
w
=
this
.
n42
,
C
=
this
.
n13
,
D
=
this
.
n23
,
r
=
this
.
n33
,
x
=
this
.
n43
;
this
.
n11
=
e
*
k
+
f
*
o
+
d
*
C
;
this
.
n21
=
e
*
c
+
f
*
q
+
d
*
D
;
this
.
n31
=
e
*
m
+
f
*
G
+
d
*
r
;
this
.
n41
=
e
*
p
+
f
*
w
+
d
*
x
;
this
.
n12
=
l
*
k
+
g
*
o
+
h
*
C
;
this
.
n22
=
l
*
c
+
g
*
q
+
h
*
D
;
this
.
n32
=
l
*
m
+
g
*
G
+
h
*
r
;
this
.
n42
=
l
*
p
+
g
*
w
+
h
*
x
;
this
.
n13
=
n
*
k
+
j
*
o
+
i
*
C
;
this
.
n23
=
n
*
c
+
j
*
q
+
i
*
D
;
this
.
n33
=
n
*
m
+
j
*
G
+
i
*
r
;
this
.
n43
=
n
*
p
+
j
*
w
+
i
*
x
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
getMaxScaleOnAxis
:
function
(){
return
Math
.
sqrt
(
Math
.
max
(
this
.
n11
*
this
.
n11
+
this
.
n21
*
this
.
n21
+
this
.
n31
*
this
.
n31
,
Math
.
max
(
this
.
n12
*
this
.
n12
+
this
.
n22
*
this
.
n22
+
this
.
n32
*
this
.
n32
,
this
.
n13
*
this
.
n13
+
this
.
n23
*
this
.
n23
+
this
.
n33
*
this
.
n33
)))},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
k
=
e
*
f
,
h
=
e
*
g
;
this
.
set
(
k
*
f
+
c
,
k
*
g
-
d
*
i
,
k
*
i
+
d
*
g
,
0
,
k
*
g
+
d
*
i
,
h
*
g
+
c
,
h
*
i
-
d
*
f
,
0
,
k
*
i
-
d
*
g
,
h
*
i
+
d
*
f
,
e
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
k
=
e
*
f
,
h
=
e
*
g
;
this
.
set
(
k
*
f
+
c
,
k
*
g
-
d
*
i
,
k
*
i
+
d
*
g
,
0
,
k
*
g
+
d
*
i
,
h
*
g
+
c
,
h
*
i
-
d
*
f
,
0
,
k
*
i
-
d
*
g
,
h
*
i
+
d
*
f
,
e
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
g
=
b
-
a
,
i
=
c
-
d
,
k
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
k
;
this
.
n34
=-
((
f
+
e
)
/
k
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
e
,
f
){
var
g
=
b
-
a
,
i
=
c
-
d
,
k
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
k
;
this
.
n34
=-
((
f
+
e
)
/
k
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
...
...
build/custom/ThreeSVG.js
浏览文件 @
e1edb171
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
())},
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
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
;
a
<
6
;
a
++
){
b
=
c
[
a
];
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))}};
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
;
a
<
6
;
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
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
-
a
.
geometry
.
boundingSphere
.
radius
*
c
.
getMaxScaleOnAxis
(
),
e
=
0
;
e
<
6
;
e
++
){
a
=
b
[
e
].
x
*
c
.
n14
+
b
[
e
].
y
*
c
.
n24
+
b
[
e
].
z
*
c
.
n34
+
b
[
e
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
o
.
sub
(
c
,
a
);
H
=
o
.
dot
(
b
);
w
=
p
.
add
(
a
,
u
.
copy
(
b
).
multiplyScalar
(
H
));
return
D
=
c
.
distanceTo
(
w
)}
function
d
(
a
,
b
,
c
,
d
){
o
.
sub
(
d
,
b
);
p
.
sub
(
c
,
b
);
u
.
sub
(
a
,
b
);
s
=
o
.
dot
(
o
);
t
=
o
.
dot
(
p
);
y
=
o
.
dot
(
u
);
x
=
p
.
dot
(
p
);
z
=
p
.
dot
(
u
);
E
=
1
/
(
s
*
x
-
t
*
t
);
B
=
(
x
*
y
-
t
*
z
)
*
E
;
F
=
(
s
*
z
-
t
*
y
)
*
E
;
return
B
>=
0
&&
F
>=
0
&&
B
+
F
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
o
.
sub
(
c
,
a
);
H
=
o
.
dot
(
b
);
w
=
p
.
add
(
a
,
u
.
copy
(
b
).
multiplyScalar
(
H
));
return
D
=
c
.
distanceTo
(
w
)}
function
d
(
a
,
b
,
c
,
d
){
o
.
sub
(
d
,
b
);
p
.
sub
(
c
,
b
);
u
.
sub
(
a
,
b
);
s
=
o
.
dot
(
o
);
t
=
o
.
dot
(
p
);
y
=
o
.
dot
(
u
);
x
=
p
.
dot
(
p
);
z
=
p
.
dot
(
u
);
E
=
1
/
(
s
*
x
-
t
*
t
);
B
=
(
x
*
y
-
t
*
z
)
*
E
;
F
=
(
s
*
z
-
t
*
y
)
*
E
;
return
B
>=
0
&&
F
>=
0
&&
B
+
F
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
e
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
e
=
a
};
var
f
=
new
THREE
.
Vector3
,
g
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
o
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
p
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
p
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
o
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
N
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
h
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
o
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
p
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
p
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
o
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
p
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
N
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
p
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
N
.
x
,
Math
.
max
(
N
.
y
,
N
.
z
)))
return
o
;
var
s
,
t
,
u
=
a
.
geometry
,
r
=
u
.
vertices
,
q
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
p
=
0
;
for
(
N
=
u
.
faces
.
length
;
p
<
N
;
p
++
){
b
=
u
.
faces
[
p
];
h
.
copy
(
this
.
origin
);
k
.
copy
(
this
.
direction
);
q
=
a
.
matrixWorld
;
m
=
q
.
multiplyVector3
(
m
.
copy
(
b
.
centroid
)).
subSelf
(
h
);
n
=
a
.
matrixRotationWorld
.
multiplyVector3
(
n
.
copy
(
b
.
normal
));
s
=
k
.
dot
(
n
);
if
(
!
(
Math
.
abs
(
s
)
<
e
)){
t
=
n
.
dot
(
m
)
/
s
;
if
(
!
(
t
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
p
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
N
.
x
,
Math
.
max
(
N
.
y
,
N
.
z
)))
return
o
;
var
s
,
t
,
u
=
a
.
geometry
,
r
=
u
.
vertices
,
q
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
p
=
0
;
for
(
N
=
u
.
faces
.
length
;
p
<
N
;
p
++
){
b
=
u
.
faces
[
p
];
h
.
copy
(
this
.
origin
);
k
.
copy
(
this
.
direction
);
q
=
a
.
matrixWorld
;
m
=
q
.
multiplyVector3
(
m
.
copy
(
b
.
centroid
)).
subSelf
(
h
);
n
=
a
.
matrixRotationWorld
.
multiplyVector3
(
n
.
copy
(
b
.
normal
));
s
=
k
.
dot
(
n
);
if
(
!
(
Math
.
abs
(
s
)
<
e
)){
t
=
n
.
dot
(
m
)
/
s
;
if
(
!
(
t
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
i
=
this
.
n33
,
j
=
this
.
n43
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
-
a
*
f
;
this
.
n21
=
h
*
c
-
a
*
g
;
this
.
n31
=
h
*
d
-
a
*
i
;
this
.
n41
=
h
*
e
-
a
*
j
;
this
.
n13
=
h
*
f
+
a
*
b
;
this
.
n23
=
h
*
g
+
a
*
c
;
this
.
n33
=
h
*
i
+
a
*
d
;
this
.
n43
=
h
*
j
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
i
=
this
.
n32
,
j
=
this
.
n42
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
+
a
*
f
;
this
.
n21
=
h
*
c
+
a
*
g
;
this
.
n31
=
h
*
d
+
a
*
i
;
this
.
n41
=
h
*
e
+
a
*
j
;
this
.
n12
=
h
*
f
-
a
*
b
;
this
.
n22
=
h
*
g
-
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n13
,
g
=
this
.
n23
,
i
=
this
.
n33
,
j
=
this
.
n43
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
-
a
*
f
;
this
.
n21
=
h
*
c
-
a
*
g
;
this
.
n31
=
h
*
d
-
a
*
i
;
this
.
n41
=
h
*
e
-
a
*
j
;
this
.
n13
=
h
*
f
+
a
*
b
;
this
.
n23
=
h
*
g
+
a
*
c
;
this
.
n33
=
h
*
i
+
a
*
d
;
this
.
n43
=
h
*
j
+
a
*
e
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
e
=
this
.
n41
,
f
=
this
.
n12
,
g
=
this
.
n22
,
i
=
this
.
n32
,
j
=
this
.
n42
,
h
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
h
*
b
+
a
*
f
;
this
.
n21
=
h
*
c
+
a
*
g
;
this
.
n31
=
h
*
d
+
a
*
i
;
this
.
n41
=
h
*
e
+
a
*
j
;
this
.
n12
=
h
*
f
-
a
*
b
;
this
.
n22
=
h
*
g
-
a
*
c
;
this
.
n32
=
h
*
i
-
a
*
d
;
this
.
n42
=
h
*
j
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
i
=
e
*
e
,
j
=
Math
.
cos
(
b
),
h
=
Math
.
sin
(
b
),
k
=
1
-
j
,
m
=
c
*
d
*
k
,
n
=
c
*
e
*
k
,
k
=
d
*
e
*
k
,
c
=
c
*
h
,
l
=
d
*
h
,
h
=
e
*
h
,
e
=
f
+
(
1
-
f
)
*
j
,
f
=
m
+
h
,
d
=
n
-
l
,
m
=
m
-
h
,
g
=
g
+
(
1
-
g
)
*
j
,
h
=
k
+
c
,
n
=
n
+
l
,
k
=
k
-
c
,
i
=
i
+
(
1
-
i
)
*
j
,
j
=
this
.
n11
,
c
=
this
.
n21
,
l
=
this
.
n31
,
o
=
this
.
n41
,
a
*
c
;
this
.
n32
=
h
*
i
-
a
*
d
;
this
.
n42
=
h
*
j
-
a
*
e
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
e
*
e
),
c
=
c
/
f
,
d
=
d
/
f
,
e
=
e
/
f
,
f
=
c
*
c
,
g
=
d
*
d
,
i
=
e
*
e
,
j
=
Math
.
cos
(
b
),
h
=
Math
.
sin
(
b
),
k
=
1
-
j
,
m
=
c
*
d
*
k
,
n
=
c
*
e
*
k
,
k
=
d
*
e
*
k
,
c
=
c
*
h
,
l
=
d
*
h
,
h
=
e
*
h
,
e
=
f
+
(
1
-
f
)
*
j
,
f
=
m
+
h
,
d
=
n
-
l
,
m
=
m
-
h
,
g
=
g
+
(
1
-
g
)
*
j
,
h
=
k
+
c
,
n
=
n
+
l
,
k
=
k
-
c
,
i
=
i
+
(
1
-
i
)
*
j
,
j
=
this
.
n11
,
c
=
this
.
n21
,
l
=
this
.
n31
,
o
=
this
.
n41
,
p
=
this
.
n12
,
u
=
this
.
n22
,
H
=
this
.
n32
,
w
=
this
.
n42
,
D
=
this
.
n13
,
s
=
this
.
n23
,
t
=
this
.
n33
,
y
=
this
.
n43
;
this
.
n11
=
e
*
j
+
f
*
p
+
d
*
D
;
this
.
n21
=
e
*
c
+
f
*
u
+
d
*
s
;
this
.
n31
=
e
*
l
+
f
*
H
+
d
*
t
;
this
.
n41
=
e
*
o
+
f
*
w
+
d
*
y
;
this
.
n12
=
m
*
j
+
g
*
p
+
h
*
D
;
this
.
n22
=
m
*
c
+
g
*
u
+
h
*
s
;
this
.
n32
=
m
*
l
+
g
*
H
+
h
*
t
;
this
.
n42
=
m
*
o
+
g
*
w
+
h
*
y
;
this
.
n13
=
n
*
j
+
k
*
p
+
i
*
D
;
this
.
n23
=
n
*
c
+
k
*
u
+
i
*
s
;
this
.
n33
=
n
*
l
+
k
*
H
+
i
*
t
;
this
.
n43
=
n
*
o
+
k
*
w
+
i
*
y
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
p
=
this
.
n12
,
u
=
this
.
n22
,
H
=
this
.
n32
,
w
=
this
.
n42
,
D
=
this
.
n13
,
s
=
this
.
n23
,
t
=
this
.
n33
,
y
=
this
.
n43
;
this
.
n11
=
e
*
j
+
f
*
p
+
d
*
D
;
this
.
n21
=
e
*
c
+
f
*
u
+
d
*
s
;
this
.
n31
=
e
*
l
+
f
*
H
+
d
*
t
;
this
.
n41
=
e
*
o
+
f
*
w
+
d
*
y
;
this
.
n12
=
m
*
j
+
g
*
p
+
h
*
D
;
this
.
n22
=
m
*
c
+
g
*
u
+
h
*
s
;
this
.
n32
=
m
*
l
+
g
*
H
+
h
*
t
;
this
.
n42
=
m
*
o
+
g
*
w
+
h
*
y
;
this
.
n13
=
n
*
j
+
k
*
p
+
i
*
D
;
this
.
n23
=
n
*
c
+
k
*
u
+
i
*
s
;
this
.
n33
=
n
*
l
+
k
*
H
+
i
*
t
;
this
.
n43
=
n
*
o
+
k
*
w
+
i
*
y
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
getMaxScaleOnAxis
:
function
(){
return
Math
.
sqrt
(
Math
.
max
(
this
.
n11
*
this
.
n11
+
this
.
n21
*
this
.
n21
+
this
.
n31
*
this
.
n31
,
Math
.
max
(
this
.
n12
*
this
.
n12
+
this
.
n22
*
this
.
n22
+
this
.
n32
*
this
.
n32
,
this
.
n13
*
this
.
n13
+
this
.
n23
*
this
.
n23
+
this
.
n33
*
this
.
n33
)))},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
j
=
e
*
f
,
h
=
e
*
g
;
this
.
set
(
j
*
f
+
c
,
j
*
g
-
d
*
i
,
j
*
i
+
d
*
g
,
0
,
j
*
g
+
d
*
i
,
h
*
g
+
c
,
h
*
i
-
d
*
f
,
0
,
j
*
i
-
d
*
g
,
h
*
i
+
d
*
f
,
e
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
e
=
1
-
c
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
j
=
e
*
f
,
h
=
e
*
g
;
this
.
set
(
j
*
f
+
c
,
j
*
g
-
d
*
i
,
j
*
i
+
d
*
g
,
0
,
j
*
g
+
d
*
i
,
h
*
g
+
c
,
h
*
i
-
d
*
f
,
0
,
j
*
i
-
d
*
g
,
h
*
i
+
d
*
f
,
e
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
g
=
b
-
a
,
i
=
c
-
d
,
j
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
j
;
this
.
n34
=-
((
f
+
e
)
/
j
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
n11
=
2
*
e
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
e
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
f
+
e
)
/
(
f
-
e
);
this
.
n34
=-
2
*
f
*
e
/
(
f
-
e
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
e
=-
a
;
return
this
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
e
,
f
){
var
g
=
b
-
a
,
i
=
c
-
d
,
j
=
f
-
e
;
this
.
n11
=
2
/
g
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
g
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
j
;
this
.
n34
=-
((
f
+
e
)
/
j
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
...
...
build/custom/ThreeWebGL.js
浏览文件 @
e1edb171
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
...
@@ -19,7 +19,7 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
())},
this
.
x
-
a
.
x
;
this
.
y
=
this
.
y
-
a
.
y
;
this
.
z
=
this
.
z
-
a
.
z
;
this
.
w
=
this
.
w
-
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
=
this
.
x
*
a
;
this
.
y
=
this
.
y
*
a
;
this
.
z
=
this
.
z
*
a
;
this
.
w
=
this
.
w
*
a
;
return
this
},
divideScalar
:
function
(
a
){
if
(
a
){
this
.
x
=
this
.
x
/
a
;
this
.
y
=
this
.
y
/
a
;
this
.
z
=
this
.
z
/
a
;
this
.
w
=
this
.
w
/
a
}
else
{
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
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
=
this
.
x
+
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
=
this
.
y
+
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
=
this
.
z
+
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
=
this
.
w
+
(
a
.
w
-
this
.
w
)
*
b
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)}};
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
;
a
<
6
;
a
++
){
b
=
c
[
a
];
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))}};
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
;
a
<
6
;
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
;
f
<
6
;
f
++
){
a
=
b
[
f
].
x
*
c
.
n14
+
b
[
f
].
y
*
c
.
n24
+
b
[
f
].
z
*
c
.
n34
+
b
[
f
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
-
a
.
geometry
.
boundingSphere
.
radius
*
c
.
getMaxScaleOnAxis
(
),
f
=
0
;
f
<
6
;
f
++
){
a
=
b
[
f
].
x
*
c
.
n14
+
b
[
f
].
y
*
c
.
n24
+
b
[
f
].
z
*
c
.
n34
+
b
[
f
].
w
;
if
(
a
<=
d
)
return
false
}
return
true
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
r
.
sub
(
c
,
a
);
z
=
r
.
dot
(
b
);
w
=
n
.
add
(
a
,
t
.
copy
(
b
).
multiplyScalar
(
z
));
return
P
=
c
.
distanceTo
(
w
)}
function
d
(
a
,
b
,
c
,
d
){
r
.
sub
(
d
,
b
);
n
.
sub
(
c
,
b
);
t
.
sub
(
a
,
b
);
A
=
r
.
dot
(
r
);
q
=
r
.
dot
(
n
);
G
=
r
.
dot
(
t
);
H
=
n
.
dot
(
n
);
M
=
n
.
dot
(
t
);
I
=
1
/
(
A
*
H
-
q
*
q
);
K
=
(
H
*
G
-
q
*
M
)
*
I
;
N
=
(
A
*
M
-
q
*
G
)
*
I
;
return
K
>=
0
&&
N
>=
0
&&
K
+
N
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
f
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
f
=
a
};
var
g
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
r
.
sub
(
c
,
a
);
z
=
r
.
dot
(
b
);
w
=
n
.
add
(
a
,
t
.
copy
(
b
).
multiplyScalar
(
z
));
return
P
=
c
.
distanceTo
(
w
)}
function
d
(
a
,
b
,
c
,
d
){
r
.
sub
(
d
,
b
);
n
.
sub
(
c
,
b
);
t
.
sub
(
a
,
b
);
A
=
r
.
dot
(
r
);
q
=
r
.
dot
(
n
);
G
=
r
.
dot
(
t
);
H
=
n
.
dot
(
n
);
M
=
n
.
dot
(
t
);
I
=
1
/
(
A
*
H
-
q
*
q
);
K
=
(
H
*
G
-
q
*
M
)
*
I
;
N
=
(
A
*
M
-
q
*
G
)
*
I
;
return
K
>=
0
&&
N
>=
0
&&
K
+
N
<
1
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
var
f
=
1.0
E
-
4
;
this
.
setPrecision
=
function
(
a
){
f
=
a
};
var
g
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
u
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
r
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
n
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
n
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
n
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
r
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
n
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
t
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
j
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
,
o
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
u
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
var
b
,
r
=
[];
if
(
a
instanceof
THREE
.
Particle
){
var
n
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
n
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
n
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
r
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
var
n
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
()),
t
=
THREE
.
Frustum
.
__v1
.
set
(
a
.
matrixWorld
.
getColumnX
().
length
(),
a
.
matrixWorld
.
getColumnY
().
length
(),
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
n
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
t
.
x
,
Math
.
max
(
t
.
y
,
t
.
z
)))
return
r
;
var
q
,
e
,
w
=
a
.
geometry
,
z
=
w
.
vertices
,
A
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
n
=
0
;
for
(
t
=
w
.
faces
.
length
;
n
<
t
;
n
++
){
b
=
w
.
faces
[
n
];
j
.
copy
(
this
.
origin
);
m
.
copy
(
this
.
direction
);
A
=
a
.
matrixWorld
;
o
=
A
.
multiplyVector3
(
o
.
copy
(
b
.
centroid
)).
subSelf
(
j
);
l
=
a
.
matrixRotationWorld
.
multiplyVector3
(
l
.
copy
(
b
.
normal
));
q
=
m
.
dot
(
l
);
if
(
!
(
Math
.
abs
(
q
)
<
f
)){
e
=
l
.
dot
(
o
)
/
q
;
if
(
!
(
e
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
a
.
matrixWorld
.
getColumnZ
().
length
());
if
(
n
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
t
.
x
,
Math
.
max
(
t
.
y
,
t
.
z
)))
return
r
;
var
q
,
e
,
w
=
a
.
geometry
,
z
=
w
.
vertices
,
A
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
n
=
0
;
for
(
t
=
w
.
faces
.
length
;
n
<
t
;
n
++
){
b
=
w
.
faces
[
n
];
j
.
copy
(
this
.
origin
);
m
.
copy
(
this
.
direction
);
A
=
a
.
matrixWorld
;
o
=
A
.
multiplyVector3
(
o
.
copy
(
b
.
centroid
)).
subSelf
(
j
);
l
=
a
.
matrixRotationWorld
.
multiplyVector3
(
l
.
copy
(
b
.
normal
));
q
=
m
.
dot
(
l
);
if
(
!
(
Math
.
abs
(
q
)
<
f
)){
e
=
l
.
dot
(
o
)
/
q
;
if
(
!
(
e
<
0
)
&&
(
a
.
doubleSided
||
(
a
.
flipSided
?
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
...
@@ -52,10 +52,11 @@ c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n3
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
f
=
this
.
n41
,
g
=
this
.
n13
,
h
=
this
.
n23
,
i
=
this
.
n33
,
k
=
this
.
n43
,
j
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
j
*
b
-
a
*
g
;
this
.
n21
=
j
*
c
-
a
*
h
;
this
.
n31
=
j
*
d
-
a
*
i
;
this
.
n41
=
j
*
f
-
a
*
k
;
this
.
n13
=
j
*
g
+
a
*
b
;
this
.
n23
=
j
*
h
+
a
*
c
;
this
.
n33
=
j
*
i
+
a
*
d
;
this
.
n43
=
j
*
k
+
a
*
f
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
f
=
this
.
n41
,
g
=
this
.
n12
,
h
=
this
.
n22
,
i
=
this
.
n32
,
k
=
this
.
n42
,
j
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
j
*
b
+
a
*
g
;
this
.
n21
=
j
*
c
+
a
*
h
;
this
.
n31
=
j
*
d
+
a
*
i
;
this
.
n41
=
j
*
f
+
a
*
k
;
this
.
n12
=
j
*
g
-
a
*
b
;
this
.
n22
=
j
*
h
-
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
f
=
this
.
n41
,
g
=
this
.
n13
,
h
=
this
.
n23
,
i
=
this
.
n33
,
k
=
this
.
n43
,
j
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
j
*
b
-
a
*
g
;
this
.
n21
=
j
*
c
-
a
*
h
;
this
.
n31
=
j
*
d
-
a
*
i
;
this
.
n41
=
j
*
f
-
a
*
k
;
this
.
n13
=
j
*
g
+
a
*
b
;
this
.
n23
=
j
*
h
+
a
*
c
;
this
.
n33
=
j
*
i
+
a
*
d
;
this
.
n43
=
j
*
k
+
a
*
f
;
return
this
},
rotateZ
:
function
(
a
){
var
b
=
this
.
n11
,
c
=
this
.
n21
,
d
=
this
.
n31
,
f
=
this
.
n41
,
g
=
this
.
n12
,
h
=
this
.
n22
,
i
=
this
.
n32
,
k
=
this
.
n42
,
j
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
n11
=
j
*
b
+
a
*
g
;
this
.
n21
=
j
*
c
+
a
*
h
;
this
.
n31
=
j
*
d
+
a
*
i
;
this
.
n41
=
j
*
f
+
a
*
k
;
this
.
n12
=
j
*
g
-
a
*
b
;
this
.
n22
=
j
*
h
-
a
*
c
;
this
.
n32
=
j
*
i
-
a
*
d
;
this
.
n42
=
j
*
k
-
a
*
f
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
f
=
a
.
z
,
g
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
f
*
f
),
c
=
c
/
g
,
d
=
d
/
g
,
f
=
f
/
g
,
g
=
c
*
c
,
h
=
d
*
d
,
i
=
f
*
f
,
k
=
Math
.
cos
(
b
),
j
=
Math
.
sin
(
b
),
m
=
1
-
k
,
o
=
c
*
d
*
m
,
l
=
c
*
f
*
m
,
m
=
d
*
f
*
m
,
c
=
c
*
j
,
u
=
d
*
j
,
j
=
f
*
j
,
f
=
g
+
(
1
-
g
)
*
k
,
g
=
o
+
j
,
d
=
l
-
u
,
o
=
o
-
j
,
h
=
h
+
(
1
-
h
)
*
k
,
j
=
m
+
c
,
l
=
l
+
u
,
m
=
m
-
c
,
i
=
i
+
(
1
-
i
)
*
k
,
k
=
this
.
n11
,
c
=
this
.
n21
,
u
=
this
.
n31
,
r
=
this
.
n41
,
a
*
c
;
this
.
n32
=
j
*
i
-
a
*
d
;
this
.
n42
=
j
*
k
-
a
*
f
;
return
this
},
rotateByAxis
:
function
(
a
,
b
){
if
(
a
.
x
===
1
&&
a
.
y
===
0
&&
a
.
z
===
0
)
return
this
.
rotateX
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
1
&&
a
.
z
===
0
)
return
this
.
rotateY
(
b
);
if
(
a
.
x
===
0
&&
a
.
y
===
0
&&
a
.
z
===
1
)
return
this
.
rotateZ
(
b
);
var
c
=
a
.
x
,
d
=
a
.
y
,
f
=
a
.
z
,
g
=
Math
.
sqrt
(
c
*
c
+
d
*
d
+
f
*
f
),
c
=
c
/
g
,
d
=
d
/
g
,
f
=
f
/
g
,
g
=
c
*
c
,
h
=
d
*
d
,
i
=
f
*
f
,
k
=
Math
.
cos
(
b
),
j
=
Math
.
sin
(
b
),
m
=
1
-
k
,
o
=
c
*
d
*
m
,
l
=
c
*
f
*
m
,
m
=
d
*
f
*
m
,
c
=
c
*
j
,
u
=
d
*
j
,
j
=
f
*
j
,
f
=
g
+
(
1
-
g
)
*
k
,
g
=
o
+
j
,
d
=
l
-
u
,
o
=
o
-
j
,
h
=
h
+
(
1
-
h
)
*
k
,
j
=
m
+
c
,
l
=
l
+
u
,
m
=
m
-
c
,
i
=
i
+
(
1
-
i
)
*
k
,
k
=
this
.
n11
,
c
=
this
.
n21
,
u
=
this
.
n31
,
r
=
this
.
n41
,
n
=
this
.
n12
,
t
=
this
.
n22
,
z
=
this
.
n32
,
w
=
this
.
n42
,
P
=
this
.
n13
,
A
=
this
.
n23
,
q
=
this
.
n33
,
G
=
this
.
n43
;
this
.
n11
=
f
*
k
+
g
*
n
+
d
*
P
;
this
.
n21
=
f
*
c
+
g
*
t
+
d
*
A
;
this
.
n31
=
f
*
u
+
g
*
z
+
d
*
q
;
this
.
n41
=
f
*
r
+
g
*
w
+
d
*
G
;
this
.
n12
=
o
*
k
+
h
*
n
+
j
*
P
;
this
.
n22
=
o
*
c
+
h
*
t
+
j
*
A
;
this
.
n32
=
o
*
u
+
h
*
z
+
j
*
q
;
this
.
n42
=
o
*
r
+
h
*
w
+
j
*
G
;
this
.
n13
=
l
*
k
+
m
*
n
+
i
*
P
;
this
.
n23
=
l
*
c
+
m
*
t
+
i
*
A
;
this
.
n33
=
l
*
u
+
m
*
z
+
i
*
q
;
this
.
n43
=
l
*
r
+
m
*
w
+
i
*
G
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
n
=
this
.
n12
,
t
=
this
.
n22
,
z
=
this
.
n32
,
w
=
this
.
n42
,
P
=
this
.
n13
,
A
=
this
.
n23
,
q
=
this
.
n33
,
G
=
this
.
n43
;
this
.
n11
=
f
*
k
+
g
*
n
+
d
*
P
;
this
.
n21
=
f
*
c
+
g
*
t
+
d
*
A
;
this
.
n31
=
f
*
u
+
g
*
z
+
d
*
q
;
this
.
n41
=
f
*
r
+
g
*
w
+
d
*
G
;
this
.
n12
=
o
*
k
+
h
*
n
+
j
*
P
;
this
.
n22
=
o
*
c
+
h
*
t
+
j
*
A
;
this
.
n32
=
o
*
u
+
h
*
z
+
j
*
q
;
this
.
n42
=
o
*
r
+
h
*
w
+
j
*
G
;
this
.
n13
=
l
*
k
+
m
*
n
+
i
*
P
;
this
.
n23
=
l
*
c
+
m
*
t
+
i
*
A
;
this
.
n33
=
l
*
u
+
m
*
z
+
i
*
q
;
this
.
n43
=
l
*
r
+
m
*
w
+
i
*
G
;
return
this
},
scale
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
a
=
a
.
z
;
this
.
n11
=
this
.
n11
*
b
;
this
.
n12
=
this
.
n12
*
c
;
this
.
n13
=
this
.
n13
*
a
;
this
.
n21
=
this
.
n21
*
b
;
this
.
n22
=
this
.
n22
*
c
;
this
.
n23
=
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
this
.
n23
*
a
;
this
.
n31
=
this
.
n31
*
b
;
this
.
n32
=
this
.
n32
*
c
;
this
.
n33
=
this
.
n33
*
a
;
this
.
n41
=
this
.
n41
*
b
;
this
.
n42
=
this
.
n42
*
c
;
this
.
n43
=
this
.
n43
*
a
;
return
this
},
getMaxScaleOnAxis
:
function
(){
return
Math
.
sqrt
(
Math
.
max
(
this
.
n11
*
this
.
n11
+
this
.
n21
*
this
.
n21
+
this
.
n31
*
this
.
n31
,
Math
.
max
(
this
.
n12
*
this
.
n12
+
this
.
n22
*
this
.
n22
+
this
.
n32
*
this
.
n32
,
this
.
n13
*
this
.
n13
+
this
.
n23
*
this
.
n23
+
this
.
n33
*
this
.
n33
)))},
makeTranslation
:
function
(
a
,
b
,
c
){
this
.
set
(
1
,
0
,
0
,
a
,
0
,
1
,
0
,
b
,
0
,
0
,
1
,
c
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationX
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
f
=
1
-
c
,
g
=
a
.
x
,
h
=
a
.
y
,
i
=
a
.
z
,
k
=
f
*
g
,
j
=
f
*
h
;
this
.
set
(
k
*
g
+
c
,
k
*
h
-
d
*
i
,
k
*
i
+
d
*
h
,
0
,
k
*
h
+
d
*
i
,
j
*
h
+
c
,
j
*
i
-
d
*
g
,
0
,
k
*
i
-
d
*
h
,
j
*
i
+
d
*
g
,
f
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
f
,
g
){
this
.
n11
=
2
*
f
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
f
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
a
=
Math
.
sin
(
a
);
this
.
set
(
1
,
0
,
0
,
0
,
0
,
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationY
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
0
,
a
,
0
,
0
,
1
,
0
,
0
,
-
a
,
0
,
b
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationZ
:
function
(
a
){
var
b
=
Math
.
cos
(
a
),
a
=
Math
.
sin
(
a
);
this
.
set
(
b
,
-
a
,
0
,
0
,
a
,
b
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeRotationAxis
:
function
(
a
,
b
){
var
c
=
Math
.
cos
(
b
),
d
=
Math
.
sin
(
b
),
f
=
1
-
c
,
g
=
a
.
x
,
h
=
a
.
y
,
i
=
a
.
z
,
k
=
f
*
g
,
j
=
f
*
h
;
this
.
set
(
k
*
g
+
c
,
k
*
h
-
d
*
i
,
k
*
i
+
d
*
h
,
0
,
k
*
h
+
d
*
i
,
j
*
h
+
c
,
j
*
i
-
d
*
g
,
0
,
k
*
i
-
d
*
h
,
j
*
i
+
d
*
g
,
f
*
i
*
i
+
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
g
+
f
)
/
(
g
-
f
);
this
.
n34
=-
2
*
g
*
f
/
(
g
-
f
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
f
=-
a
;
return
this
.
makeFrustum
(
f
*
b
,
a
*
b
,
f
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
f
,
g
){
var
h
=
b
-
a
,
i
=
c
-
d
,
k
=
g
-
f
;
this
.
n11
=
2
/
h
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
h
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
k
;
this
.
n34
=-
((
g
+
f
)
/
k
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
makeScale
:
function
(
a
,
b
,
c
){
this
.
set
(
a
,
0
,
0
,
0
,
0
,
b
,
0
,
0
,
0
,
0
,
c
,
0
,
0
,
0
,
0
,
1
);
return
this
},
makeFrustum
:
function
(
a
,
b
,
c
,
d
,
f
,
g
){
this
.
n11
=
2
*
f
/
(
b
-
a
);
this
.
n12
=
0
;
this
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
this
.
n21
=
this
.
n14
=
0
;
this
.
n22
=
2
*
f
/
(
d
-
c
);
this
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
this
.
n32
=
this
.
n31
=
this
.
n24
=
0
;
this
.
n33
=-
(
g
+
f
)
/
(
g
-
f
);
this
.
n34
=-
2
*
g
*
f
/
(
g
-
f
);
this
.
n42
=
this
.
n41
=
0
;
this
.
n43
=-
1
;
this
.
n44
=
0
;
return
this
},
makePerspective
:
function
(
a
,
b
,
c
,
d
){
var
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
),
f
=-
a
;
return
this
.
makeFrustum
(
f
*
b
,
a
*
b
,
f
,
a
,
c
,
d
)},
makeOrthographic
:
function
(
a
,
b
,
c
,
d
,
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
f
,
g
){
var
h
=
b
-
a
,
i
=
c
-
d
,
k
=
g
-
f
;
this
.
n11
=
2
/
h
;
this
.
n13
=
this
.
n12
=
0
;
this
.
n14
=-
((
b
+
a
)
/
h
);
this
.
n21
=
0
;
this
.
n22
=
2
/
i
;
this
.
n23
=
0
;
this
.
n24
=-
((
c
+
d
)
/
i
);
this
.
n32
=
this
.
n31
=
0
;
this
.
n33
=-
2
/
k
;
this
.
n34
=-
((
g
+
f
)
/
k
);
this
.
n43
=
this
.
n42
=
this
.
n41
=
0
;
this
.
n44
=
1
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Matrix4
(
this
.
n11
,
this
.
n12
,
this
.
n13
,
this
.
n14
,
this
.
n21
,
this
.
n22
,
this
.
n23
,
this
.
n24
,
this
.
n31
,
this
.
n32
,
this
.
n33
,
this
.
n34
,
this
.
n41
,
this
.
n42
,
this
.
n43
,
this
.
n44
)}};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
name
=
""
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
false
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=
true
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
true
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=
false
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=
true
;
this
.
receiveShadow
=
this
.
castShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
applyMatrix
:
function
(
a
){
this
.
matrix
.
multiply
(
a
,
this
.
matrix
);
this
.
scale
.
getScaleFromMatrix
(
this
.
matrix
);
this
.
rotation
.
getRotationFromMatrix
(
this
.
matrix
,
this
.
scale
);
this
.
position
.
getPositionFromMatrix
(
this
.
matrix
)},
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录