MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / SimplexIslands

Method SimplexIslands

Source/Utils/SimplexIslands.cpp:4–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "SimplexIslands.hpp"
3
4SimplexIslands::SimplexIslands() {
5
6 grad3 = {
7 {1,1,0},{-1,1,0},{1,-1,0},{-1,-1,0},
8 {1,0,1},{-1,0,1},{1,0,-1},{-1,0,-1},
9 {0,1,1},{0,-1,1},{0,1,-1},{0,-1,-1}
10 };
11
12 grad4 = {
13 {0,1,1,1},{0,1,1,-1},{0,1,-1,1},{0,1,-1,-1},
14 {0,-1,1,1},{0,-1,1,-1},{0,-1,-1,1},{0,-1,-1,-1},
15 {1,0,1,1},{1,0,1,-1},{1,0,-1,1},{1,0,-1,-1},
16 {-1,0,1,1},{-1,0,1,-1},{-1,0,-1,1},{-1,0,-1,-1},
17 {1,1,0,1},{1,1,0,-1},{1,-1,0,1},{1,-1,0,-1},
18 {-1,1,0,1},{-1,1,0,-1},{-1,-1,0,1},{-1,-1,0,-1},
19 {1,1,1,0},{1,1,-1,0},{1,-1,1,0},{1,-1,-1,0},
20 {-1,1,1,0},{-1,1,-1,0},{-1,-1,1,0},{-1,-1,-1,0} };
21
22 for (int i = 0; i < 512; i++)
23 {
24 perm[i] = p[i & 255];
25 permMod12[i] = (short)(perm[i] % 12);
26 }
27
28 // Skewing and unskewing factors for 2, 3, and 4 dimensions
29 F2 = 0.5*(sqrt(3.0) - 1.0);
30 G2 = (3.0 - sqrt(3.0)) / 6.0;
31 F3 = 1.0 / 3.0;
32 G3 = 1.0 / 6.0;
33 F4 = (sqrt(5.0) - 1.0) / 4.0;
34 G4 = (5.0 - sqrt(5.0)) / 20.0;
35
36
37}
38
39short SimplexIslands::pbak[] = { 151,160,137,91,90,15,
40 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected