File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,11 @@ struct CellNoise2D:Noise
61
61
// as “near” and “far” points. We call these points the *generating points*.
62
62
// The sample point (example) has been marked with an ‘*’.
63
63
64
- // A ------- far
64
+ // A ------ far
65
65
// | | |
66
66
// |----+----|
67
67
// | * | |
68
- // near - ------ A
68
+ // near ------ A
69
69
70
70
// The actual feature points never spawn outside of the unit square surrounding
71
71
// their generating points. Therefore, the boundaries of the generating
@@ -111,6 +111,13 @@ struct CellNoise2D:Noise
111
111
test ( generating_point: far)
112
112
}
113
113
114
+ // EARLY EXIT: if we have a point within 0.5 units, we don’t have to check
115
+ // the outer kernel
116
+ if r2_min < 0.5 * 0.5
117
+ {
118
+ return self . amplitude * r2_min
119
+ }
120
+
114
121
// This is the part where shit hits the fan. (`inner` and `outer` are never
115
122
// sampled directly, they are used for calculating the coordinates of the
116
123
// generating point.)
@@ -152,6 +159,13 @@ struct CellNoise2D:Noise
152
159
test ( generating_point: ( far. a, inner. b) )
153
160
}
154
161
162
+ // EARLY EXIT: if we have a point within 1 unit, we don’t have to check
163
+ // the D points or the E points
164
+ if r2_min < 1 * 1
165
+ {
166
+ return self . amplitude * r2_min
167
+ }
168
+
155
169
// D points
156
170
if ( 1.5 - nearpoint_disp. y) * ( 1.5 - nearpoint_disp. y) < r2_min
157
171
{
You can’t perform that action at this time.
0 commit comments