#include <bdgl_curve_algs.h>
Public Member Functions | |
~bdgl_curve_algs () | |
Destructor. | |
Static Public Member Functions | |
static int | closest_point (vdgl_edgel_chain_sptr const &ec, const double x, const double y) |
Finds the index on a digital curve closest to the given point. | |
static double | closest_point (vdgl_digital_curve_sptr const &dc, const double x, const double y) |
Finds the index on a digital curve closest to the given point. | |
static bool | closest_point (vdgl_digital_curve_sptr const &dc, const double x, const double y, double &xc, double &yc) |
Finds the x-y coordinates on a digital curve closest to the given point. | |
static bool | closest_point_near (vdgl_edgel_chain_sptr const &ec, const int index, const double x, const double y, double &xc, double &yc) |
Finds location on a digital curve closest to the given point at index. | |
static int | closest_end (vdgl_edgel_chain_sptr const &ec, const double x, const double y) |
Finds the end of the edgel chain closest to the given point. | |
static vdgl_digital_curve_sptr | reverse (vdgl_digital_curve_sptr const &dc) |
Reverses the edgel chain. | |
static bool | intersect_bounding_box (vdgl_digital_curve_sptr const &dc, vgl_line_2d< double > &line) |
Intersect the bounding box of the digital curve with the line as a test. | |
static bool | intersect_line_fast (vdgl_digital_curve_sptr const &dc, vgl_line_2d< double > &line, vcl_vector< double > &indices) |
Intersect the curve with an infinite line, return the index values. | |
static bool | intersect_line_fast (vdgl_digital_curve_sptr const &dc, vgl_line_2d< double > &line, vcl_vector< vgl_point_2d< double > > &pts) |
Intersect the curve with an infinite line, return the points. | |
static bool | intersect_line (vdgl_digital_curve_sptr const &dc, vgl_line_2d< double > &line, vcl_vector< double > &indices) |
Intersect the curve with an infinite line, return the index values. | |
static bool | intersect_line (vdgl_digital_curve_sptr const &dc, vgl_line_2d< double > &line, vcl_vector< vgl_point_2d< double > > &pts) |
Intersect the curve with an infinite line, return the points. | |
static bool | match_intersection (vdgl_digital_curve_sptr const &dc, vgl_line_2d< double > &line, vgl_point_2d< double > const &ref_point, double ref_gradient_angle, vgl_point_2d< double > &point) |
Intersect a curve with a line and match the reference edgel point. | |
static bool | line_gen (float xs, float ys, float xe, float ye, bool &init, bool &done, float &x, float &y) |
Generate points along a digital straight line. | |
static int | add_straight_edgels (vdgl_edgel_chain_sptr const &ec, const double x, const double y, bool debug=false) |
Add edgels to an edgel chain along a digital straight line. | |
static void | smooth_curve (vcl_vector< vgl_point_2d< double > > &curve, double sigma=1.0) |
static vdgl_digital_curve_sptr | create_digital_curves (vcl_vector< vgl_point_2d< double > > &curve) |
Static Public Attributes | |
static BDGL_DLL_DATA const double | tol = 1e-16 |
static BDGL_DLL_DATA const double | max_edgel_sep = 2.0 |
static BDGL_DLL_DATA const double | synthetic = 0 |
Private Member Functions | |
bdgl_curve_algs () |
Definition at line 20 of file bdgl_curve_algs.h.
bdgl_curve_algs::~bdgl_curve_algs | ( | ) |
Destructor.
Definition at line 32 of file bdgl_curve_algs.cxx.
bdgl_curve_algs::bdgl_curve_algs | ( | ) | [private] |
int bdgl_curve_algs::add_straight_edgels | ( | vdgl_edgel_chain_sptr const & | ec, |
const double | xe, | ||
const double | ye, | ||
bool | debug = false |
||
) | [static] |
Add edgels to an edgel chain along a digital straight line.
Given an existing edgel_chain, add new edgels from the end along a straight digital line to reach (x, y).
The number of edgels added is returned
Definition at line 663 of file bdgl_curve_algs.cxx.
int bdgl_curve_algs::closest_end | ( | vdgl_edgel_chain_sptr const & | ec, |
const double | x, | ||
const double | y | ||
) | [static] |
Finds the end of the edgel chain closest to the given point.
returns either 0 or N depending on which end of the chain is closer to the given point
Definition at line 691 of file bdgl_curve_algs.cxx.
int bdgl_curve_algs::closest_point | ( | vdgl_edgel_chain_sptr const & | ec, |
const double | x, | ||
const double | y | ||
) | [static] |
Finds the index on a digital curve closest to the given point.
Finds the index on an edgel_chain closest to the given point (x, y).
Later this routine can become a method on vdgl_edgel_chain.
Definition at line 60 of file bdgl_curve_algs.cxx.
double bdgl_curve_algs::closest_point | ( | vdgl_digital_curve_sptr const & | dc, |
const double | x, | ||
const double | y | ||
) | [static] |
Finds the index on a digital curve closest to the given point.
Finds the index (on the interval [0.0 1.0]) on a digital curve closest to the given point (x, y).
Definition at line 40 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::closest_point | ( | vdgl_digital_curve_sptr const & | dc, |
const double | x, | ||
const double | y, | ||
double & | xc, | ||
double & | yc | ||
) | [static] |
Finds the x-y coordinates on a digital curve closest to the given point.
Finds the closest point, (xc, yc) on a digital curve to a given location (x,y).
Current implementation is not the best since it is discrete with the edgel_chain index. Ultimately it should use the interpolator to refine the location on the digital_curve.
Definition at line 91 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::closest_point_near | ( | vdgl_edgel_chain_sptr const & | ec, |
const int | index, | ||
const double | x, | ||
const double | y, | ||
double & | xc, | ||
double & | yc | ||
) | [static] |
Finds location on a digital curve closest to the given point at index.
Finds the closest point on an edgel chain near a given point (x, y) in the neighborhood of an index.
We assume that the nearest point is on the interval [index, index+1].
Definition at line 137 of file bdgl_curve_algs.cxx.
vdgl_digital_curve_sptr bdgl_curve_algs::create_digital_curves | ( | vcl_vector< vgl_point_2d< double > > & | curve | ) | [static] |
Definition at line 748 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::intersect_bounding_box | ( | vdgl_digital_curve_sptr const & | dc, |
vgl_line_2d< double > & | line | ||
) | [static] |
Intersect the bounding box of the digital curve with the line as a test.
preliminary test to see if an infinite line intersects the bounding box of the digital curve.
Definition at line 191 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::intersect_line | ( | vdgl_digital_curve_sptr const & | dc, |
vgl_line_2d< double > & | line, | ||
vcl_vector< double > & | indices | ||
) | [static] |
Intersect the curve with an infinite line, return the index values.
intersect an infinite line with the digital curve.
If there is no intersection return false. Note that the line can intersect multiple times. The curve parameter indices at the intersection points are returned
Definition at line 500 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::intersect_line | ( | vdgl_digital_curve_sptr const & | dc, |
vgl_line_2d< double > & | line, | ||
vcl_vector< vgl_point_2d< double > > & | pts | ||
) | [static] |
Intersect the curve with an infinite line, return the points.
intersect an infinite line with the digital curve.
If there is no intersection return false. Note that the line can intersect multiple times. All the intersections are returned.
Definition at line 323 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::intersect_line_fast | ( | vdgl_digital_curve_sptr const & | dc, |
vgl_line_2d< double > & | line, | ||
vcl_vector< double > & | indices | ||
) | [static] |
Intersect the curve with an infinite line, return the index values.
intersect an infinite line with the digital curve.
This is a recursive implementation for faster computation
If there is no intersection return false. Note that the line can intersect multiple times. The curve parameter indices at the intersection points are returned
This implementation uses a recursive helper function
Definition at line 448 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::intersect_line_fast | ( | vdgl_digital_curve_sptr const & | dc, |
vgl_line_2d< double > & | line, | ||
vcl_vector< vgl_point_2d< double > > & | pts | ||
) | [static] |
Intersect the curve with an infinite line, return the points.
intersect an infinite line with the digital curve.
This is a recursive implementation for faster computation
If there is no intersection return false. Note that the line can intersect multiple times. All the intersections are returned.
This implementation uses a recursive helper function
Definition at line 273 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::line_gen | ( | float | xs, |
float | ys, | ||
float | xe, | ||
float | ye, | ||
bool & | init, | ||
bool & | done, | ||
float & | x, | ||
float & | y | ||
) | [static] |
Generate points along a digital straight line.
generate contiguous pixels on a straight line.
Advance along a line and generate contiguous pixels on a straight line defined by (xs, ys) : (xe, ye). The samples are generated as values of (x, y). The routine is called in a loop that generates the points, e.g.,
while (line_gen(xs, ys, xe, ye, init, done, x, y)) { ...
The routine needs two internal state variables, init and done. init should be set to true done should be set to false when the routine is first called.
Definition at line 606 of file bdgl_curve_algs.cxx.
bool bdgl_curve_algs::match_intersection | ( | vdgl_digital_curve_sptr const & | dc, |
vgl_line_2d< double > & | line, | ||
vgl_point_2d< double > const & | ref_point, | ||
double | ref_gradient_angle, | ||
vgl_point_2d< double > & | point | ||
) | [static] |
Intersect a curve with a line and match the reference edgel point.
Intersect a curve and find the closest point to ref_point with a compatible gradient angle.
Definition at line 546 of file bdgl_curve_algs.cxx.
vdgl_digital_curve_sptr bdgl_curve_algs::reverse | ( | vdgl_digital_curve_sptr const & | dc | ) | [static] |
Reverses the edgel chain.
It is sometimes necessary to reverse the order of the digital curve so that the initial point corresponds to v1 of a topology edge.
Definition at line 176 of file bdgl_curve_algs.cxx.
void bdgl_curve_algs::smooth_curve | ( | vcl_vector< vgl_point_2d< double > > & | curve, |
double | sigma = 1.0 |
||
) | [static] |
Definition at line 717 of file bdgl_curve_algs.cxx.
const double bdgl_curve_algs::max_edgel_sep = 2.0 [static] |
Definition at line 24 of file bdgl_curve_algs.h.
const double bdgl_curve_algs::synthetic = 0 [static] |
Definition at line 25 of file bdgl_curve_algs.h.
const double bdgl_curve_algs::tol = 1e-16 [static] |
Definition at line 23 of file bdgl_curve_algs.h.