Isis 3 Programmer Reference
Isis::LineEquation Class Reference

Utility class for creating and using cartesean line equations. More...

#include <LineEquation.h>

Collaboration diagram for Isis::LineEquation:
Collaboration graph

Public Member Functions

 LineEquation ()
 Constructors.
 
 LineEquation (double x1, double y1, double x2, double y2)
 Construct and fill LineEquation object.
 
 ~LineEquation ()
 Destroys the LineEquation object.
 
void AddPoint (double x, double y)
 Add a point to the object.
 
double Slope ()
 Compute the slope of the line.
 
double Intercept ()
 Compute the intercept of the line.
 
int Points ()
 
bool HaveSlope ()
 
bool HaveIntercept ()
 
bool Defined ()
 

Private Attributes

std::vector< double > p_x
 Independent variables.
 
std::vector< double > p_y
 Dependent variables.
 
bool p_defined
 Variable indicating if line is defined yet.
 
bool p_slopeDefined
 Variable indicating if slope is defined yet.
 
bool p_interceptDefined
 Variable indicating if intercept is defined yet.
 
double p_slope
 
double p_intercept
 

Detailed Description

Utility class for creating and using cartesean line equations.

This class contains utility methods for creating and using cartesean line equations. If both points have the same value for the independent variable (vertical line) an error is thrown.

Author
2006-10-19 Debbie A. Cook
Todo
Add constructor with arguments (double slope, double intercept) Add method to double y = EvaluateLine( double x )

Definition at line 29 of file LineEquation.h.

Constructor & Destructor Documentation

◆ LineEquation() [1/2]

Isis::LineEquation::LineEquation ( )

Constructors.

Construct an empty LineEquation object.

Definition at line 19 of file LineEquation.cpp.

References p_defined, p_interceptDefined, and p_slopeDefined.

◆ LineEquation() [2/2]

Isis::LineEquation::LineEquation ( double x1,
double y1,
double x2,
double y2 )

Construct and fill LineEquation object.

Parameters
x1Double First independent variable
y1Double First dependent variable
x2Double Second independent variable
y2Double Second dependent variable

Definition at line 32 of file LineEquation.cpp.

References AddPoint(), Intercept(), p_defined, p_interceptDefined, p_slopeDefined, and Slope().

◆ ~LineEquation()

Isis::LineEquation::~LineEquation ( )
inline

Destroys the LineEquation object.

Definition at line 36 of file LineEquation.h.

Member Function Documentation

◆ AddPoint()

void Isis::LineEquation::AddPoint ( double x,
double y )

Add a point to the object.

The object is considered filled once 2 points have been added (the line is defined).

Parameters
xDouble Independent variable
yDouble Dependent variable

Definition at line 51 of file LineEquation.cpp.

References Isis::IException::Io, p_defined, p_x, and p_y.

Referenced by LineEquation().

◆ Defined()

bool Isis::LineEquation::Defined ( )
inline

Definition at line 49 of file LineEquation.h.

◆ HaveIntercept()

bool Isis::LineEquation::HaveIntercept ( )
inline

Definition at line 46 of file LineEquation.h.

◆ HaveSlope()

bool Isis::LineEquation::HaveSlope ( )
inline

Definition at line 43 of file LineEquation.h.

◆ Intercept()

double Isis::LineEquation::Intercept ( )

Compute the intercept of the line.

Returns
double The y-intercept of the line if it exists

Definition at line 87 of file LineEquation.cpp.

References Isis::IException::Io, p_defined, p_interceptDefined, p_x, p_y, and Slope().

Referenced by LineEquation().

◆ Points()

int Isis::LineEquation::Points ( )
inline

Definition at line 40 of file LineEquation.h.

◆ Slope()

double Isis::LineEquation::Slope ( )

Compute the slope of the line.

Returns
double The slope of the line if it exists

Definition at line 66 of file LineEquation.cpp.

References Isis::IException::Io, p_defined, p_slopeDefined, p_x, and p_y.

Referenced by Intercept(), and LineEquation().

Member Data Documentation

◆ p_defined

bool Isis::LineEquation::p_defined
private

Variable indicating if line is defined yet.

Definition at line 56 of file LineEquation.h.

Referenced by AddPoint(), Intercept(), LineEquation(), LineEquation(), and Slope().

◆ p_intercept

double Isis::LineEquation::p_intercept
private

Definition at line 60 of file LineEquation.h.

◆ p_interceptDefined

bool Isis::LineEquation::p_interceptDefined
private

Variable indicating if intercept is defined yet.

Definition at line 58 of file LineEquation.h.

Referenced by Intercept(), LineEquation(), and LineEquation().

◆ p_slope

double Isis::LineEquation::p_slope
private

Definition at line 59 of file LineEquation.h.

◆ p_slopeDefined

bool Isis::LineEquation::p_slopeDefined
private

Variable indicating if slope is defined yet.

Definition at line 57 of file LineEquation.h.

Referenced by LineEquation(), LineEquation(), and Slope().

◆ p_x

std::vector<double> Isis::LineEquation::p_x
private

Independent variables.

Definition at line 54 of file LineEquation.h.

Referenced by AddPoint(), Intercept(), and Slope().

◆ p_y

std::vector<double> Isis::LineEquation::p_y
private

Dependent variables.

Definition at line 55 of file LineEquation.h.

Referenced by AddPoint(), Intercept(), and Slope().


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