Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1f4f7e1a
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f4f7e1a
编写于
2月 07, 2013
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(Box3|Line3|Plane|Ray|Sphere).transform() -> applyMatrix4() for consistency.
上级
dca460bf
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
22 addition
and
23 deletion
+22
-23
src/core/Raycaster.js
src/core/Raycaster.js
+1
-1
src/math/Box3.js
src/math/Box3.js
+1
-1
src/math/Line3.js
src/math/Line3.js
+1
-1
src/math/Plane.js
src/math/Plane.js
+1
-1
src/math/Ray.js
src/math/Ray.js
+1
-1
src/math/Sphere.js
src/math/Sphere.js
+1
-1
test/unit/math/Box3.js
test/unit/math/Box3.js
+5
-5
test/unit/math/Plane.js
test/unit/math/Plane.js
+4
-5
test/unit/math/Ray.js
test/unit/math/Ray.js
+5
-5
test/unit/math/Sphere.js
test/unit/math/Sphere.js
+2
-2
未找到文件。
src/core/Raycaster.js
浏览文件 @
1f4f7e1a
...
...
@@ -88,7 +88,7 @@
inverseMatrix
.
getInverse
(
object
.
matrixWorld
);
localRay
.
copy
(
raycaster
.
ray
).
transform
(
inverseMatrix
);
localRay
.
copy
(
raycaster
.
ray
).
applyMatrix4
(
inverseMatrix
);
for
(
var
f
=
0
,
fl
=
geometry
.
faces
.
length
;
f
<
fl
;
f
++
)
{
...
...
src/math/Box3.js
浏览文件 @
1f4f7e1a
...
...
@@ -271,7 +271,7 @@ THREE.extend( THREE.Box3.prototype, {
},
transform
:
function
()
{
applyMatrix4
:
function
()
{
var
points
=
[
new
THREE
.
Vector3
(),
...
...
src/math/Line3.js
浏览文件 @
1f4f7e1a
...
...
@@ -100,7 +100,7 @@ THREE.extend( THREE.Line3.prototype, {
},
transform
:
function
(
matrix
)
{
applyMatrix4
:
function
(
matrix
)
{
this
.
start
.
applyMatrix4
(
matrix
);
this
.
end
.
applyMatrix4
(
matrix
);
...
...
src/math/Plane.js
浏览文件 @
1f4f7e1a
...
...
@@ -174,7 +174,7 @@ THREE.extend( THREE.Plane.prototype, {
},
transform
:
function
()
{
applyMatrix4
:
function
()
{
var
v1
=
new
THREE
.
Vector3
();
var
v2
=
new
THREE
.
Vector3
();
...
...
src/math/Ray.js
浏览文件 @
1f4f7e1a
...
...
@@ -140,7 +140,7 @@ THREE.extend( THREE.Ray.prototype, {
},
transform
:
function
(
matrix4
)
{
applyMatrix4
:
function
(
matrix4
)
{
this
.
direction
.
add
(
this
.
origin
).
applyMatrix4
(
matrix4
);
this
.
origin
.
applyMatrix4
(
matrix4
);
...
...
src/math/Sphere.js
浏览文件 @
1f4f7e1a
...
...
@@ -102,7 +102,7 @@ THREE.extend( THREE.Sphere.prototype, {
},
transform
:
function
(
matrix
)
{
applyMatrix4
:
function
(
matrix
)
{
this
.
center
.
applyMatrix4
(
matrix
);
this
.
radius
=
this
.
radius
*
matrix
.
getMaxScaleOnAxis
();
...
...
test/unit/math/Box3.js
浏览文件 @
1f4f7e1a
...
...
@@ -248,7 +248,7 @@ var compareBox = function ( a, b, threshold ) {
a
.
max
.
distanceTo
(
b
.
max
)
<
threshold
);
};
test
(
"
transform
"
,
function
()
{
test
(
"
applyMatrix4
"
,
function
()
{
var
a
=
new
THREE
.
Box3
(
zero3
.
clone
(),
zero3
.
clone
()
);
var
b
=
new
THREE
.
Box3
(
zero3
.
clone
(),
one3
.
clone
()
);
var
c
=
new
THREE
.
Box3
(
one3
.
clone
().
negate
(),
one3
.
clone
()
);
...
...
@@ -257,10 +257,10 @@ test( "transform", function() {
var
m
=
new
THREE
.
Matrix4
().
makeTranslation
(
1
,
-
2
,
1
);
var
t1
=
new
THREE
.
Vector3
(
1
,
-
2
,
1
);
ok
(
compareBox
(
a
.
clone
().
transform
(
m
),
a
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
b
.
clone
().
transform
(
m
),
b
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
c
.
clone
().
transform
(
m
),
c
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
d
.
clone
().
transform
(
m
),
d
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
a
.
clone
().
applyMatrix4
(
m
),
a
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
b
.
clone
().
applyMatrix4
(
m
),
b
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
c
.
clone
().
applyMatrix4
(
m
),
c
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
ok
(
compareBox
(
d
.
clone
().
applyMatrix4
(
m
),
d
.
clone
().
translate
(
t1
)
),
"
Passed!
"
);
});
test
(
"
translate
"
,
function
()
{
...
...
test/unit/math/Plane.js
浏览文件 @
1f4f7e1a
...
...
@@ -153,7 +153,6 @@ test( "isInterestionLine/intersectLine", function() {
});
test
(
"
projectPoint
"
,
function
()
{
var
a
=
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
1
,
0
,
0
),
0
);
...
...
@@ -181,18 +180,18 @@ test( "coplanarPoint", function() {
ok
(
a
.
distanceToPoint
(
a
.
coplanarPoint
()
)
===
0
,
"
Passed!
"
);
});
test
(
"
transform
/translate
"
,
function
()
{
test
(
"
applyMatrix4
/translate
"
,
function
()
{
var
a
=
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
1
,
0
,
0
),
0
);
var
m
=
new
THREE
.
Matrix4
();
m
.
makeRotationZ
(
Math
.
PI
*
0.5
);
ok
(
comparePlane
(
a
.
clone
().
transform
(
m
),
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
0
,
1
,
0
),
0
)
),
"
Passed!
"
);
ok
(
comparePlane
(
a
.
clone
().
applyMatrix4
(
m
),
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
0
,
1
,
0
),
0
)
),
"
Passed!
"
);
a
=
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
0
,
1
,
0
),
-
1
);
ok
(
comparePlane
(
a
.
clone
().
transform
(
m
),
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
-
1
,
0
,
0
),
-
1
)
),
"
Passed!
"
);
ok
(
comparePlane
(
a
.
clone
().
applyMatrix4
(
m
),
new
THREE
.
Plane
(
new
THREE
.
Vector3
(
-
1
,
0
,
0
),
-
1
)
),
"
Passed!
"
);
m
.
makeTranslation
(
1
,
1
,
1
);
ok
(
comparePlane
(
a
.
clone
().
transform
(
m
),
a
.
clone
().
translate
(
new
THREE
.
Vector3
(
1
,
1
,
1
)
)
),
"
Passed!
"
);
ok
(
comparePlane
(
a
.
clone
().
applyMatrix4
(
m
),
a
.
clone
().
translate
(
new
THREE
.
Vector3
(
1
,
1
,
1
)
)
),
"
Passed!
"
);
});
test/unit/math/Ray.js
浏览文件 @
1f4f7e1a
...
...
@@ -149,26 +149,26 @@ test( "intersectPlane", function() {
});
test
(
"
transform
"
,
function
()
{
test
(
"
applyMatrix4
"
,
function
()
{
var
a
=
new
THREE
.
Ray
(
one3
.
clone
(),
new
THREE
.
Vector3
(
0
,
0
,
1
)
);
var
m
=
new
THREE
.
Matrix4
().
identity
();
ok
(
a
.
clone
().
transform
(
m
).
equals
(
a
),
"
Passed!
"
);
ok
(
a
.
clone
().
applyMatrix4
(
m
).
equals
(
a
),
"
Passed!
"
);
a
=
new
THREE
.
Ray
(
zero3
.
clone
(),
new
THREE
.
Vector3
(
0
,
0
,
1
)
);
m
.
rotateByAxis
(
new
THREE
.
Vector3
(
0
,
0
,
1
),
Math
.
PI
);
ok
(
a
.
clone
().
transform
(
m
).
equals
(
a
),
"
Passed!
"
);
ok
(
a
.
clone
().
applyMatrix4
(
m
).
equals
(
a
),
"
Passed!
"
);
m
.
identity
().
rotateX
(
Math
.
PI
);
var
b
=
a
.
clone
();
b
.
direction
.
negate
();
var
a2
=
a
.
clone
().
transform
(
m
);
var
a2
=
a
.
clone
().
applyMatrix4
(
m
);
ok
(
a2
.
origin
.
distanceTo
(
b
.
origin
)
<
0.0001
,
"
Passed!
"
);
ok
(
a2
.
direction
.
distanceTo
(
b
.
direction
)
<
0.0001
,
"
Passed!
"
);
a
.
origin
=
new
THREE
.
Vector3
(
0
,
0
,
1
);
b
.
origin
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
var
a2
=
a
.
clone
().
transform
(
m
);
var
a2
=
a
.
clone
().
applyMatrix4
(
m
);
ok
(
a2
.
origin
.
distanceTo
(
b
.
origin
)
<
0.0001
,
"
Passed!
"
);
ok
(
a2
.
direction
.
distanceTo
(
b
.
direction
)
<
0.0001
,
"
Passed!
"
);
});
...
...
test/unit/math/Sphere.js
浏览文件 @
1f4f7e1a
...
...
@@ -85,12 +85,12 @@ test( "getBoundingBox", function() {
ok
(
a
.
getBoundingBox
().
equals
(
new
THREE
.
Box3
(
zero3
,
zero3
)
),
"
Passed!
"
);
});
test
(
"
transform
"
,
function
()
{
test
(
"
applyMatrix4
"
,
function
()
{
var
a
=
new
THREE
.
Sphere
(
one3
.
clone
(),
1
);
var
m
=
new
THREE
.
Matrix4
().
makeTranslation
(
1
,
-
2
,
1
);
ok
(
a
.
clone
().
transform
(
m
).
getBoundingBox
().
equals
(
a
.
getBoundingBox
().
transform
(
m
)
),
"
Passed!
"
);
ok
(
a
.
clone
().
applyMatrix4
(
m
).
getBoundingBox
().
equals
(
a
.
getBoundingBox
().
applyMatrix4
(
m
)
),
"
Passed!
"
);
});
test
(
"
translate
"
,
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录