Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
5fe8effb
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,发现更多精彩内容 >>
提交
5fe8effb
编写于
12月 22, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ShapeUtils: Moved b2 and b3 to it's own file.
上级
70b086fe
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
79 addition
and
90 deletion
+79
-90
src/extras/ShapeUtils.js
src/extras/ShapeUtils.js
+1
-74
src/extras/core/Bezier.js
src/extras/core/Bezier.js
+70
-0
src/extras/core/Font.js
src/extras/core/Font.js
+2
-2
src/extras/curves/CubicBezierCurve.js
src/extras/curves/CubicBezierCurve.js
+1
-3
src/extras/curves/CubicBezierCurve3.js
src/extras/curves/CubicBezierCurve3.js
+2
-4
src/extras/curves/QuadraticBezierCurve.js
src/extras/curves/QuadraticBezierCurve.js
+1
-3
src/extras/curves/QuadraticBezierCurve3.js
src/extras/curves/QuadraticBezierCurve3.js
+2
-4
未找到文件。
src/extras/ShapeUtils.js
浏览文件 @
5fe8effb
...
@@ -687,81 +687,8 @@ var ShapeUtils = {
...
@@ -687,81 +687,8 @@ var ShapeUtils = {
return
ShapeUtils
.
area
(
pts
)
<
0
;
return
ShapeUtils
.
area
(
pts
)
<
0
;
},
// Bezier Curves formulas obtained from
// http://en.wikipedia.org/wiki/B%C3%A9zier_curve
// Quad Bezier Functions
b2
:
(
function
()
{
function
b2p0
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
p
;
}
function
b2p1
(
t
,
p
)
{
return
2
*
(
1
-
t
)
*
t
*
p
;
}
function
b2p2
(
t
,
p
)
{
return
t
*
t
*
p
;
}
return
function
b2
(
t
,
p0
,
p1
,
p2
)
{
return
b2p0
(
t
,
p0
)
+
b2p1
(
t
,
p1
)
+
b2p2
(
t
,
p2
);
};
}
)(),
// Cubic Bezier Functions
b3
:
(
function
()
{
function
b3p0
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
k
*
p
;
}
}
function
b3p1
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
k
*
t
*
p
;
}
function
b3p2
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
t
*
t
*
p
;
}
function
b3p3
(
t
,
p
)
{
return
t
*
t
*
t
*
p
;
}
return
function
b3
(
t
,
p0
,
p1
,
p2
,
p3
)
{
return
b3p0
(
t
,
p0
)
+
b3p1
(
t
,
p1
)
+
b3p2
(
t
,
p2
)
+
b3p3
(
t
,
p3
);
};
}
)()
};
};
...
...
src/extras/core/Bezier.js
0 → 100644
浏览文件 @
5fe8effb
/**
* @author zz85 / http://www.lab4games.net/zz85/blog
*
* Bezier Curves formulas obtained from
* http://en.wikipedia.org/wiki/Bézier_curve
*/
// Quad Bezier Functions
function
b2p0
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
p
;
}
function
b2p1
(
t
,
p
)
{
return
2
*
(
1
-
t
)
*
t
*
p
;
}
function
b2p2
(
t
,
p
)
{
return
t
*
t
*
p
;
}
function
b2
(
t
,
p0
,
p1
,
p2
)
{
return
b2p0
(
t
,
p0
)
+
b2p1
(
t
,
p1
)
+
b2p2
(
t
,
p2
);
}
// Cubic Bezier Functions
function
b3p0
(
t
,
p
)
{
var
k
=
1
-
t
;
return
k
*
k
*
k
*
p
;
}
function
b3p1
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
k
*
t
*
p
;
}
function
b3p2
(
t
,
p
)
{
var
k
=
1
-
t
;
return
3
*
k
*
t
*
t
*
p
;
}
function
b3p3
(
t
,
p
)
{
return
t
*
t
*
t
*
p
;
}
function
b3
(
t
,
p0
,
p1
,
p2
,
p3
)
{
return
b3p0
(
t
,
p0
)
+
b3p1
(
t
,
p1
)
+
b3p2
(
t
,
p2
)
+
b3p3
(
t
,
p3
);
}
export
{
b2
,
b3
};
src/extras/core/Font.js
浏览文件 @
5fe8effb
import
{
ShapeUtils
}
from
'
../ShapeUtils
'
;
import
{
b2
,
b3
}
from
'
./Bezier
'
;
import
{
ShapePath
}
from
'
./ShapePath
'
;
import
{
ShapePath
}
from
'
./ShapePath
'
;
/**
/**
...
@@ -47,7 +47,7 @@ Object.assign( Font.prototype, {
...
@@ -47,7 +47,7 @@ Object.assign( Font.prototype, {
var
path
=
new
ShapePath
();
var
path
=
new
ShapePath
();
var
pts
=
[]
,
b2
=
ShapeUtils
.
b2
,
b3
=
ShapeUtils
.
b3
;
var
pts
=
[];
var
x
,
y
,
cpx
,
cpy
,
cpx0
,
cpy0
,
cpx1
,
cpy1
,
cpx2
,
cpy2
,
laste
;
var
x
,
y
,
cpx
,
cpy
,
cpx0
,
cpy0
,
cpx1
,
cpy1
,
cpx2
,
cpy2
,
laste
;
if
(
glyph
.
o
)
{
if
(
glyph
.
o
)
{
...
...
src/extras/curves/CubicBezierCurve.js
浏览文件 @
5fe8effb
import
{
b3
}
from
'
../core/Bezier
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Vector2
}
from
'
../../math/Vector2
'
;
import
{
Vector2
}
from
'
../../math/Vector2
'
;
import
{
CurveUtils
}
from
'
../CurveUtils
'
;
import
{
CurveUtils
}
from
'
../CurveUtils
'
;
import
{
ShapeUtils
}
from
'
../ShapeUtils
'
;
/**************************************************************
/**************************************************************
* Cubic Bezier curve
* Cubic Bezier curve
...
@@ -21,8 +21,6 @@ CubicBezierCurve.prototype.constructor = CubicBezierCurve;
...
@@ -21,8 +21,6 @@ CubicBezierCurve.prototype.constructor = CubicBezierCurve;
CubicBezierCurve
.
prototype
.
getPoint
=
function
(
t
)
{
CubicBezierCurve
.
prototype
.
getPoint
=
function
(
t
)
{
var
b3
=
ShapeUtils
.
b3
;
return
new
Vector2
(
return
new
Vector2
(
b3
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
,
this
.
v3
.
x
),
b3
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
,
this
.
v3
.
x
),
b3
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
,
this
.
v3
.
y
)
b3
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
,
this
.
v3
.
y
)
...
...
src/extras/curves/CubicBezierCurve3.js
浏览文件 @
5fe8effb
import
{
Vector3
}
from
'
../../math/Vector3
'
;
import
{
b3
}
from
'
../core/Bezier
'
;
import
{
ShapeUtils
}
from
'
../ShapeUtils
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Vector3
}
from
'
../../math/Vector3
'
;
/**************************************************************
/**************************************************************
* Cubic Bezier 3D curve
* Cubic Bezier 3D curve
...
@@ -19,8 +19,6 @@ var CubicBezierCurve3 = Curve.create(
...
@@ -19,8 +19,6 @@ var CubicBezierCurve3 = Curve.create(
function
(
t
)
{
function
(
t
)
{
var
b3
=
ShapeUtils
.
b3
;
return
new
Vector3
(
return
new
Vector3
(
b3
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
,
this
.
v3
.
x
),
b3
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
,
this
.
v3
.
x
),
b3
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
,
this
.
v3
.
y
),
b3
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
,
this
.
v3
.
y
),
...
...
src/extras/curves/QuadraticBezierCurve.js
浏览文件 @
5fe8effb
import
{
b2
}
from
'
../core/Bezier
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Vector2
}
from
'
../../math/Vector2
'
;
import
{
Vector2
}
from
'
../../math/Vector2
'
;
import
{
CurveUtils
}
from
'
../CurveUtils
'
;
import
{
CurveUtils
}
from
'
../CurveUtils
'
;
import
{
ShapeUtils
}
from
'
../ShapeUtils
'
;
/**************************************************************
/**************************************************************
* Quadratic Bezier curve
* Quadratic Bezier curve
...
@@ -22,8 +22,6 @@ QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
...
@@ -22,8 +22,6 @@ QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
QuadraticBezierCurve
.
prototype
.
getPoint
=
function
(
t
)
{
QuadraticBezierCurve
.
prototype
.
getPoint
=
function
(
t
)
{
var
b2
=
ShapeUtils
.
b2
;
return
new
Vector2
(
return
new
Vector2
(
b2
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
),
b2
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
),
b2
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
)
b2
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
)
...
...
src/extras/curves/QuadraticBezierCurve3.js
浏览文件 @
5fe8effb
import
{
Vector3
}
from
'
../../math/Vector3
'
;
import
{
b2
}
from
'
../core/Bezier
'
;
import
{
ShapeUtils
}
from
'
../ShapeUtils
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Curve
}
from
'
../core/Curve
'
;
import
{
Vector3
}
from
'
../../math/Vector3
'
;
/**************************************************************
/**************************************************************
* Quadratic Bezier 3D curve
* Quadratic Bezier 3D curve
...
@@ -18,8 +18,6 @@ var QuadraticBezierCurve3 = Curve.create(
...
@@ -18,8 +18,6 @@ var QuadraticBezierCurve3 = Curve.create(
function
(
t
)
{
function
(
t
)
{
var
b2
=
ShapeUtils
.
b2
;
return
new
Vector3
(
return
new
Vector3
(
b2
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
),
b2
(
t
,
this
.
v0
.
x
,
this
.
v1
.
x
,
this
.
v2
.
x
),
b2
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
),
b2
(
t
,
this
.
v0
.
y
,
this
.
v1
.
y
,
this
.
v2
.
y
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录