“Final iteration”? Software is never final.
Today’s changes don’t touch the basic algorithm but offer some usability improvements.
First, in the white group you can define a rectangle, not just a square. Also, resolution is specified as ‘ptsPerUnit’ (Points Per Unit, or per inch in this case) and applied to both X and Y dimensions. As noted in the code:
NOTE: For maximum performance, use lowest possible
resolution (1) while experimenting, then raise it for final.
This is worth explaining. Using the example of a 48 inch/unit square, at the lowest resolution of “ptsPerUnit = 1”, there will be 2,401 grid points defining the surface (49 X 49). For each grid point, the distance and damped sine function must be computed for each of the six ripple points. In this case, that’s 2,401 X 6 = 14,406 times through the Expression component, less than a second.
If you use short wavelengths (less than ~2 inches/units in this case), low amplitude ripples will be invisible without going to higher resolution. At least 4 and ideally 7 or 8 ‘ptsPerUnit’. When ‘ptsPerUnit = 7’, the number of grid points jumps from 2,401 to 113,569! Multiply by six ripple points and that’s 681,414 times through the Expression component! 48.2 secs. on an old laptop.
In the process of experimenting, I defined a rectangle smaller than the points and it still worked fine, as expected. No reason to confine ripple points to the “canvas” so I dropped the MD Sliders (XY widgets) and replaced them with X and Y sliders.
Rearranged slightly so the ‘Points’ can be supplied either manually (top left orange group) or from other means, such as the two examples of internalized points, ‘Pts_internal’ and ‘Pts_Rhino’. One of the best ways I found for locating ripple points is baking them in Rhino, importing them to GH, then selecting and moving them in Rhino. (remember to internalize them!)
Added a “switch” (see red arrow) between yellow “Scale” group and cyan “Config” group. And a pair of ten second Data Dam components to delay the heavy crunch after changing parameters.
ripples_2019Jun06a.gh (46.6 KB)
ripples_2019Jun06b.gh (47.4 KB) (ptsPerUnit = 7)