Logo Search packages:      
Sourcecode: inkscape version File versions

NR::Point sp_spiral_get_xy ( SPSpiral const *  spiral,
gdouble  t 
)

Return one of the points on the spiral.

Parameters:
t specifies how far along the spiral.
Precondition:
t in [0.0, 2.03]. (It doesn't make sense for t to be much more than 1.0, though some callers go slightly beyond 1.0 for curve-fitting purposes.)

Definition at line 520 of file sp-spiral.cpp.

References SPSpiral::arg, SPSpiral::cx, SPSpiral::cy, SPSpiral::exp, SPSpiral::rad, and SPSpiral::revo.

Referenced by sp_spiral_fit_and_draw().

{
      g_assert (spiral != NULL);
      g_assert (SP_IS_SPIRAL(spiral));
      g_assert (spiral->exp >= 0.0);
      /* Otherwise we get NaN for t==0. */
      g_assert (spiral->exp <= 1000.0);
      /* Anything much more results in infinities.  Even allowing 1000 is somewhat overkill. */
      g_assert (t >= 0.0);
      /* Any callers passing -ve t will have a bug for non-integral values of exp. */

      double const rad = spiral->rad * pow(t, (double) spiral->exp);
      double const arg = 2.0 * M_PI * spiral->revo * t + spiral->arg;

      return NR::Point(rad * cos (arg) + spiral->cx,
                   rad * sin (arg) + spiral->cy);
}


Generated by  Doxygen 1.6.0   Back to index