Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
8ed08e98
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,发现更多精彩内容 >>
提交
8ed08e98
编写于
10月 15, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replaced EPSILONS with Number.EPSILON.
上级
95b294db
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
25 addition
and
27 deletion
+25
-27
examples/js/renderers/CSS3DRenderer.js
examples/js/renderers/CSS3DRenderer.js
+1
-1
examples/js/renderers/CSS3DStereoRenderer.js
examples/js/renderers/CSS3DStereoRenderer.js
+1
-1
src/Three.js
src/Three.js
+10
-0
src/extras/FontUtils.js
src/extras/FontUtils.js
+2
-4
src/extras/ShapeUtils.js
src/extras/ShapeUtils.js
+2
-6
src/extras/core/Path.js
src/extras/core/Path.js
+3
-6
src/extras/geometries/ExtrudeGeometry.js
src/extras/geometries/ExtrudeGeometry.js
+5
-7
src/extras/geometries/TubeGeometry.js
src/extras/geometries/TubeGeometry.js
+1
-2
未找到文件。
examples/js/renderers/CSS3DRenderer.js
浏览文件 @
8ed08e98
...
...
@@ -98,7 +98,7 @@ THREE.CSS3DRenderer = function () {
var
epsilon
=
function
(
value
)
{
return
Math
.
abs
(
value
)
<
0.000001
?
0
:
value
;
return
Math
.
abs
(
value
)
<
Number
.
EPSILON
?
0
:
value
;
};
...
...
examples/js/renderers/CSS3DStereoRenderer.js
浏览文件 @
8ed08e98
...
...
@@ -145,7 +145,7 @@ THREE.CSS3DStereoRenderer = function () {
var
epsilon
=
function
(
value
)
{
return
Math
.
abs
(
value
)
<
0.000001
?
0
:
value
;
return
Math
.
abs
(
value
)
<
Number
.
EPSILON
?
0
:
value
;
};
...
...
src/Three.js
浏览文件 @
8ed08e98
...
...
@@ -90,6 +90,16 @@ if ( self.performance.now === undefined ) {
}
//
if
(
Number
.
EPSILON
===
undefined
)
{
Number
.
EPSILON
=
Math
.
pow
(
2
,
-
52
);
}
//
if
(
Math
.
sign
===
undefined
)
{
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
...
...
src/extras/FontUtils.js
浏览文件 @
8ed08e98
...
...
@@ -285,8 +285,6 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
(
function
(
namespace
)
{
var
EPSILON
=
0.0000000001
;
// takes in an contour array and returns
function
process
(
contour
,
indices
)
{
...
...
@@ -417,7 +415,7 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
cx
=
contour
[
verts
[
w
]
].
x
;
cy
=
contour
[
verts
[
w
]
].
y
;
if
(
EPSILON
>
(
(
(
bx
-
ax
)
*
(
cy
-
ay
)
)
-
(
(
by
-
ay
)
*
(
cx
-
ax
)
)
)
)
return
false
;
if
(
Number
.
EPSILON
>
(
(
(
bx
-
ax
)
*
(
cy
-
ay
)
)
-
(
(
by
-
ay
)
*
(
cx
-
ax
)
)
)
)
return
false
;
var
aX
,
aY
,
bX
,
bY
,
cX
,
cY
;
var
apx
,
apy
,
bpx
,
bpy
,
cpx
,
cpy
;
...
...
@@ -446,7 +444,7 @@ THREE.FontUtils.generateShapes = function ( text, parameters ) {
cCROSSap
=
cX
*
apy
-
cY
*
apx
;
bCROSScp
=
bX
*
cpy
-
bY
*
cpx
;
if
(
(
aCROSSbp
>=
-
EPSILON
)
&&
(
bCROSScp
>=
-
EPSILON
)
&&
(
cCROSSap
>=
-
EPSILON
)
)
return
false
;
if
(
(
aCROSSbp
>=
-
Number
.
EPSILON
)
&&
(
bCROSScp
>=
-
Number
.
EPSILON
)
&&
(
cCROSSap
>=
-
Number
.
EPSILON
)
)
return
false
;
}
...
...
src/extras/ShapeUtils.js
浏览文件 @
8ed08e98
...
...
@@ -39,8 +39,6 @@ THREE.ShapeUtils = {
function
intersect_segments_2D
(
inSeg1Pt1
,
inSeg1Pt2
,
inSeg2Pt1
,
inSeg2Pt2
,
inExcludeAdjacentSegs
)
{
var
EPSILON
=
0.0000000001
;
var
seg1dx
=
inSeg1Pt2
.
x
-
inSeg1Pt1
.
x
,
seg1dy
=
inSeg1Pt2
.
y
-
inSeg1Pt1
.
y
;
var
seg2dx
=
inSeg2Pt2
.
x
-
inSeg2Pt1
.
x
,
seg2dy
=
inSeg2Pt2
.
y
-
inSeg2Pt1
.
y
;
...
...
@@ -50,7 +48,7 @@ THREE.ShapeUtils = {
var
limit
=
seg1dy
*
seg2dx
-
seg1dx
*
seg2dy
;
var
perpSeg1
=
seg1dy
*
seg1seg2dx
-
seg1dx
*
seg1seg2dy
;
if
(
Math
.
abs
(
limit
)
>
EPSILON
)
{
if
(
Math
.
abs
(
limit
)
>
Number
.
EPSILON
)
{
// not parallel
...
...
@@ -216,8 +214,6 @@ THREE.ShapeUtils = {
// The order of legs is important
var
EPSILON
=
0.0000000001
;
// translation of all points, so that Vertex is at (0,0)
var
legFromPtX
=
inLegFromPt
.
x
-
inVertex
.
x
,
legFromPtY
=
inLegFromPt
.
y
-
inVertex
.
y
;
var
legToPtX
=
inLegToPt
.
x
-
inVertex
.
x
,
legToPtY
=
inLegToPt
.
y
-
inVertex
.
y
;
...
...
@@ -227,7 +223,7 @@ THREE.ShapeUtils = {
var
from2toAngle
=
legFromPtX
*
legToPtY
-
legFromPtY
*
legToPtX
;
var
from2otherAngle
=
legFromPtX
*
otherPtY
-
legFromPtY
*
otherPtX
;
if
(
Math
.
abs
(
from2toAngle
)
>
EPSILON
)
{
if
(
Math
.
abs
(
from2toAngle
)
>
Number
.
EPSILON
)
{
// angle != 180 deg.
...
...
src/extras/core/Path.js
浏览文件 @
8ed08e98
...
...
@@ -425,9 +425,8 @@ 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
)
if
(
Math
.
abs
(
lastPoint
.
x
-
points
[
0
].
x
)
<
Number
.
EPSILON
&&
Math
.
abs
(
lastPoint
.
y
-
points
[
0
].
y
)
<
Number
.
EPSILON
)
points
.
splice
(
points
.
length
-
1
,
1
);
if
(
closedPath
)
{
...
...
@@ -515,8 +514,6 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
function
isPointInsidePolygon
(
inPt
,
inPolygon
)
{
var
EPSILON
=
0.0000000001
;
var
polyLen
=
inPolygon
.
length
;
// inPt on polygon contour => immediate success or
...
...
@@ -532,7 +529,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
var
edgeDx
=
edgeHighPt
.
x
-
edgeLowPt
.
x
;
var
edgeDy
=
edgeHighPt
.
y
-
edgeLowPt
.
y
;
if
(
Math
.
abs
(
edgeDy
)
>
EPSILON
)
{
if
(
Math
.
abs
(
edgeDy
)
>
Number
.
EPSILON
)
{
// not parallel
if
(
edgeDy
<
0
)
{
...
...
src/extras/geometries/ExtrudeGeometry.js
浏览文件 @
8ed08e98
...
...
@@ -193,8 +193,6 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
function
getBevelVec
(
inPt
,
inPrev
,
inNext
)
{
var
EPSILON
=
0.0000000001
;
// computes for inPt the corresponding point inPt' on a new contour
// shifted by 1 unit (length of normalized vector) to the left
// if we walk along contour clockwise, this new contour is outside the old one
...
...
@@ -215,7 +213,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
// check for collinear edges
var
collinear0
=
(
v_prev_x
*
v_next_y
-
v_prev_y
*
v_next_x
);
if
(
Math
.
abs
(
collinear0
)
>
EPSILON
)
{
if
(
Math
.
abs
(
collinear0
)
>
Number
.
EPSILON
)
{
// not collinear
...
...
@@ -261,9 +259,9 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
// handle special case of collinear edges
var
direction_eq
=
false
;
// assumes: opposite
if
(
v_prev_x
>
EPSILON
)
{
if
(
v_prev_x
>
Number
.
EPSILON
)
{
if
(
v_next_x
>
EPSILON
)
{
if
(
v_next_x
>
Number
.
EPSILON
)
{
direction_eq
=
true
;
...
...
@@ -271,9 +269,9 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
}
else
{
if
(
v_prev_x
<
-
EPSILON
)
{
if
(
v_prev_x
<
-
Number
.
EPSILON
)
{
if
(
v_next_x
<
-
EPSILON
)
{
if
(
v_next_x
<
-
Number
.
EPSILON
)
{
direction_eq
=
true
;
...
...
src/extras/geometries/TubeGeometry.js
浏览文件 @
8ed08e98
...
...
@@ -174,7 +174,6 @@ THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
numpoints
=
segments
+
1
,
theta
,
epsilon
=
0.0001
,
smallest
,
tx
,
ty
,
tz
,
...
...
@@ -273,7 +272,7 @@ THREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {
vec
.
crossVectors
(
tangents
[
i
-
1
],
tangents
[
i
]
);
if
(
vec
.
length
()
>
epsilon
)
{
if
(
vec
.
length
()
>
Number
.
EPSILON
)
{
vec
.
normalize
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录