Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
7630e7a6
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7630e7a6
编写于
3月 27, 2020
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update unit tests.
上级
95dd7269
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
105 addition
and
98 deletion
+105
-98
test/unit/src/extras/curves/CatmullRomCurve3.tests.js
test/unit/src/extras/curves/CatmullRomCurve3.tests.js
+16
-16
test/unit/src/extras/curves/CubicBezierCurve.tests.js
test/unit/src/extras/curves/CubicBezierCurve.tests.js
+14
-14
test/unit/src/extras/curves/CubicBezierCurve3.tests.js
test/unit/src/extras/curves/CubicBezierCurve3.tests.js
+14
-14
test/unit/src/extras/curves/EllipseCurve.tests.js
test/unit/src/extras/curves/EllipseCurve.tests.js
+11
-8
test/unit/src/extras/curves/LineCurve.tests.js
test/unit/src/extras/curves/LineCurve.tests.js
+6
-5
test/unit/src/extras/curves/LineCurve3.tests.js
test/unit/src/extras/curves/LineCurve3.tests.js
+6
-5
test/unit/src/extras/curves/QuadraticBezierCurve.tests.js
test/unit/src/extras/curves/QuadraticBezierCurve.tests.js
+14
-14
test/unit/src/extras/curves/QuadraticBezierCurve3.tests.js
test/unit/src/extras/curves/QuadraticBezierCurve3.tests.js
+14
-14
test/unit/src/extras/curves/SplineCurve.tests.js
test/unit/src/extras/curves/SplineCurve.tests.js
+10
-8
未找到文件。
test/unit/src/extras/curves/CatmullRomCurve3.tests.js
浏览文件 @
7630e7a6
...
...
@@ -232,10 +232,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector3
()
),
curve
.
getPointAt
(
0.3
,
new
Vector3
()
),
curve
.
getPointAt
(
0.5
,
new
Vector3
()
),
curve
.
getPointAt
(
1
,
new
Vector3
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct points
"
);
...
...
@@ -256,11 +256,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.25
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
0.75
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector3
()
),
curve
.
getTangent
(
0.25
,
new
Vector3
()
),
curve
.
getTangent
(
0.5
,
new
Vector3
()
),
curve
.
getTangent
(
0.75
,
new
Vector3
()
),
curve
.
getTangent
(
1
,
new
Vector3
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
@@ -274,7 +274,7 @@ export default QUnit.module( 'Extras', () => {
//
var
expectedTangents
=
[
expectedTangents
=
[
new
Vector3
(
0
,
1
,
0
),
new
Vector3
(
-
0.10709018822205997
,
0.9884651653817284
,
0.10709018822205997
),
new
Vector3
(
0.6396363672964268
,
-
0.4262987629159402
,
-
0.6396363672964268
),
...
...
@@ -282,12 +282,12 @@ export default QUnit.module( 'Extras', () => {
new
Vector3
(
-
0.00019991333100812723
,
-
0.9999999600346592
,
0.00019991333100812723
)
];
var
tangents
=
[
curve
.
getTangentAt
(
0
),
curve
.
getTangentAt
(
0.25
),
curve
.
getTangentAt
(
0.5
),
curve
.
getTangentAt
(
0.75
),
curve
.
getTangentAt
(
1
)
tangents
=
[
curve
.
getTangentAt
(
0
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.25
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.5
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.75
,
new
Vector3
()
),
curve
.
getTangentAt
(
1
,
new
Vector3
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
test/unit/src/extras/curves/CubicBezierCurve.tests.js
浏览文件 @
7630e7a6
...
...
@@ -116,10 +116,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector2
()
),
curve
.
getPointAt
(
0.3
,
new
Vector2
()
),
curve
.
getPointAt
(
0.5
,
new
Vector2
()
),
curve
.
getPointAt
(
1
,
new
Vector2
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct points
"
);
...
...
@@ -137,11 +137,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.25
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
0.75
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector2
()
),
curve
.
getTangent
(
0.25
,
new
Vector2
()
),
curve
.
getTangent
(
0.5
,
new
Vector2
()
),
curve
.
getTangent
(
0.75
,
new
Vector2
()
),
curve
.
getTangent
(
1
,
new
Vector2
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
@@ -164,11 +164,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangentAt
(
0
),
curve
.
getTangentAt
(
0.25
),
curve
.
getTangentAt
(
0.5
),
curve
.
getTangentAt
(
0.75
),
curve
.
getTangentAt
(
1
)
curve
.
getTangentAt
(
0
,
new
Vector2
()
),
curve
.
getTangentAt
(
0.25
,
new
Vector2
()
),
curve
.
getTangentAt
(
0.5
,
new
Vector2
()
),
curve
.
getTangentAt
(
0.75
,
new
Vector2
()
),
curve
.
getTangentAt
(
1
,
new
Vector2
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
test/unit/src/extras/curves/CubicBezierCurve3.tests.js
浏览文件 @
7630e7a6
...
...
@@ -116,10 +116,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector3
()
),
curve
.
getPointAt
(
0.3
,
new
Vector3
()
),
curve
.
getPointAt
(
0.5
,
new
Vector3
()
),
curve
.
getPointAt
(
1
,
new
Vector3
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct points
"
);
...
...
@@ -137,11 +137,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.25
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
0.75
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector3
()
),
curve
.
getTangent
(
0.25
,
new
Vector3
()
),
curve
.
getTangent
(
0.5
,
new
Vector3
()
),
curve
.
getTangent
(
0.75
,
new
Vector3
()
),
curve
.
getTangent
(
1
,
new
Vector3
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
@@ -164,11 +164,11 @@ export default QUnit.module( 'Extras', () => {
];
tangents
=
[
curve
.
getTangentAt
(
0
),
curve
.
getTangentAt
(
0.25
),
curve
.
getTangentAt
(
0.5
),
curve
.
getTangentAt
(
0.75
),
curve
.
getTangentAt
(
1
)
curve
.
getTangentAt
(
0
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.25
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.5
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.75
,
new
Vector3
()
),
curve
.
getTangentAt
(
1
,
new
Vector3
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
test/unit/src/extras/curves/EllipseCurve.tests.js
浏览文件 @
7630e7a6
...
...
@@ -107,13 +107,16 @@ export default QUnit.module( 'Extras', () => {
var
testValues
=
[
0
,
0.3
,
0.5
,
0.7
,
1
];
testValues
.
forEach
(
function
(
val
,
i
)
{
var
p
=
new
Vector2
();
var
a
=
new
Vector2
();
testValues
.
forEach
(
function
(
val
)
{
var
expectedX
=
Math
.
cos
(
val
*
Math
.
PI
*
2
)
*
10
;
var
expectedY
=
Math
.
sin
(
val
*
Math
.
PI
*
2
)
*
10
;
var
p
=
curve
.
getPoint
(
val
);
var
a
=
curve
.
getPointAt
(
val
);
curve
.
getPoint
(
val
,
p
);
curve
.
getPointAt
(
val
,
a
);
assert
.
numEqual
(
p
.
x
,
expectedX
,
"
getPoint(
"
+
val
+
"
).x correct
"
);
assert
.
numEqual
(
p
.
y
,
expectedY
,
"
getPoint(
"
+
val
+
"
).y correct
"
);
...
...
@@ -136,11 +139,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.25
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
0.75
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector2
()
),
curve
.
getTangent
(
0.25
,
new
Vector2
()
),
curve
.
getTangent
(
0.5
,
new
Vector2
()
),
curve
.
getTangent
(
0.75
,
new
Vector2
()
),
curve
.
getTangent
(
1
,
new
Vector2
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
test/unit/src/extras/curves/LineCurve.tests.js
浏览文件 @
7630e7a6
...
...
@@ -66,10 +66,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector2
()
),
curve
.
getPointAt
(
0.3
,
new
Vector2
()
),
curve
.
getPointAt
(
0.5
,
new
Vector2
()
),
curve
.
getPointAt
(
1
,
new
Vector2
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct points
"
);
...
...
@@ -79,8 +79,9 @@ export default QUnit.module( 'Extras', () => {
QUnit
.
test
(
"
getTangent
"
,
(
assert
)
=>
{
var
curve
=
_curve
;
var
tangent
=
new
Vector2
();
var
tangent
=
curve
.
getTangent
(
0
);
curve
.
getTangent
(
0
,
tangent
);
var
expectedTangent
=
Math
.
sqrt
(
0.5
);
assert
.
numEqual
(
tangent
.
x
,
expectedTangent
,
"
tangent.x correct
"
);
...
...
test/unit/src/extras/curves/LineCurve3.tests.js
浏览文件 @
7630e7a6
...
...
@@ -66,10 +66,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector3
()
),
curve
.
getPointAt
(
0.3
,
new
Vector3
()
),
curve
.
getPointAt
(
0.5
,
new
Vector3
()
),
curve
.
getPointAt
(
1
,
new
Vector3
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct getPointAt points
"
);
...
...
@@ -145,8 +145,9 @@ export default QUnit.module( 'Extras', () => {
QUnit
.
test
(
"
getTangent/getTangentAt
"
,
(
assert
)
=>
{
var
curve
=
_curve
;
var
tangent
=
new
Vector3
();
var
tangent
=
curve
.
getTangent
(
0.5
);
curve
.
getTangent
(
0.5
,
tangent
);
var
expectedTangent
=
Math
.
sqrt
(
1
/
3
);
assert
.
numEqual
(
tangent
.
x
,
expectedTangent
,
"
tangent.x correct
"
);
...
...
test/unit/src/extras/curves/QuadraticBezierCurve.tests.js
浏览文件 @
7630e7a6
...
...
@@ -120,10 +120,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector2
()
),
curve
.
getPointAt
(
0.3
,
new
Vector2
()
),
curve
.
getPointAt
(
0.5
,
new
Vector2
()
),
curve
.
getPointAt
(
1
,
new
Vector2
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct points
"
);
...
...
@@ -143,11 +143,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.25
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
0.75
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector2
()
),
curve
.
getTangent
(
0.25
,
new
Vector2
()
),
curve
.
getTangent
(
0.5
,
new
Vector2
()
),
curve
.
getTangent
(
0.75
,
new
Vector2
()
),
curve
.
getTangent
(
1
,
new
Vector2
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
@@ -170,11 +170,11 @@ export default QUnit.module( 'Extras', () => {
];
tangents
=
[
curve
.
getTangentAt
(
0
),
curve
.
getTangentAt
(
0.25
),
curve
.
getTangentAt
(
0.5
),
curve
.
getTangentAt
(
0.75
),
curve
.
getTangentAt
(
1
)
curve
.
getTangentAt
(
0
,
new
Vector2
()
),
curve
.
getTangentAt
(
0.25
,
new
Vector2
()
),
curve
.
getTangentAt
(
0.5
,
new
Vector2
()
),
curve
.
getTangentAt
(
0.75
,
new
Vector2
()
),
curve
.
getTangentAt
(
1
,
new
Vector2
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
test/unit/src/extras/curves/QuadraticBezierCurve3.tests.js
浏览文件 @
7630e7a6
...
...
@@ -120,10 +120,10 @@ export default QUnit.module( 'Extras', () => {
];
var
points
=
[
curve
.
getPointAt
(
0
),
curve
.
getPointAt
(
0.3
),
curve
.
getPointAt
(
0.5
),
curve
.
getPointAt
(
1
)
curve
.
getPointAt
(
0
,
new
Vector3
()
),
curve
.
getPointAt
(
0.3
,
new
Vector3
()
),
curve
.
getPointAt
(
0.5
,
new
Vector3
()
),
curve
.
getPointAt
(
1
,
new
Vector3
()
)
];
assert
.
deepEqual
(
points
,
expectedPoints
,
"
Correct points
"
);
...
...
@@ -143,11 +143,11 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.25
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
0.75
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector3
()
),
curve
.
getTangent
(
0.25
,
new
Vector3
()
),
curve
.
getTangent
(
0.5
,
new
Vector3
()
),
curve
.
getTangent
(
0.75
,
new
Vector3
()
),
curve
.
getTangent
(
1
,
new
Vector3
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
@@ -170,11 +170,11 @@ export default QUnit.module( 'Extras', () => {
];
tangents
=
[
curve
.
getTangentAt
(
0
),
curve
.
getTangentAt
(
0.25
),
curve
.
getTangentAt
(
0.5
),
curve
.
getTangentAt
(
0.75
),
curve
.
getTangentAt
(
1
)
curve
.
getTangentAt
(
0
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.25
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.5
,
new
Vector3
()
),
curve
.
getTangentAt
(
0.75
,
new
Vector3
()
),
curve
.
getTangentAt
(
1
,
new
Vector3
()
)
];
expectedTangents
.
forEach
(
function
(
exp
,
i
)
{
...
...
test/unit/src/extras/curves/SplineCurve.tests.js
浏览文件 @
7630e7a6
...
...
@@ -111,13 +111,15 @@ export default QUnit.module( 'Extras', () => {
QUnit
.
test
(
"
getPointAt
"
,
(
assert
)
=>
{
var
curve
=
_curve
;
var
point
=
new
Vector2
();
assert
.
ok
(
curve
.
getPointAt
(
0
).
equals
(
curve
.
points
[
0
]
),
"
PointAt 0.0 correct
"
);
assert
.
ok
(
curve
.
getPointAt
(
1
).
equals
(
curve
.
points
[
4
]
),
"
PointAt 1.0 correct
"
);
assert
.
ok
(
curve
.
getPointAt
(
0
,
point
).
equals
(
curve
.
points
[
0
]
),
"
PointAt 0.0 correct
"
);
assert
.
ok
(
curve
.
getPointAt
(
1
,
point
).
equals
(
curve
.
points
[
4
]
),
"
PointAt 1.0 correct
"
);
var
pointAt
=
curve
.
getPointAt
(
0.5
);
assert
.
numEqual
(
pointAt
.
x
,
0.0
,
"
PointAt 0.5 x correct
"
);
assert
.
numEqual
(
pointAt
.
y
,
0.0
,
"
PointAt 0.5 y correct
"
);
curve
.
getPointAt
(
0.5
,
point
);
assert
.
numEqual
(
point
.
x
,
0.0
,
"
PointAt 0.5 x correct
"
);
assert
.
numEqual
(
point
.
y
,
0.0
,
"
PointAt 0.5 y correct
"
);
}
);
...
...
@@ -132,9 +134,9 @@ export default QUnit.module( 'Extras', () => {
];
var
tangents
=
[
curve
.
getTangent
(
0
),
curve
.
getTangent
(
0.5
),
curve
.
getTangent
(
1
)
curve
.
getTangent
(
0
,
new
Vector2
()
),
curve
.
getTangent
(
0.5
,
new
Vector2
()
),
curve
.
getTangent
(
1
,
new
Vector2
()
)
];
tangents
.
forEach
(
function
(
tangent
,
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录