Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
e73f153c
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,发现更多精彩内容 >>
提交
e73f153c
编写于
5月 22, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
eecc8f7c
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
216 deletion
+33
-216
build/three.js
build/three.js
+18
-198
build/three.min.js
build/three.min.js
+15
-18
未找到文件。
build/three.js
浏览文件 @
e73f153c
...
@@ -9675,6 +9675,22 @@ THREE.Geometry.prototype = {
...
@@ -9675,6 +9675,22 @@ THREE.Geometry.prototype = {
},
},
center: function () {
this.computeBoundingBox();
var offset = new THREE.Vector3();
offset.addVectors( this.boundingBox.min, this.boundingBox.max );
offset.multiplyScalar( - 0.5 );
this.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
this.computeBoundingBox();
return offset;
},
computeFaceNormals: function () {
computeFaceNormals: function () {
var cb = new THREE.Vector3(), ab = new THREE.Vector3();
var cb = new THREE.Vector3(), ab = new THREE.Vector3();
...
@@ -26683,13 +26699,10 @@ THREE.RenderableLine = function () {
...
@@ -26683,13 +26699,10 @@ THREE.RenderableLine = function () {
/**
/**
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
*/
*/
THREE.GeometryUtils = {
THREE.GeometryUtils = {
// Merge two geometries or geometry and geometry from object (using object's transform)
merge: function ( geometry1, geometry2, materialIndexOffset ) {
merge: function ( geometry1, geometry2, materialIndexOffset ) {
console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );
...
@@ -26709,206 +26722,14 @@ THREE.GeometryUtils = {
...
@@ -26709,206 +26722,14 @@ THREE.GeometryUtils = {
},
},
// Get random point in triangle (via barycentric coordinates)
// (uniform distribution)
// http://www.cgafaq.info/wiki/Random_Point_In_Triangle
randomPointInTriangle: function () {
var vector = new THREE.Vector3();
return function ( vectorA, vectorB, vectorC ) {
var point = new THREE.Vector3();
var a = THREE.Math.random16();
var b = THREE.Math.random16();
if ( ( a + b ) > 1 ) {
a = 1 - a;
b = 1 - b;
}
var c = 1 - a - b;
point.copy( vectorA );
point.multiplyScalar( a );
vector.copy( vectorB );
vector.multiplyScalar( b );
point.add( vector );
vector.copy( vectorC );
vector.multiplyScalar( c );
point.add( vector );
return point;
};
}(),
// Get random point in face (triangle)
// (uniform distribution)
randomPointInFace: function ( face, geometry, useCachedAreas ) {
var vA, vB, vC;
vA = geometry.vertices[ face.a ];
vB = geometry.vertices[ face.b ];
vC = geometry.vertices[ face.c ];
return THREE.GeometryUtils.randomPointInTriangle( vA, vB, vC );
},
// Get uniformly distributed random points in mesh
// - create array with cumulative sums of face areas
// - pick random number from 0 to total area
// - find corresponding place in area array by binary search
// - get random point in face
randomPointsInGeometry: function ( geometry, n ) {
var face, i,
faces = geometry.faces,
vertices = geometry.vertices,
il = faces.length,
totalArea = 0,
cumulativeAreas = [],
vA, vB, vC, vD;
// precompute face areas
for ( i = 0; i < il; i ++ ) {
face = faces[ i ];
vA = vertices[ face.a ];
vB = vertices[ face.b ];
vC = vertices[ face.c ];
face._area = THREE.GeometryUtils.triangleArea( vA, vB, vC );
totalArea += face._area;
cumulativeAreas[ i ] = totalArea;
}
// binary search cumulative areas array
function binarySearchIndices( value ) {
function binarySearch( start, end ) {
// return closest larger index
// if exact number is not found
if ( end < start )
return start;
var mid = start + Math.floor( ( end - start ) / 2 );
if ( cumulativeAreas[ mid ] > value ) {
return binarySearch( start, mid - 1 );
} else if ( cumulativeAreas[ mid ] < value ) {
return binarySearch( mid + 1, end );
} else {
return mid;
}
}
var result = binarySearch( 0, cumulativeAreas.length - 1 )
return result;
}
// pick random face weighted by face area
var r, index,
result = [];
var stats = {};
for ( i = 0; i < n; i ++ ) {
r = THREE.Math.random16() * totalArea;
index = binarySearchIndices( r );
result[ i ] = THREE.GeometryUtils.randomPointInFace( faces[ index ], geometry, true );
if ( ! stats[ index ] ) {
stats[ index ] = 1;
} else {
stats[ index ] += 1;
}
}
return result;
},
// Get triangle area (half of parallelogram)
// http://mathworld.wolfram.com/TriangleArea.html
triangleArea: function () {
var vector1 = new THREE.Vector3();
var vector2 = new THREE.Vector3();
return function ( vectorA, vectorB, vectorC ) {
vector1.subVectors( vectorB, vectorA );
vector2.subVectors( vectorC, vectorA );
vector1.cross( vector2 );
return 0.5 * vector1.length();
};
}(),
// Center geometry so that 0,0,0 is in center of bounding box
center: function ( geometry ) {
center: function ( geometry ) {
geometry.computeBoundingBox();
console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );
return geometry.center();
var bb = geometry.boundingBox;
var offset = new THREE.Vector3();
offset.addVectors( bb.min, bb.max );
offset.multiplyScalar( -0.5 );
geometry.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
geometry.computeBoundingBox();
return offset;
}
}
};
};
/**
/**
* @author alteredq / http://alteredqualia.com/
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
...
@@ -33586,7 +33407,6 @@ THREE.BoxHelper.prototype.update = function ( object ) {
...
@@ -33586,7 +33407,6 @@ THREE.BoxHelper.prototype.update = function ( object ) {
var min = geometry.boundingBox.min;
var min = geometry.boundingBox.min;
var max = geometry.boundingBox.max;
var max = geometry.boundingBox.max;
/*
/*
5____4
5____4
1/___0/|
1/___0/|
...
...
build/three.min.js
浏览文件 @
e73f153c
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录