KJB
kjb::Line Class Reference

Parametric representation of a 2D line in terms of three parameters (a,b,c) (as in ax+by+c = 0). More...

`#include <g_line.h>`

## Public Member Functions

Line ()
Constructor without initializations. More...

Line (const kjb::Vector &point_1, const kjb::Vector &point_2)
Constructor from two points on the line. More...

Line (double a, double b, double c)
Constructs a new Line_segment from line parameters a, b, c as in ax + by + c = 0. More...

Line (const kjb::Vector &iparams)
Constructs a new Line_segment from line parameters vector [a, b, c] as in ax + by + c = 0. More...

Line (const Line &l)
Copy constructor. More...

Lineoperator= (const Line &l)
Assignment operator. More...

double get_a () const
Returns the a parameter of the line as in ax + by + c = 0. More...

double get_b () const
Returns the b parameter of the line as in ax + by + c = 0. More...

double get_c () const
Returns the c parameter of the line as in ax + by + c = 0. More...

const kjb::Vectorget_params () const
Returns the line parameters. More...

double compute_y_coordinate (double ix)
computes the y coordinate for the input x coordinate More...

void set_a (double ia)
Sets the a parameter of the line as in ax + by + c = 0. More...

void set_b (double ib)
Sets the b parameter of the line as in ax + by + c = 0. More...

void set_c (double ic)
Sets the c parameter of the line as in ax + by + c = 0. More...

void set_line_params (const kjb::Vector &iparams)
Sets the line parameters [a,b,c] of the line as in ax + by + c = 0. More...

bool point_is_on_line (const Vector &point) const

double find_distance_to_point (const kjb::Vector &point) const
Finds the perpendicular distance between a line and a point. More...

Vector project_point_onto_line (const Vector &point) const
Project a point onto a line. More...

## Static Public Member Functions

static bool find_line_intersection (const Line &l1, const Line &l2, kjb::Vector &ints)
Find the intersection between two lines, Returns false if the lines are parallel. More...

## Detailed Description

Parametric representation of a 2D line in terms of three parameters (a,b,c) (as in ax+by+c = 0).

## Constructor & Destructor Documentation

 kjb::Line::Line ( )
inline

Constructor without initializations.

 Line::Line ( const kjb::Vector & point_1, const kjb::Vector & point_2 )

Constructor from two points on the line.

Constructor from two points on the line

Parameters
 point_1 The first point point_2 The second point
 kjb::Line::Line ( double a, double b, double c )
inline

Constructs a new Line_segment from line parameters a, b, c as in ax + by + c = 0.

 kjb::Line::Line ( const kjb::Vector & iparams )
inline

Constructs a new Line_segment from line parameters vector [a, b, c] as in ax + by + c = 0.

 kjb::Line::Line ( const Line & l )
inline

Copy constructor.

## Member Function Documentation

 double kjb::Line::compute_y_coordinate ( double ix )
inline

computes the y coordinate for the input x coordinate

 double Line::find_distance_to_point ( const kjb::Vector & point ) const

Finds the perpendicular distance between a line and a point.

Finds the perpendicular distance between a line and a point

Parameters
 point the point to compute the distance for
Returns
the distance between the line and the point
 bool Line::find_line_intersection ( const Line & l1, const Line & l2, kjb::Vector & ints )
static

Find the intersection between two lines, Returns false if the lines are parallel.

Finds the intersection between two lines.

Parameters
 l1 the first line l2 the second line ints will store the intersection point
Returns
true if the lines intercept, false if thet are parallel
 double kjb::Line::get_a ( ) const
inline

Returns the a parameter of the line as in ax + by + c = 0.

 double kjb::Line::get_b ( ) const
inline

Returns the b parameter of the line as in ax + by + c = 0.

 double kjb::Line::get_c ( ) const
inline

Returns the c parameter of the line as in ax + by + c = 0.

 const kjb::Vector& kjb::Line::get_params ( ) const
inline

Returns the line parameters.

 Line& kjb::Line::operator= ( const Line & l )
inline

Assignment operator.

 bool kjb::Line::point_is_on_line ( const Vector & point ) const
inline
 Vector Line::project_point_onto_line ( const Vector & point ) const

Project a point onto a line.

Returns
The projected point on the line
 void kjb::Line::set_a ( double ia )
inline

Sets the a parameter of the line as in ax + by + c = 0.

 void kjb::Line::set_b ( double ib )
inline

Sets the b parameter of the line as in ax + by + c = 0.

 void kjb::Line::set_c ( double ic )
inline

Sets the c parameter of the line as in ax + by + c = 0.

 void kjb::Line::set_line_params ( const kjb::Vector & iparams )
inline

Sets the line parameters [a,b,c] of the line as in ax + by + c = 0.

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