I have a 3D array in which values are monotonic. How to find all (x,y), |f(X,Y,Z) – v1| < t.
There are Omega(n^2) points whose coordinates sum to n - 1. Nothing is known a priori about how the values of these points compare to each other, so, in the worst case, all of them must be inspected. An upper bound that matches up to constant factors is provided by running the 2D algorithm in each constant-z slice.
For each value (eg. v1
), execute the following steps:
Worst case complexity will be O(O(2D algorithm) * n).
For multiple values (v2
, etc.) keep a cache of function evaluations, and re-execute the algorithm for each value. For 100^3, a dense array would suffice.
It might be useful to think of this as an isosurface extraction algorithm, though your monotonicity constraint makes it easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With