[fpc-pascal] C# translatation
Ryan Joseph
ryan at thealchemistguild.com
Sun Jan 8 11:56:24 CET 2017
> On Jan 8, 2017, at 5:46 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
>
> if h and 1 = 0 then
> result := u
> else
> result := -u;
> if h and 2 = 0 then
> result := result + v
> else
> result := result - v;
Thanks Sven, I appreciate it. I forgot about binary and operator some how also...
C# is pretty nice language imo. These 2 “Perlin” methods appear to initializers on the class. Does anyone dispute that? I guess the value of repeat should be -1 by default and presumably both methods are called when the class is initialized. Otherwise I don’t see how p could be set.
public class Perlin {
public int repeat;
public Perlin(int repeat = -1) {
this.repeat = repeat;
}
private static readonly int[] p;
static Perlin() {
p = new int[512];
for(int x=0;x<512;x++) {
p[x] = permutation[x%256];
}
}
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list