Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
9de038ae
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,发现更多精彩内容 >>
提交
9de038ae
编写于
3月 14, 2012
作者:
Z
zz85
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asutherland/master'
上级
e1f5bb83
dfa7e4cd
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
43 addition
and
17 deletion
+43
-17
examples/webgl_geometry_shapes.html
examples/webgl_geometry_shapes.html
+5
-5
src/extras/core/Path.js
src/extras/core/Path.js
+38
-12
未找到文件。
examples/webgl_geometry_shapes.html
浏览文件 @
9de038ae
...
...
@@ -277,11 +277,11 @@
// Arc circle
var
arcShape
=
new
THREE
.
Shape
();
arcShape
.
moveTo
(
0
,
0
);
arcShape
.
moveTo
(
50
,
1
0
);
arcShape
.
arc
(
10
,
10
,
40
,
0
,
Math
.
PI
*
2
,
false
);
var
holePath
=
new
THREE
.
Path
();
holePath
.
moveTo
(
0
,
0
);
holePath
.
moveTo
(
20
,
1
0
);
holePath
.
arc
(
10
,
10
,
10
,
0
,
Math
.
PI
*
2
,
true
);
arcShape
.
holes
.
push
(
holePath
);
...
...
@@ -293,16 +293,16 @@
// Smiley
var
smileyShape
=
new
THREE
.
Shape
();
smileyShape
.
moveTo
(
0
,
0
);
smileyShape
.
moveTo
(
80
,
4
0
);
smileyShape
.
arc
(
40
,
40
,
40
,
0
,
Math
.
PI
*
2
,
false
);
var
smileyEye1Path
=
new
THREE
.
Path
();
smileyEye1Path
.
moveTo
(
0
,
0
);
smileyEye1Path
.
moveTo
(
35
,
2
0
);
smileyEye1Path
.
arc
(
25
,
20
,
10
,
0
,
Math
.
PI
*
2
,
true
);
smileyShape
.
holes
.
push
(
smileyEye1Path
);
var
smileyEye2Path
=
new
THREE
.
Path
();
smileyEye2Path
.
moveTo
(
0
,
0
);
smileyEye2Path
.
moveTo
(
65
,
2
0
);
smileyEye2Path
.
arc
(
55
,
20
,
10
,
0
,
Math
.
PI
*
2
,
true
);
smileyShape
.
holes
.
push
(
smileyEye2Path
);
...
...
src/extras/core/Path.js
浏览文件 @
9de038ae
...
...
@@ -140,12 +140,39 @@ THREE.Path.prototype.arc = function ( aX, aY, aRadius,
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
);
var
laste
=
this
.
actions
[
this
.
actions
.
length
-
1
];
var
curve
=
new
THREE
.
ArcCurve
(
laste
.
x
+
aX
,
laste
.
y
+
aY
,
aRadius
,
aStartAngle
,
aEndAngle
,
aClockwise
);
this
.
curves
.
push
(
curve
);
// All of the other actions look to the last two elements in the list to
// find the ending point, so we need to append them.
var
lastPoint
=
curve
.
getPoint
(
aClockwise
?
1
:
0
);
args
.
push
(
lastPoint
.
x
);
args
.
push
(
lastPoint
.
y
);
this
.
actions
.
push
(
{
action
:
THREE
.
PathActions
.
ARC
,
args
:
args
}
);
};
THREE
.
Path
.
prototype
.
absarc
=
function
(
aX
,
aY
,
aRadius
,
aStartAngle
,
aEndAngle
,
aClockwise
)
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
);
var
curve
=
new
THREE
.
ArcCurve
(
aX
,
aY
,
aRadius
,
aStartAngle
,
aEndAngle
,
aClockwise
);
this
.
curves
.
push
(
curve
);
// console.log( 'arc', args );
// All of the other actions look to the last two elements in the list to
// find the ending point, so we need to append them.
var
lastPoint
=
curve
.
getPoint
(
aClockwise
?
1
:
0
);
args
.
push
(
lastPoint
.
x
);
args
.
push
(
lastPoint
.
y
);
this
.
actions
.
push
(
{
action
:
THREE
.
PathActions
.
ARC
,
args
:
args
}
);
};
...
...
@@ -199,7 +226,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
case
THREE
.
PathActions
.
MOVE_TO
:
//
points.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) );
points
.
push
(
new
THREE
.
Vector2
(
args
[
0
],
args
[
1
]
)
);
break
;
...
...
@@ -317,15 +344,6 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
aStartAngle
=
args
[
3
],
aEndAngle
=
args
[
4
],
aClockwise
=
!!
args
[
5
];
var
lastx
=
laste
[
laste
.
length
-
2
],
lasty
=
laste
[
laste
.
length
-
1
];
if
(
laste
.
length
==
0
)
{
lastx
=
lasty
=
0
;
}
var
deltaAngle
=
aEndAngle
-
aStartAngle
;
var
angle
;
...
...
@@ -343,8 +361,8 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
angle
=
aStartAngle
+
t
*
deltaAngle
;
tx
=
lastx
+
aX
+
aRadius
*
Math
.
cos
(
angle
);
ty
=
lasty
+
aY
+
aRadius
*
Math
.
sin
(
angle
);
tx
=
aX
+
aRadius
*
Math
.
cos
(
angle
);
ty
=
aY
+
aRadius
*
Math
.
sin
(
angle
);
//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
...
...
@@ -360,6 +378,14 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
}
// Normalize to remove the closing point by default.
var
lastPoint
=
points
[
points
.
length
-
1
];
var
EPSILON
=
0.0000000001
;
if
(
Math
.
abs
(
lastPoint
.
x
-
points
[
0
].
x
)
<
EPSILON
&&
Math
.
abs
(
lastPoint
.
y
-
points
[
0
].
y
)
<
EPSILON
)
points
.
splice
(
points
.
length
-
1
,
1
);
if
(
closedPath
)
{
points
.
push
(
points
[
0
]
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录