提交 aa3df26a 编写于 作者: K koolkap 提交者: Mr.doob

adding the lerp to Math class #9728 (#9767)

* adding the lerp to Math class #9728

Adding the precise  interpolation from point x to y using factor t.

* Adding the documentation for Lerp function

Adding the lerp in doc support
上级 dddfcc6a
......@@ -75,6 +75,18 @@
Converts radians to degrees
</div>
<h3>[method:Float lerp]( [page:Float x], [page:Float y], [page:Float t] )</h3>
<div>
x -- Start point. <br />
y -- End point. <br />
t -- Closed unit interval from [0,1].
</div>
<div>
Returns a value interpolated from two known points based on the interval.<br/><br/>
[link:https://en.wikipedia.org/wiki/Linear_interpolation Wikipedia]
</div>
<h3>[method:Float smoothstep]( [page:Float x], [page:Float min], [page:Float max] )</h3>
<div>
x -- The value to evaluate based on its position between min and max. <br />
......
......@@ -70,6 +70,13 @@ _Math = {
},
//https://en.wikipedia.org/wiki/Linear_interpolation
lerp: function( x, y, t ){
return ( 1 - t ) * x + t * y;
},
// http://en.wikipedia.org/wiki/Smoothstep
smoothstep: function ( x, min, max ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册