Isis 3 Programmer Reference
LineEquation.h
1 #ifndef LineEquation_h
2 #define LineEquation_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <vector>
11 
12 namespace Isis {
29  class LineEquation {
30  public:
32  LineEquation();
33  LineEquation(double x1, double y1, double x2, double y2);
34 
37  void AddPoint(double x, double y);
38  double Slope();
39  double Intercept();
40  int Points() {
41  return p_x.size();
42  };
43  bool HaveSlope() {
44  return p_slopeDefined;
45  };
46  bool HaveIntercept() {
47  return p_interceptDefined;
48  };
49  bool Defined() {
50  return p_defined;
51  };
52 
53  private:
54  std::vector<double> p_x;
55  std::vector<double> p_y;
56  bool p_defined;
59  double p_slope;
60  double p_intercept;
61 
62  }; // end of LineEquation class
63 }
64 #endif
Isis::LineEquation::LineEquation
LineEquation()
Constructors.
Definition: LineEquation.cpp:19
Isis::LineEquation::Intercept
double Intercept()
Compute the intercept of the line.
Definition: LineEquation.cpp:87
Isis::LineEquation::p_y
std::vector< double > p_y
Dependent variables.
Definition: LineEquation.h:55
Isis::LineEquation::p_defined
bool p_defined
Variable indicating if line is defined yet.
Definition: LineEquation.h:56
Isis::LineEquation
Utility class for creating and using cartesean line equations.
Definition: LineEquation.h:29
Isis::LineEquation::AddPoint
void AddPoint(double x, double y)
Add a point to the object.
Definition: LineEquation.cpp:51
Isis::LineEquation::p_x
std::vector< double > p_x
Independent variables.
Definition: LineEquation.h:51
Isis::LineEquation::~LineEquation
~LineEquation()
Destroys the LineEquation object.
Definition: LineEquation.h:36
Isis::LineEquation::p_interceptDefined
bool p_interceptDefined
Variable indicating if intercept is defined yet.
Definition: LineEquation.h:58
Isis::LineEquation::p_slopeDefined
bool p_slopeDefined
Variable indicating if slope is defined yet.
Definition: LineEquation.h:57
Isis::LineEquation::Slope
double Slope()
Compute the slope of the line.
Definition: LineEquation.cpp:66
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16