c++ - Trilinear Interpolation in C# -



c++ - Trilinear Interpolation in C# -

i need create trilinear interpolation in c#, i´ve been searching , i´ve found , illustration in c++.

the illustration here: http://www.siafoo.net/snippet/33, in c++.

i need , illustration in c# or someboy can translate code c#, becauase have tried , don´t known.

this close transliteration can understand, clearly not c# code.

public static class interpolator { public static double linear(double target, params double[] values) { homecoming target * values[0] + (1.0 - target) * values[1]; } public static double bilinear(double[] target, params double[] values) { var prime = new[] { linear(target[1], values), linear(target[1], values.skip(2).take(2).toarray()) }; homecoming linear(target[0], prime); } public static double trilinear(double[] target, params double[] values) { var prime = new[] { bilinear(target, values), bilinear(target.skip(1).toarray(), values.skip(4).toarray()) }; homecoming linear(target[2], prime); } }

note: since c# has generics , not templates, it's not possible generalize code type t. c++ compiler can check @ runtime type t implements required operators, there no c# type constraint allow substitute numeric types t. compiler can't resolve operators, using generics not possible here.

c# c++ interpolation

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -