33 return _mm_cvtsd_f64(_mm_floor_sd(_mm_set_sd(0.0), _mm_set_sd(val)));
38 return _mm_cvtsd_f64(_mm_round_sd(_mm_set_sd(0.0), _mm_set_sd(val), _MM_FROUND_TO_NEAREST_INT));
53 for (
int k = 0;
k < d;
k++) {
54 static const uint32_t M = 1664525,
C = 1013904223;
63 return (((
seed & 0xff0000) >> 4) + (
seed & 0xff)) & 0xff;
75 for (
int k = 0;
k < d;
k++) {
76 static const uint32_t M = 1664525,
C = 1013904223;
81 u1.i ^= (
u1.i << 7) & 0x9d2c5680U;
82 u1.i ^= (
u1.i << 15) & 0xefc60000U;
86 u2.c[2] = p[
u1.c[1] +
u2.c[3]];
87 u2.c[1] = p[
u1.c[2] +
u2.c[2]];
88 u2.c[0] = p[
u1.c[3] +
u2.c[1]];
94template <
int d,
class T,
bool periodic>
99 for (
int k = 0;
k < d;
k++) {
110 const int num = 1 << d;
115 for (
int k = 0;
k < d;
k++) {
116 offset[
k] = ((
dummy & (1 <<
k)) != 0);
122 for (
int k = 0;
k < d;
k++) {
135 int k = (d -
newd - 1);
153template <
int d_in,
int d_out,
class T>
160 if (++dim >=
d_out)
break;
166template <
int d_in,
int d_out,
class T>
169 for (
int i = 0;
i <
d_in;
i++) P[
i] = in[
i];
175 for (
int k = 0;
k <
d_out;
k++) P[
k] += (T)1000;
180template <
int d_in,
int d_out,
class T>
183 for (
int i = 0;
i <
d_in;
i++) P[
i] = in[
i];
189 for (
int k = 0;
k <
d_out;
k++) P[
k] += (T)1000;
195template <
int d_in,
int d_out,
bool turbulence,
class T>
198 for (
int i = 0;
i <
d_in;
i++) P[
i] = in[
i];
212 for (
int k = 0;
k <
d_in;
k++) {
238int main(
int argc,
char* argv[]) {
241 for (
int i = 0; i < 10000000; i++) {
242 T foo[3] = {.3, .3, .3};
int main(int argc, char *argv[])
template void FBM< 3, 3, true, double >(const double *, double *, int, double, double)
template void Noise< 4, 3, double >(const double *, double *)
template void FBM< 3, 1, false, double >(const double *, double *, int, double, double)
template void FBM< 4, 3, false, double >(const double *, double *, int, double, double)
template void CellNoise< 3, 3, double >(const double *, double *)
uint32_t hashReduce(uint32_t index[d])
Does a hash reduce to an integer.
T noiseHelper(const T *X, const int *period=0)
Noise with d_in dimensional domain, 1 dimensional abcissa.
template void FBM< 3, 3, false, double >(const double *, double *, int, double, double)
template void Noise< 3, 3, double >(const double *, double *)
template void CellNoise< 3, 1, double >(const double *, double *)
template void PNoise< 3, 1, double >(const double *, const int *, double *)
void PNoise(const T *in, const int *period, T *out)
Periodic Noise with d_in dimensional domain, d_out dimensional abcissa.
unsigned char hashReduceChar(int index[d])
Does a hash reduce to a character.
template void Noise< 1, 1, double >(const double *, double *)
void Noise(const T *in, T *out)
Noise with d_in dimensional domain, d_out dimensional abcissa.
template void Noise< 4, 1, double >(const double *, double *)
void FBM(const T *in, T *out, int octaves, T lacunarity, T gain)
Fractional Brownian Motion. If turbulence is true then turbulence computed.
template void Noise< 2, 1, double >(const double *, double *)
double turbulence(int n, const Vec3d *args)
template void FBM< 3, 1, true, double >(const double *, double *, int, double, double)
void CellNoise(const T *in, T *out)
Computes cellular noise (non-interpolated piecewise constant cell random values)
template void Noise< 3, 1, double >(const double *, double *)
template void FBM< 4, 1, false, double >(const double *, double *, int, double, double)
double s_curve(double t)
This is the Quintic interpolant from Perlin's Improved Noise Paper.
The result is computed int int< br >< div style="margin-left: 40px;"> Picks values randomly between loRange and hiRange based on supplied index(which is automatically hashed).  
with numParticles numAttributes A variable block contains variable names and types but doesn t care what the values are< pre > void f(const std::string &s, MyParticleData *p, int outputDim=3)