# curvegradient.cpp File Reference

Implementation of the "Curve Gradient" layer. More...

`#include "curvegradient.h"`
`#include <synfig/string.h>`
`#include <synfig/time.h>`
`#include <synfig/context.h>`
`#include <synfig/paramdesc.h>`
`#include <synfig/renddesc.h>`
`#include <synfig/surface.h>`
`#include <synfig/value.h>`
`#include <synfig/valuenode.h>`
`#include <ETL/bezier>`
`#include <ETL/hermite>`
`#include <ETL/calculus>`

## Defines

#define | FAKE_TANGENT_STEP 0.000001
#define | POINT_CHECK(x) bp=curve(x); thisdist=(bp-p).mag_squared(); if(thisdist<dist) { ret=iter; dist=thisdist; best_bline_dist=total_bline_dist; best_bline_len=len; best_curve=curve; }

## Functions

| SYNFIG_LAYER_INIT (CurveGradient)
| SYNFIG_LAYER_SET_NAME (CurveGradient,"curve_gradient")
| SYNFIG_LAYER_SET_LOCAL_NAME (CurveGradient, N_("Curve Gradient"))
| SYNFIG_LAYER_SET_CATEGORY (CurveGradient, N_("Gradients"))
| SYNFIG_LAYER_SET_VERSION (CurveGradient,"0.0")
| SYNFIG_LAYER_SET_CVS_ID (CurveGradient,"$Id$")
float | calculate_distance (const synfig::BLinePoint &a, const synfig::BLinePoint &b)
float | calculate_distance (const std::vector< synfig::BLinePoint > &bline, bool bline_loop)
std::vector < synfig::BLinePoint > ::const_iterator | find_closest (bool fast, const std::vector< synfig::BLinePoint > &bline, const Point &p, float &t, bool loop=false, float *bline_dist_ret=0)

## Detailed Description

Implementation of the "Curve Gradient" layer.

$Id$

=== N O T E S ===========================================================

=========================================================================

## Define Documentation

#define FAKE_TANGENT_STEP 0.000001

#define POINT_CHECK | ( | x |  | ) | bp=curve(x); thisdist=(bp-p).mag_squared(); if(thisdist<dist) { ret=iter; dist=thisdist; best_bline_dist=total_bline_dist; best_bline_len=len; best_curve=curve; }

## Function Documentation

SYNFIG_LAYER_INIT | ( | CurveGradient |  | ) |

SYNFIG_LAYER_SET_NAME | ( | CurveGradient | ,
|  | "curve_gradient" |  |
| ) |  |  |

SYNFIG_LAYER_SET_LOCAL_NAME | ( | CurveGradient | ,
|  | N_("Curve Gradient") |  |
| ) |  |  |

SYNFIG_LAYER_SET_CATEGORY | ( | CurveGradient | ,
|  | N_("Gradients") |  |
| ) |  |  |

SYNFIG_LAYER_SET_VERSION | ( | CurveGradient | ,
|  | "0.0" |  |
| ) |  |  |

SYNFIG_LAYER_SET_CVS_ID | ( | CurveGradient | ,
|  | "$Id$" |  |
| ) |  |  |

float calculate_distance | ( | const synfig::BLinePoint & | a,
|  | const synfig::BLinePoint & | b |
| ) |  |  | `[inline]`

References synfig::BLinePoint::get_tangent1(), synfig::BLinePoint::get_tangent2(), and synfig::BLinePoint::get_vertex().

float calculate_distance | ( | const std::vector< synfig::BLinePoint > & | bline,
|  | bool | bline_loop |
| ) |  |  | `[inline]`

std::vector<synfig::BLinePoint>::const_iterator find_closest | ( | bool | fast,
|  | const std::vector< synfig::BLinePoint > & | bline,
|  | const Point & | p,
|  | float & | t,
|  | bool | loop = `false`,
|  | float * | bline_dist_ret = `0` |
| ) |  |  |

Todo:
  is this a redundant call to find_closest()?

References POINT_CHECK.