Region centred on a line between two points. More...
#include <mfpf_region_about_lineseg.h>
Public Member Functions | |
mfpf_region_about_lineseg () | |
Dflt ctor. | |
virtual | ~mfpf_region_about_lineseg () |
Destructor. | |
virtual bool | is_centred_on_pt () const |
Returns false as the region is not centred on an input point. | |
virtual unsigned | ref_point_index () const |
Returns zero. | |
virtual unsigned | orig_ref_point_index () const |
Returns zero also. | |
virtual bool | replace_index (const vcl_vector< unsigned > &new_index) |
Replace each point index i with new_index[i]. | |
unsigned | i0 () const |
Index of first point defining reference frame. | |
unsigned | i1 () const |
Index of second point defining reference frame. | |
double | rel_wi () const |
Width of ROI, relative to |p1-p0|. | |
double | rel_wj () const |
Height of ROI, relative to |p1-p0|. | |
double | wi () const |
Width of ROI in world coords. | |
double | wj () const |
Height of ROI in world coords. | |
vcl_string | form () const |
Name of form of shape ("box","ellipse"). | |
virtual vgl_point_2d< double > | get_ref_point (const vcl_vector< vgl_point_2d< double > > &pts) const |
Returns reference point for region, mid_point(pts[i0],pts[i1]). | |
virtual mfpf_region_form | set_up (const vcl_vector< vgl_point_2d< double > > &pts) |
Defines a region centred on the line between pts[i0] and pts[i1]. | |
virtual mfpf_region_form | get_region (const vcl_vector< vgl_point_2d< double > > &pts) const |
Defines a region centred on the line between pts[i0] and pts[i1]. | |
virtual bool | set_from_stream (vcl_istream &is) |
Initialise from a stream. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual mfpf_region_definer * | clone () const |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < mfpf_region_definer > | create_from_stream (vcl_istream &is) |
Create a concrete object, from a text specification. | |
Private Attributes | |
unsigned | i0_ |
Index of first point defining reference frame. | |
unsigned | i1_ |
Index of second point defining reference frame. | |
double | rel_wi_ |
Width of ROI, relative to |p1-p0|. | |
double | rel_wj_ |
Height of ROI, relative to |p1-p0|. | |
double | wi_ |
Width of ROI in world coords. | |
double | wj_ |
Height of ROI in world coords. | |
vcl_string | form_ |
Name of form of shape ("box","ellipse"). |
Region centred on a line between two points.
Region defined by two points, p0=pts[i0], p1=pts[i1] The region is centred on 0.5(p0+p1) Bounding box of region is aligned with the vector (p1-p0), and its width and height are defined relative to |p1-p0|
Parameters in text file:
{ i0: 5 i1: 31 rel_wi: 0.5 rel_wj: 0.2 form: box }
Definition at line 22 of file mfpf_region_about_lineseg.h.
mfpf_region_about_lineseg::mfpf_region_about_lineseg | ( | ) |
Dflt ctor.
Definition at line 20 of file mfpf_region_about_lineseg.cxx.
mfpf_region_about_lineseg::~mfpf_region_about_lineseg | ( | ) | [virtual] |
Destructor.
Definition at line 29 of file mfpf_region_about_lineseg.cxx.
void mfpf_region_about_lineseg::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements mfpf_region_definer.
Definition at line 193 of file mfpf_region_about_lineseg.cxx.
void mfpf_region_about_lineseg::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements mfpf_region_definer.
Definition at line 177 of file mfpf_region_about_lineseg.cxx.
mfpf_region_definer * mfpf_region_about_lineseg::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements mfpf_region_definer.
Definition at line 157 of file mfpf_region_about_lineseg.cxx.
vcl_auto_ptr< mfpf_region_definer > mfpf_region_definer::create_from_stream | ( | vcl_istream & | is | ) | [static, inherited] |
Create a concrete object, from a text specification.
Definition at line 50 of file mfpf_region_definer.cxx.
vcl_string mfpf_region_about_lineseg::form | ( | ) | const [inline] |
Name of form of shape ("box","ellipse").
Definition at line 86 of file mfpf_region_about_lineseg.h.
vgl_point_2d< double > mfpf_region_about_lineseg::get_ref_point | ( | const vcl_vector< vgl_point_2d< double > > & | pts | ) | const [virtual] |
Returns reference point for region, mid_point(pts[i0],pts[i1]).
Implements mfpf_region_definer.
Definition at line 67 of file mfpf_region_about_lineseg.cxx.
mfpf_region_form mfpf_region_about_lineseg::get_region | ( | const vcl_vector< vgl_point_2d< double > > & | pts | ) | const [virtual] |
Defines a region centred on the line between pts[i0] and pts[i1].
Defines a region centred on a point.
The aspect ratio of the region will be the same as that from the last call to set_up.
Implements mfpf_region_definer.
Definition at line 96 of file mfpf_region_about_lineseg.cxx.
unsigned mfpf_region_about_lineseg::i0 | ( | ) | const [inline] |
Index of first point defining reference frame.
Definition at line 68 of file mfpf_region_about_lineseg.h.
unsigned mfpf_region_about_lineseg::i1 | ( | ) | const [inline] |
Index of second point defining reference frame.
Definition at line 71 of file mfpf_region_about_lineseg.h.
vcl_string mfpf_region_about_lineseg::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from mfpf_region_definer.
Definition at line 151 of file mfpf_region_about_lineseg.cxx.
bool mfpf_region_about_lineseg::is_centred_on_pt | ( | ) | const [virtual] |
Returns false as the region is not centred on an input point.
Implements mfpf_region_definer.
Definition at line 34 of file mfpf_region_about_lineseg.cxx.
unsigned mfpf_region_about_lineseg::orig_ref_point_index | ( | ) | const [virtual] |
Returns zero also.
Implements mfpf_region_definer.
Definition at line 46 of file mfpf_region_about_lineseg.cxx.
void mfpf_region_about_lineseg::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements mfpf_region_definer.
Definition at line 166 of file mfpf_region_about_lineseg.cxx.
unsigned mfpf_region_about_lineseg::ref_point_index | ( | ) | const [virtual] |
Returns zero.
Implements mfpf_region_definer.
Definition at line 40 of file mfpf_region_about_lineseg.cxx.
double mfpf_region_about_lineseg::rel_wi | ( | ) | const [inline] |
Width of ROI, relative to |p1-p0|.
Definition at line 74 of file mfpf_region_about_lineseg.h.
double mfpf_region_about_lineseg::rel_wj | ( | ) | const [inline] |
Height of ROI, relative to |p1-p0|.
Definition at line 77 of file mfpf_region_about_lineseg.h.
bool mfpf_region_about_lineseg::replace_index | ( | const vcl_vector< unsigned > & | new_index | ) | [virtual] |
Replace each point index i with new_index[i].
Allows for re-numbering of the points used. Returns true if successful.
Implements mfpf_region_definer.
Definition at line 54 of file mfpf_region_about_lineseg.cxx.
bool mfpf_region_about_lineseg::set_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Initialise from a stream.
Initialise from a string stream.
Reimplemented from mfpf_region_definer.
Definition at line 118 of file mfpf_region_about_lineseg.cxx.
mfpf_region_form mfpf_region_about_lineseg::set_up | ( | const vcl_vector< vgl_point_2d< double > > & | pts | ) | [virtual] |
Defines a region centred on the line between pts[i0] and pts[i1].
Defines a region centred on a point.
Implements mfpf_region_definer.
Definition at line 76 of file mfpf_region_about_lineseg.cxx.
short mfpf_region_about_lineseg::version_no | ( | ) | const |
Version number for I/O.
Reimplemented from mfpf_region_definer.
Definition at line 142 of file mfpf_region_about_lineseg.cxx.
double mfpf_region_about_lineseg::wi | ( | ) | const [inline] |
Width of ROI in world coords.
Definition at line 80 of file mfpf_region_about_lineseg.h.
double mfpf_region_about_lineseg::wj | ( | ) | const [inline] |
Height of ROI in world coords.
Definition at line 83 of file mfpf_region_about_lineseg.h.
vcl_string mfpf_region_about_lineseg::form_ [private] |
Name of form of shape ("box","ellipse").
Definition at line 43 of file mfpf_region_about_lineseg.h.
unsigned mfpf_region_about_lineseg::i0_ [private] |
Index of first point defining reference frame.
Definition at line 26 of file mfpf_region_about_lineseg.h.
unsigned mfpf_region_about_lineseg::i1_ [private] |
Index of second point defining reference frame.
Definition at line 28 of file mfpf_region_about_lineseg.h.
double mfpf_region_about_lineseg::rel_wi_ [private] |
Width of ROI, relative to |p1-p0|.
Definition at line 31 of file mfpf_region_about_lineseg.h.
double mfpf_region_about_lineseg::rel_wj_ [private] |
Height of ROI, relative to |p1-p0|.
Definition at line 34 of file mfpf_region_about_lineseg.h.
double mfpf_region_about_lineseg::wi_ [private] |
Width of ROI in world coords.
Definition at line 37 of file mfpf_region_about_lineseg.h.
double mfpf_region_about_lineseg::wj_ [private] |
Height of ROI in world coords.
Definition at line 40 of file mfpf_region_about_lineseg.h.