General intrinsic curve class. More...
#include <bsol_intrinsic_curve_2d.h>
Public Types | |
enum | vsol_spatial_object_2d_type |
enum | vsol_curve_2d_type |
Public Member Functions | |
bsol_intrinsic_curve_2d () | |
Default Constructor. | |
bsol_intrinsic_curve_2d (const vcl_vector< vsol_point_2d_sptr > &new_vertices) | |
Constructor from a vcl_vector of points. | |
bsol_intrinsic_curve_2d (const vsol_polyline_2d_sptr poly) | |
Constructor from a vsol_polyline_2d_sptr. | |
bsol_intrinsic_curve_2d (const bsol_intrinsic_curve_2d &other) | |
Copy constructor. | |
virtual | ~bsol_intrinsic_curve_2d () |
Destructor. | |
virtual vsol_spatial_object_2d * | clone (void) const |
Clone `this': creation of a new object and initialization. | |
vcl_string | is_a () const |
Return a platform independent string identifying the class. | |
bool | isOpen (void) const |
virtual vsol_point_2d_sptr | p0 () const |
Return the first point of `this'; pure virtual of vsol_curve_2d. | |
virtual vsol_point_2d_sptr | p1 () const |
Return the last point of `this'; pure virtual of vsol_curve_2d. | |
bool | valid_index (unsigned int i) const |
Is `i' a valid index for the list of vertices ?. | |
vsol_point_2d_sptr | vertex (const int i) const |
Return vertex `i'. | |
double | x (const int i) const |
Return x coord of vertex `i'. | |
double | y (const int i) const |
Return y coord of vertex `i'. | |
int | size (void) const |
Return the number of vertices. | |
double | arcLength (const int i) const |
Return the total arclength from vertex `0' to vertex `i'. | |
double | s (const int i) const |
Return the total arclength of the current vertex `i-1' to vertex `i'. | |
double | normArcLength (const int i) const |
Return the normalized arclength from vertex `0' to vertex `i'. | |
virtual double | length (void) const |
Return the length of the intrinsic curve. | |
double | dx (const int i) const |
Return the dx vertex `i-1' to vertex `i'. | |
double | dy (const int i) const |
Return the dy vertex `i-1' to vertex `i'. | |
double | curvature (const int i) const |
Return the curvature of vertex `i'. | |
double | angle (const int i) const |
Return the angle of vertex `i'. | |
double | totalCurvature (void) const |
Return the total curvature of the intrinsic curve. | |
double | totalAngleChange (void) const |
Return the total angle change of the intrinsic curve. | |
virtual bool | operator== (const bsol_intrinsic_curve_2d &other) const |
Has `this' the same points than `other' in the same order ?. | |
virtual bool | operator== (const vsol_spatial_object_2d &obj) const |
spatial object equality. | |
bool | operator!= (const bsol_intrinsic_curve_2d &o) const |
Has `this' the same points than `other' in the same order ?. | |
void | setOpen (bool flag) |
virtual void | set_p0 (const vsol_point_2d_sptr &new_p0) |
Set the first point of the curve. | |
virtual void | set_p1 (const vsol_point_2d_sptr &new_p1) |
Set the last point of the curve. | |
void | computeProperties () |
Compute intrinsic properties. | |
void | clear () |
Delete all points of the intrinsic curve. | |
void | add_vertex (const vsol_point_2d_sptr &new_p, bool bRecomputeProterties=false) |
Add another point to the end of the intrinsic curve. | |
void | add_vertex (double x, double y) |
Add another point to the end of the intrinsic curve. | |
void | remove_vertex (const int i, bool bRecomputeProterties=false) |
Remove one vertex from the intrinsic curve. | |
void | modify_vertex (const int i, double x, double y, bool bRecomputeProterties=false) |
Modify one vertex of the intrinsic curve. | |
void | insert_vertex (int i, double x, double y, bool bRecomputeProterties=false) |
Insert one vertex to position `i' of the intrinsic curve. | |
void | readCONFromFile (vcl_string fileName) |
bool | upsample (int new_size) |
Added by Ozge Can Ozcanli to upsample the curve. | |
virtual void | compute_bounding_box (void) const |
Compute the bounding box of `this'. | |
void | describe (vcl_ostream &strm, int blanking=0) const |
output description to stream. | |
vsol_spatial_object_2d_type | spatial_type () const |
virtual vsol_curve_2d * | cast_to_curve () |
virtual const vsol_curve_2d * | cast_to_curve () const |
virtual vsol_line_2d const * | cast_to_line () const |
virtual vsol_line_2d * | cast_to_line () |
virtual dbsol_circ_arc_2d const * | cast_to_circ_arc () const |
virtual dbsol_circ_arc_2d * | cast_to_circ_arc () |
virtual vsol_conic_2d const * | cast_to_conic () const |
virtual vsol_conic_2d * | cast_to_conic () |
virtual vsol_polyline_2d const * | cast_to_polyline () const |
virtual vsol_polyline_2d * | cast_to_polyline () |
virtual vsol_digital_curve_2d const * | cast_to_digital_curve () const |
virtual vsol_digital_curve_2d * | cast_to_digital_curve () |
virtual vdgl_digital_curve const * | cast_to_vdgl_digital_curve () const |
virtual vdgl_digital_curve * | cast_to_vdgl_digital_curve () |
const char * | get_name () const |
void | un_protect () |
short | version () const |
virtual void | b_write (vsl_b_ostream &os) const |
virtual void | b_read (vsl_b_istream &is) |
virtual void | print (vcl_ostream &strm=vcl_cout) const |
bool | operator!= (vsol_spatial_object_2d const &obj) |
vsol_box_2d_sptr | get_bounding_box () const |
double | get_min_x () const |
double | get_max_x () const |
double | get_min_y () const |
double | get_max_y () const |
virtual vsol_spatial_object_2d * | cast_to_spatial_object () |
virtual vsol_spatial_object_2d const * | cast_to_spatial_object () const |
virtual vtol_topology_object * | cast_to_topology_object () |
virtual vtol_topology_object const * | cast_to_topology_object () const |
virtual vsol_spatial_object_2d * | cast_to_vsol_spatial_object () |
virtual vsol_spatial_object_2d const * | cast_to_vsol_spatial_object () const |
virtual vsol_point_2d * | cast_to_point () |
virtual vsol_point_2d const * | cast_to_point () const |
virtual vsol_region_2d * | cast_to_region () |
virtual vsol_region_2d const * | cast_to_region () const |
virtual vsol_group_2d * | cast_to_group () |
virtual vsol_group_2d const * | cast_to_group () const |
int | get_id () const |
void | set_id (int i) |
void | set_user_flag (unsigned int flag) |
bool | get_user_flag (unsigned int flag) |
void | unset_user_flag (unsigned int flag) |
void | set_tagged_union_flag () |
bool | get_tagged_union_flag () |
void | unset_tagged_union_flag () |
int | get_tag_id () |
void | set_tag_id (int id) |
void | touch () |
unsigned long | get_time_stamp () const |
bool | older (vul_timestamp const &t) const |
bool | older (vul_timestamp const *t) const |
void | ref () |
void | unref () |
int | get_references () const |
bool | is_referenced () const |
Public Attributes | |
SPATIAL_NO_TYPE | |
TOPOLOGYOBJECT | |
POINT | |
CURVE | |
REGION | |
SPATIALGROUP | |
VOLUME | |
NUM_SPATIALOBJECT_TYPES | |
CURVE_NO_TYPE | |
LINE | |
CIRCULAR_ARC | |
CONIC | |
POLYLINE | |
DIGITAL_CURVE | |
NUM_CURVE_TYPES | |
Static Public Attributes | |
static const char * | SpatialTypes [] |
static const float | eps |
Protected Member Functions | |
void | computeDerivatives () |
Computing the properties of the curve. | |
void | computeCurvatures () |
Compute curvature. Assumes derivative computation has been done. | |
void | computeArcLength () |
Compute arc length and normalized arc length. | |
void | computeAngles () |
Compute angles. | |
bool | endpoints_equal (const vsol_curve_2d &other) const |
void | not_applicable (vcl_string const &message) const |
void | empty_bounding_box () const |
void | set_bounding_box (vsol_box_2d_sptr const &box) const |
void | set_bounding_box (double x, double y) const |
void | add_to_bounding_box (double x, double y) const |
void | add_to_bounding_box (vsol_box_2d_sptr const &box) const |
void | grow_minmax_bounds (vsol_box_2d_sptr const &b) const |
void | check_update_bounding_box () const |
Protected Attributes | |
vcl_vector< vsol_point_2d_sptr > * | storage_ |
Pointer to list of vsol_point_2d smart pointers. | |
vsol_point_2d_sptr | p0_ |
First point of the curve : just to conform to vsol_curve_2d standard. | |
vsol_point_2d_sptr | p1_ |
Last point of the curve. | |
vcl_vector< double > | arcLength_ |
Arclength measured from the p0_. | |
vcl_vector< double > | s_ |
Arclength of the current segment i to i+1. | |
vcl_vector< double > | normArcLength_ |
Normalized arclength measured from the p0_. | |
double | length_ |
Length of the intrinsic curve. | |
vcl_vector< double > | dx_ |
dx of the intrinsic curve. | |
vcl_vector< double > | dy_ |
dy of the intrinsic curve. | |
vcl_vector< double > | curvature_ |
Curvature of the intrinsic curve. | |
vcl_vector< double > | angle_ |
Bending angle of the intrinsic curve. | |
double | totalCurvature_ |
Total curvature of the intrinsic curve. | |
double | totalAngleChange_ |
Total angle change of the intrinsic curve. | |
bool | isOpen_ |
unsigned int | tag_ |
int | id_ |
unsigned long | timestamp_ |
Static Protected Attributes | |
static int | tagcount_ |
Friends | |
friend vcl_ostream & | operator<< (vcl_ostream &, vsol_spatial_object_2d const &) |
friend vcl_ostream & | operator<< (vcl_ostream &, vsol_spatial_object_2d const *) |
General intrinsic curve class.
Definition at line 37 of file bsol_intrinsic_curve_2d.h.
bsol_intrinsic_curve_2d::bsol_intrinsic_curve_2d | ( | ) |
Default Constructor.
Definition at line 21 of file bsol_intrinsic_curve_2d.cxx.
bsol_intrinsic_curve_2d::bsol_intrinsic_curve_2d | ( | const vcl_vector< vsol_point_2d_sptr > & | new_vertices | ) |
Constructor from a vcl_vector of points.
Definition at line 30 of file bsol_intrinsic_curve_2d.cxx.
bsol_intrinsic_curve_2d::bsol_intrinsic_curve_2d | ( | const vsol_polyline_2d_sptr | poly | ) |
Constructor from a vsol_polyline_2d_sptr.
Definition at line 37 of file bsol_intrinsic_curve_2d.cxx.
bsol_intrinsic_curve_2d::bsol_intrinsic_curve_2d | ( | const bsol_intrinsic_curve_2d & | other | ) |
Copy constructor.
Definition at line 49 of file bsol_intrinsic_curve_2d.cxx.
bsol_intrinsic_curve_2d::~bsol_intrinsic_curve_2d | ( | ) | [virtual] |
Destructor.
Definition at line 62 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::add_vertex | ( | const vsol_point_2d_sptr & | new_p, |
bool | bRecomputeProterties = false |
||
) |
Add another point to the end of the intrinsic curve.
Add another point to the curve.
Definition at line 185 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::add_vertex | ( | double | x, |
double | y | ||
) | [inline] |
Add another point to the end of the intrinsic curve.
Definition at line 197 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::angle | ( | const int | i | ) | const |
Return the angle of vertex `i'.
Return the angle of the vertex `i'.
Definition at line 145 of file bsol_intrinsic_curve_2d.cxx.
double bsol_intrinsic_curve_2d::arcLength | ( | const int | i | ) | const [inline] |
Return the total arclength from vertex `0' to vertex `i'.
Definition at line 123 of file bsol_intrinsic_curve_2d.h.
void bsol_intrinsic_curve_2d::clear | ( | void | ) |
Delete all points of the intrinsic curve.
Definition at line 119 of file bsol_intrinsic_curve_2d.cxx.
vsol_spatial_object_2d * bsol_intrinsic_curve_2d::clone | ( | void | ) | const [virtual] |
Clone `this': creation of a new object and initialization.
See Prototype pattern
Implements vsol_curve_2d.
Definition at line 70 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::compute_bounding_box | ( | void | ) | const [virtual] |
Compute the bounding box of `this'.
Reimplemented from vsol_curve_2d.
Definition at line 153 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::computeAngles | ( | ) | [protected] |
Compute angles.
IMPORTANT NOTE: in open curve matching giving the inputs as. OPEN curves or CLOSE curves (i.e. in .con file) changes the cost computation due to the following operation In closed curve matching, input curves should always be given as CLOSE curves.
Definition at line 428 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::computeArcLength | ( | ) | [protected] |
Compute arc length and normalized arc length.
Definition at line 271 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::computeCurvatures | ( | ) | [protected] |
Compute curvature. Assumes derivative computation has been done.
Definition at line 329 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::computeDerivatives | ( | ) | [protected] |
Computing the properties of the curve.
Compute derivatives.
Definition at line 385 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::computeProperties | ( | ) |
Compute intrinsic properties.
Public function that calls the private functions to compute the various curve properties.
Note that if you even call the other modifying function with the flag bRecomputeProperties set to false, remember to call this function to recompute intrinsic properties of this curve.
Definition at line 483 of file bsol_intrinsic_curve_2d.cxx.
double bsol_intrinsic_curve_2d::curvature | ( | const int | i | ) | const |
Return the curvature of vertex `i'.
Return the curvature of the vertex `i'.
Definition at line 137 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::describe | ( | vcl_ostream & | strm, |
int | blanking = 0 |
||
) | const [inline, virtual] |
output description to stream.
Reimplemented from vsol_curve_2d.
Definition at line 221 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::dx | ( | const int | i | ) | const [inline] |
Return the dx vertex `i-1' to vertex `i'.
Definition at line 137 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::dy | ( | const int | i | ) | const [inline] |
Return the dy vertex `i-1' to vertex `i'.
Definition at line 142 of file bsol_intrinsic_curve_2d.h.
void bsol_intrinsic_curve_2d::insert_vertex | ( | int | i, |
double | x, | ||
double | y, | ||
bool | bRecomputeProterties = false |
||
) |
Insert one vertex to position `i' of the intrinsic curve.
insert into i-1.
Note that it insert the vertex into `i-1'
Definition at line 209 of file bsol_intrinsic_curve_2d.cxx.
vcl_string bsol_intrinsic_curve_2d::is_a | ( | ) | const [inline, virtual] |
Return a platform independent string identifying the class.
Implements vsol_curve_2d.
Definition at line 93 of file bsol_intrinsic_curve_2d.h.
bool bsol_intrinsic_curve_2d::isOpen | ( | void | ) | const [inline] |
Definition at line 98 of file bsol_intrinsic_curve_2d.h.
virtual double bsol_intrinsic_curve_2d::length | ( | void | ) | const [inline, virtual] |
Return the length of the intrinsic curve.
Implements vsol_curve_2d.
Definition at line 135 of file bsol_intrinsic_curve_2d.h.
void bsol_intrinsic_curve_2d::modify_vertex | ( | const int | i, |
double | x, | ||
double | y, | ||
bool | bRecomputeProterties = false |
||
) |
Modify one vertex of the intrinsic curve.
Definition at line 200 of file bsol_intrinsic_curve_2d.cxx.
double bsol_intrinsic_curve_2d::normArcLength | ( | const int | i | ) | const |
Return the normalized arclength from vertex `0' to vertex `i'.
bool bsol_intrinsic_curve_2d::operator!= | ( | const bsol_intrinsic_curve_2d & | o | ) | const [inline] |
Has `this' the same points than `other' in the same order ?.
Definition at line 163 of file bsol_intrinsic_curve_2d.h.
bool bsol_intrinsic_curve_2d::operator== | ( | const bsol_intrinsic_curve_2d & | other | ) | const [virtual] |
Has `this' the same points than `other' in the same order ?.
Definition at line 81 of file bsol_intrinsic_curve_2d.cxx.
bool bsol_intrinsic_curve_2d::operator== | ( | const vsol_spatial_object_2d & | obj | ) | const [virtual] |
spatial object equality.
Reimplemented from vsol_curve_2d.
Definition at line 110 of file bsol_intrinsic_curve_2d.cxx.
virtual vsol_point_2d_sptr bsol_intrinsic_curve_2d::p0 | ( | void | ) | const [inline, virtual] |
Return the first point of `this'; pure virtual of vsol_curve_2d.
Implements vsol_curve_2d.
Definition at line 100 of file bsol_intrinsic_curve_2d.h.
virtual vsol_point_2d_sptr bsol_intrinsic_curve_2d::p1 | ( | void | ) | const [inline, virtual] |
Return the last point of `this'; pure virtual of vsol_curve_2d.
Implements vsol_curve_2d.
Definition at line 102 of file bsol_intrinsic_curve_2d.h.
void bsol_intrinsic_curve_2d::readCONFromFile | ( | vcl_string | fileName | ) |
Definition at line 219 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::remove_vertex | ( | const int | i, |
bool | bRecomputeProterties = false |
||
) |
Remove one vertex from the intrinsic curve.
Definition at line 193 of file bsol_intrinsic_curve_2d.cxx.
double bsol_intrinsic_curve_2d::s | ( | const int | i | ) | const [inline] |
Return the total arclength of the current vertex `i-1' to vertex `i'.
Definition at line 128 of file bsol_intrinsic_curve_2d.h.
void bsol_intrinsic_curve_2d::set_p0 | ( | const vsol_point_2d_sptr & | new_p0 | ) | [virtual] |
Set the first point of the curve.
Require: in(new_p0)
Implements vsol_curve_2d.
Definition at line 168 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::set_p1 | ( | const vsol_point_2d_sptr & | new_p1 | ) | [virtual] |
Set the last point of the curve.
Require: in(new_p1)
Implements vsol_curve_2d.
Definition at line 177 of file bsol_intrinsic_curve_2d.cxx.
void bsol_intrinsic_curve_2d::setOpen | ( | bool | flag | ) | [inline] |
Definition at line 180 of file bsol_intrinsic_curve_2d.h.
int bsol_intrinsic_curve_2d::size | ( | void | ) | const [inline] |
Return the number of vertices.
Definition at line 121 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::totalAngleChange | ( | void | ) | const [inline] |
Return the total angle change of the intrinsic curve.
Definition at line 154 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::totalCurvature | ( | void | ) | const [inline] |
Return the total curvature of the intrinsic curve.
Definition at line 152 of file bsol_intrinsic_curve_2d.h.
bool bsol_intrinsic_curve_2d::upsample | ( | int | new_size | ) |
Added by Ozge Can Ozcanli to upsample the curve.
Public function to upsample the current curve, it uses vsol_digital_curve and its interpolator.
if curve is closed sample the portion between last point and first point.
start with actual curve point.
add first point with length T apart.
Definition at line 495 of file bsol_intrinsic_curve_2d.cxx.
bool bsol_intrinsic_curve_2d::valid_index | ( | unsigned int | i | ) | const [inline] |
Is `i' a valid index for the list of vertices ?.
Definition at line 104 of file bsol_intrinsic_curve_2d.h.
vsol_point_2d_sptr bsol_intrinsic_curve_2d::vertex | ( | const int | i | ) | const [inline] |
Return vertex `i'.
Definition at line 106 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::x | ( | const int | i | ) | const [inline] |
Return x coord of vertex `i'.
Definition at line 111 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::y | ( | const int | i | ) | const [inline] |
Return y coord of vertex `i'.
Definition at line 116 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::angle_ [protected] |
Bending angle of the intrinsic curve.
Definition at line 65 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::arcLength_ [protected] |
Arclength measured from the p0_.
Definition at line 50 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::curvature_ [protected] |
Curvature of the intrinsic curve.
Definition at line 63 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::dx_ [protected] |
dx of the intrinsic curve.
Definition at line 59 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::dy_ [protected] |
dy of the intrinsic curve.
Definition at line 61 of file bsol_intrinsic_curve_2d.h.
bool bsol_intrinsic_curve_2d::isOpen_ [protected] |
Definition at line 71 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::length_ [protected] |
Length of the intrinsic curve.
Definition at line 57 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::normArcLength_ [protected] |
Normalized arclength measured from the p0_.
Normalized arclength of the whole curve is 1.
Definition at line 55 of file bsol_intrinsic_curve_2d.h.
vsol_point_2d_sptr bsol_intrinsic_curve_2d::p0_ [protected] |
First point of the curve : just to conform to vsol_curve_2d standard.
Definition at line 46 of file bsol_intrinsic_curve_2d.h.
vsol_point_2d_sptr bsol_intrinsic_curve_2d::p1_ [protected] |
Last point of the curve.
Definition at line 48 of file bsol_intrinsic_curve_2d.h.
vcl_vector<double> bsol_intrinsic_curve_2d::s_ [protected] |
Arclength of the current segment i to i+1.
Definition at line 52 of file bsol_intrinsic_curve_2d.h.
vcl_vector<vsol_point_2d_sptr>* bsol_intrinsic_curve_2d::storage_ [protected] |
Pointer to list of vsol_point_2d smart pointers.
Definition at line 44 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::totalAngleChange_ [protected] |
Total angle change of the intrinsic curve.
Definition at line 69 of file bsol_intrinsic_curve_2d.h.
double bsol_intrinsic_curve_2d::totalCurvature_ [protected] |
Total curvature of the intrinsic curve.
Definition at line 67 of file bsol_intrinsic_curve_2d.h.