提交 a49b3fba 编写于 作者: M Mr.doob

Merge branch 'bevelround' of https://github.com/jahting/three.js into dev

Conflicts:
	src/extras/geometries/ExtrudeGeometry.js
......@@ -197,9 +197,7 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
function getBevelVec( inPt, inPrev, inNext ) {
var EPSILON = 0.0000000001;
var sign = THREE.Math.sign;
// computes for inPt the corresponding point inPt' on a new contour
// shiftet by 1 unit (length of normalized vector) to the left
......@@ -258,17 +256,27 @@ THREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
} else { // handle special case of colinear edges
if ( ( ( v_prev_x != 0 ) && ( sign(v_prev_x) != sign(v_next_x) ) ) ||
( ( v_prev_x == 0 ) && ( sign(v_prev_y) != sign(v_next_y) ) ) ) {
// console.log("Warning: lines are a straight spike");
v_trans_x = v_prev_x;
v_trans_y = v_prev_y;
shrink_by = Math.sqrt( v_prev_lensq / 2 );
var direction_eq = false; // assumes: opposite
if ( v_prev_x > EPSILON ) {
if ( v_next_x > EPSILON ) { direction_eq = true; }
} else {
if ( v_prev_x < -EPSILON ) {
if ( v_next_x < -EPSILON ) { direction_eq = true; }
} else {
if ( Math.sign(v_prev_y) == Math.sign(v_next_y) ) { direction_eq = true; }
}
}
if ( direction_eq ) {
// console.log("Warning: lines are a straight sequence");
v_trans_x = -v_prev_y;
v_trans_y = v_prev_x;
shrink_by = Math.sqrt( v_prev_lensq );
} else {
// console.log("Warning: lines are a straight spike");
v_trans_x = v_prev_x;
v_trans_y = v_prev_y;
shrink_by = Math.sqrt( v_prev_lensq / 2 );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册