4.5 Pointwise Operations
For example, to estimate the local gradient magnitude at each point in a flomap:
Lifts a unary floating-point function to operate pointwise on flomaps.
Returns a flomap like fm, but with values linearly rescaled to be between 0.0 and 1.0 inclusive.
Besides increasing contrast, you could use this function to visualize oversaturated flomaps, or visualize flomaps that don’t correspond directly to displayed images, such as height maps and normal maps.
Binary operations accept the following argument combinations, in either order:
Two flomaps. Both flomaps must have the same number of components, or one of them must have one component.
If one flomap has one component, it is (conceptually) self-appended (see flomap-append-components) as much as needed before the operation.
In either case, both flomaps must have the same width and height.
One flomap, one Real. In this case, the real value is (conceptually) made into a uniform flomap (see make-flomap) before applying the operation.
Any other argument combination will raise a type error.
Examples:
Binary pointwise operators could behave according to the Conceptual Model—that is, expand the smaller one to the larger size by filling it with 0.0.
However, operating on the components of two different-size flomaps almost always indicates a logic or design error.
If it really is intended, use flomap-inset or subflomap to expand the smaller flomap manually, with more control over the expansion.
Because
fm is an alpha-multiplied flomap (see
Opacity (Alpha Components)), multiplying each component by a scalar less than
1.0 results in a more transparent flomap:
Lifts a binary floating-point function to operate pointwise on flomaps, allowing the same argument combinations as
fm+ and others.
Using inline-flomap-lift instead of flomap-lift may ensure that f is inlined, and therefore floats remain unboxed.
This is not available in untyped Racket.
Using inline-flomap-lift2 instead of flomap-lift2 may ensure that f is inlined, and therefore floats remain unboxed.
This is not available in untyped Racket.