21 noise(
const LVecBase2d &value)
const {
23 nassertr(!_index.empty(), make_nan(0.0));
26 LVecBase2d vec = _input_xform.xform_point(value);
32 double xf = cfloor(x);
33 double yf = cfloor(y);
35 int X = ((int)xf) & _table_size_mask;
36 int Y = ((int)yf) & _table_size_mask;
47 nassertr(X >= 0 && X + 1 < _index.size(), make_nan(0.0));
48 int A = _index[X] + Y;
49 int B = _index[X + 1] + Y;
51 nassertr(A >= 0 && A + 1 < _index.size(), make_nan(0.0));
52 nassertr(B >= 0 && B + 1 < _index.size(), make_nan(0.0));
56 lerp(v, lerp(u, grad(_index[A], x, y),
57 grad(_index[B], x - 1, y)),
58 lerp(u, grad(_index[A + 1], x, y - 1),
59 grad(_index[B + 1], x - 1, y - 1)));
70 init_unscaled_xform() {
71 double rot = _randomizer.random_real(360.0f);
72 _unscaled_xform = LMatrix3d::rotate_mat(rot);
76 _unscaled_xform.set_row(2, LVecBase2d(_randomizer.random_real_unit(),
77 _randomizer.random_real_unit()));
double noise(double x, double y) const
Returns the noise function of the three inputs.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.