Skip to content

Commit 6add2e7

Browse files
committed
explain sign flip in Rodrigues formula.
1 parent e3aad27 commit 6add2e7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/nodes/materialx/MaterialXCore.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export const mx_rotate3d = ( input, amount = 0, axis = vec3( 0, 1, 0 ) ) => {
2727
const c = cos( rotationRadians );
2828
const oc = sub( 1, c );
2929

30-
// https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula
30+
// based on https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula
31+
// but the code in the Wikipedia article is for v' = M * v, where as
32+
// MaterialX is v' = v * M, thus the order of parameters into the first cross are reversed
3133
return input.mul( c )
3234
.add( input.cross( normalizedAxis ).mul( s ) )
3335
.add( normalizedAxis.mul( normalizedAxis.dot( input ).mul( oc ) ) );

0 commit comments

Comments
 (0)