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

Safer CanvasRenderer's expand().

上级 d141ea85
......@@ -986,15 +986,18 @@ THREE.CanvasRenderer = function ( parameters ) {
function expand( v1, v2 ) {
var x = v2.x - v1.x, y = v2.y - v1.y,
unit = 1 / Math.sqrt( x * x + y * y );
det = x * x + y * y, idet;
x *= unit; y *= unit;
if ( det == 0 ) return;
idet = 1 / Math.sqrt( det );
x *= idet; y *= idet;
v2.x += x; v2.y += y;
v1.x -= x; v1.y -= y;
}
};
// Context cached methods.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册