Public Member Functions | Private Attributes
msm_points Class Reference

Set of 2D points, stored in a vnl_vector (x0,y0,x1,y1...). More...

#include <msm_points.h>

List of all members.

Public Member Functions

 msm_points ()
 msm_points (unsigned n)
 ~msm_points ()
const vnl_vector< double > & vector () const
 Vector storing point ordinates as (x0,y0,x1,y1...).
vnl_vector< double > & vector ()
 Vector storing point ordinates as (x0,y0,x1,y1...).
unsigned size () const
 Number of points.
void set_size (unsigned n, double x=0, double y=0)
 Set to hold n points (initially all (x,y)).
void set_point (unsigned i, double x, double y)
 Set point i.
vgl_point_2d< double > operator[] (unsigned i) const
 Return i-th point.
void set_points (const vcl_vector< vgl_point_2d< double > > &pts)
 Set this to be equal to supplied points.
void get_points (vcl_vector< vgl_point_2d< double > > &pts) const
 Copy points into pts.
vgl_point_2d< double > cog () const
 Return centre of gravity of points.
double scale () const
 Return RMS of distance of points to CoG.
void get_cog_and_scale (vgl_point_2d< double > &cog, double &scale) const
 Compute centre of gravity and RMS distance to CoG.
void scale_by (double s)
 Scale current points by s about the origin.
void translate_by (double tx, double ty)
 Translate current points by (tx,ty).
void transform_by (double a, double b, double tx, double ty)
 Transform current points with similarity transform.
void transform_by (const vimt_transform_2d &t)
 Transform current points with t.
void get_bounds (vgl_point_2d< double > &b_lo, vgl_point_2d< double > &b_hi) const
 Bounding box of points.
vgl_box_2d< double > bounds () const
 Return bounding box of points.
bool write_text_file (const vcl_string &path) const
 Write out points to named text file.
bool read_text_file (const vcl_string &path)
 Read in points from named text file.
short version_no () const
 Version number for I/O.
vcl_string is_a () const
 Name of the class.
void print_summary (vcl_ostream &os) const
 Print class to os.
void b_write (vsl_b_ostream &bfs) const
 Save class to binary file stream.
void b_read (vsl_b_istream &bfs)
 Load class from binary file stream.
bool operator== (const msm_points &points) const
 Equality test.

Private Attributes

vnl_vector< double > v_

Detailed Description

Set of 2D points, stored in a vnl_vector (x0,y0,x1,y1...).

Get at raw vector with vector()

Definition at line 19 of file msm_points.h.


Constructor & Destructor Documentation

msm_points::msm_points ( )

Definition at line 19 of file msm_points.cxx.

msm_points::msm_points ( unsigned  n)

Definition at line 23 of file msm_points.cxx.

msm_points::~msm_points ( )

Definition at line 32 of file msm_points.cxx.


Member Function Documentation

void msm_points::b_read ( vsl_b_istream bfs)

Load class from binary file stream.

Definition at line 377 of file msm_points.cxx.

void msm_points::b_write ( vsl_b_ostream bfs) const

Save class to binary file stream.

Definition at line 366 of file msm_points.cxx.

vgl_box_2d< double > msm_points::bounds ( ) const

Return bounding box of points.

Definition at line 191 of file msm_points.cxx.

vgl_point_2d< double > msm_points::cog ( ) const

Return centre of gravity of points.

Definition at line 77 of file msm_points.cxx.

void msm_points::get_bounds ( vgl_point_2d< double > &  b_lo,
vgl_point_2d< double > &  b_hi 
) const

Bounding box of points.

Definition at line 167 of file msm_points.cxx.

void msm_points::get_cog_and_scale ( vgl_point_2d< double > &  cog,
double &  scale 
) const

Compute centre of gravity and RMS distance to CoG.

Definition at line 98 of file msm_points.cxx.

void msm_points::get_points ( vcl_vector< vgl_point_2d< double > > &  pts) const

Copy points into pts.

Definition at line 64 of file msm_points.cxx.

vcl_string msm_points::is_a ( ) const

Name of the class.

Definition at line 344 of file msm_points.cxx.

bool msm_points::operator== ( const msm_points points) const

Equality test.

Definition at line 199 of file msm_points.cxx.

vgl_point_2d<double> msm_points::operator[] ( unsigned  i) const [inline]

Return i-th point.

Definition at line 55 of file msm_points.h.

void msm_points::print_summary ( vcl_ostream &  os) const

Print class to os.

Definition at line 354 of file msm_points.cxx.

bool msm_points::read_text_file ( const vcl_string &  path)

Read in points from named text file.

Returns true if successful.

Definition at line 261 of file msm_points.cxx.

double msm_points::scale ( ) const

Return RMS of distance of points to CoG.

Definition at line 89 of file msm_points.cxx.

void msm_points::scale_by ( double  s)

Scale current points by s about the origin.

Definition at line 122 of file msm_points.cxx.

void msm_points::set_point ( unsigned  i,
double  x,
double  y 
) [inline]

Set point i.

Definition at line 49 of file msm_points.h.

void msm_points::set_points ( const vcl_vector< vgl_point_2d< double > > &  pts)

Set this to be equal to supplied points.

Definition at line 50 of file msm_points.cxx.

void msm_points::set_size ( unsigned  n,
double  x = 0,
double  y = 0 
)

Set to hold n points (initially all (x,y)).

If n==size() then does not change anything.

Definition at line 37 of file msm_points.cxx.

unsigned msm_points::size ( ) const [inline]

Number of points.

Definition at line 42 of file msm_points.h.

void msm_points::transform_by ( double  a,
double  b,
double  tx,
double  ty 
)

Transform current points with similarity transform.

(x,y) -> (ax-by+tx, bx+ay+ty);

Definition at line 142 of file msm_points.cxx.

void msm_points::transform_by ( const vimt_transform_2d t)

Transform current points with t.

Definition at line 155 of file msm_points.cxx.

void msm_points::translate_by ( double  tx,
double  ty 
)

Translate current points by (tx,ty).

Definition at line 129 of file msm_points.cxx.

const vnl_vector<double>& msm_points::vector ( ) const [inline]

Vector storing point ordinates as (x0,y0,x1,y1...).

Definition at line 35 of file msm_points.h.

vnl_vector<double>& msm_points::vector ( ) [inline]

Vector storing point ordinates as (x0,y0,x1,y1...).

Non-const access - use with care

Definition at line 39 of file msm_points.h.

short msm_points::version_no ( ) const

Version number for I/O.

Definition at line 335 of file msm_points.cxx.

bool msm_points::write_text_file ( const vcl_string &  path) const

Write out points to named text file.

Returns true if successful.

Definition at line 212 of file msm_points.cxx.


Member Data Documentation

vnl_vector<double> msm_points::v_ [private]

Definition at line 22 of file msm_points.h.


The documentation for this class was generated from the following files: