sousou03 / glmatrix

Automatically exported from code.google.com/p/glmatrix
0 stars 0 forks source link

slerp e lerp #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Suggestion imprementação Lerp and slerp.

vec3.lerp = function(vec, vec2, lerp, dest){
dest[0] = vec[0] + lerp * (vec2[0] - vec[0]);
dest[1] = vec[1] + lerp * (vec2[1] - vec[1]);
dest[2] = vec[2] + lerp * (vec2[2] - vec[2]);
}

e 

quat4.slerp = function(quat, quat2, lerp, dest){
var epsilon = 1.0;

var dot = quat[0]*quat2[0] + quat[1]*quat2[1] + quat[2]*quat2[2] + 
quat[3]*quat2[3];
if (dot < 0.0) epsilon = -1.0;

dest[0] = 1.0 - lerp * quat[0] + epision * lerp * quat2[0];
dest[1] = 1.0 - lerp * quat[1] + epision * lerp * quat2[1];
dest[2] = 1.0 - lerp * quat[2] + epision * lerp * quat2[2];
dest[3] = 1.0 - lerp * quat[3] + epision * lerp * quat2[3];
}

Original issue reported on code.google.com by denis.ra...@gmail.com on 9 Nov 2010 at 4:23

GoogleCodeExporter commented 8 years ago
Suggestion: caching epsilon * lerp.

Original comment by danielhe...@gmail.com on 24 Dec 2010 at 12:49

GoogleCodeExporter commented 8 years ago
Implemented in next release

Original comment by Tojiro@gmail.com on 27 Feb 2011 at 4:54

GoogleCodeExporter commented 8 years ago

Original comment by Tojiro@gmail.com on 27 Feb 2011 at 6:18