Open m-zacharias opened 8 years ago
well stolen from gimp ;) picky side note: linear gradients are not limited to 2D areas.
if you want to use the mathematical description, I would rather define the scalar field directly which is also just the most general (and in user-API the most cumbersome) way of all others you can think of. The question is: can we find a useful set of simple density primitives that are easier to describe (linear line gradient: start-end-point; cos-radial gradient: start-end-point; etc.) then always defining an arbitrary scalar field?
If we start listing primitives to describe scalar density distributions (or their non-zero gradients), please open a new issue. https://github.com/ComputationalRadiationPhysics/picongpu/issues/1502 lists some primitives already.
Didn't know there is a similar treatment about the term "gradient" in gimp. Would have saved me some time, though...
Issue outline
Gradient denotes different things in different contexts. This is for example true for vector graphics as one context and mathematics as another context. It's not obvious which meaning should be preferred within deppp. So let's repeat those two options.
Vector graphics
Linear gradient
This refers to a special kind of color fill for flat contoured 2D areas. It means that along a straight line (that might have a modifiable orientation with respect to the area/contour) the color changes and the amount of change is proportional to distance along the straight line. Perpendicular to that line color doesn't change.
Radial/elliptical gradient
This refers to another special kind of color fill for flat contoured 2D areas. A radial/elliptical gradient has a center point that has a certain color and the color changes, also in a "distance proportional" fashion, as one moves away from the center. The color is always the same on circles/special ellipses around the center.
In both cases the word gradient is a bit vague and denotes something like the whole color fill of a contoured area.
Mathematics
Here the gradient is a vector field obtained from a scalar (potential) field by partially differentiating it with respect to all coordinates. The gradient can be (correctly) described as a field of vectors that at every point in space point towards the direction of the steepest ascent of the potential field and have the slope as absolute value ("length").
Comparison
It's clear, that the vector graphics meaning of gradient is different from the mathematical meaning. The vector graphics linear gradient could mathematically be described as a color (potential) field of constant gradient. Similarly the elliptical gradient is a potential field of elliptically symmetrical mathematical gradient. To conclude: Don't mix up gradient with potential!
Conclusion
My preference for terminology would be using gradient in the mathematical sense because this definition is stricter and will thus (hopefully) produce less confusion by itself. The vector graphics "gradients" I'd rather call densities because that's what they are.