]> granicus.if.org Git - imagemagick/commitdiff
tweaked the ClampUpAxes comments to make clear how to compute useful distances from...
authornicolas <nicolas@git.imagemagick.org>
Wed, 4 May 2011 05:34:48 +0000 (05:34 +0000)
committernicolas <nicolas@git.imagemagick.org>
Wed, 4 May 2011 05:34:48 +0000 (05:34 +0000)
magick/resample.c

index 852c5bd7a0a64bbb886ae492129a8bbae11e0a39..ef57d3afa66630c89b120df05f34d495fcecf928 100644 (file)
@@ -728,7 +728,7 @@ static inline void ClampUpAxes(const double dux,
    * position in input space and [x,y].)
    */
   /*
-   * Outputs:
+   * Output:
    *
    * major_mag is the half-length of the major axis of the "new"
    * ellipse.
@@ -747,8 +747,17 @@ static inline void ClampUpAxes(const double dux,
    *
    * Unit vectors are useful for computing projections, in particular,
    * to compute the distance between a point in output space and the
-   * center (of a disk) from the position of the corresponding point
-   * in input space.
+   * center of a unit disk in output space, using the position of the
+   * corresponding point [s,t] in input space. Following the clamping,
+   * the square of this distance is
+   *
+   * ( ( s * major_unit_x + t * major_unit_y ) / major_mag )^2
+   * +
+   * ( ( s * minor_unit_x + t * minor_unit_y ) / minor_mag )^2
+   *
+   * If such distances will be computed for many [s,t]'s, it makes
+   * sense to actually compute the reciprocal of major_mag and
+   * minor_mag and multiply them by the above unit lengths.
    *
    * Now, if you want to modify the input pair of tangent vectors so
    * that it defines the modified ellipse, all you have to do is set