STIRA
0.1
|
class that contains a curve. For us, a curve is a list of 8-neighborhood connected pixels in an stl vector More...
#include <Curve.h>
Public Member Functions | |
Curve () | |
empty constructor | |
Curve (std::vector< Point< int > > pointsOnCurve) | |
constructor with initial set of points More... | |
void | Clear () |
double | GetAverageX () const |
gets the average of all the x coordinates of the pixels on the curve | |
double | GetAverageY () const |
gets the average of all the y coordinates of the pixels on the curve | |
int | GetCorrespondingY (int x) const |
gets the y coordinate of point on the curve for a given x coordinate for now, we assume 1 point on the curve for a given x coordinate if no point with this x coordinate is found, -1 is returned | |
int | GetLength () const |
gets the number of the pixels on the curve | |
int | GetY (int x) const |
Gets y coordinate that corresponds to the given x coordinate along the curve If there are more points, the first that is encountered is returned; if no point was found, -1 is returned. More... | |
void | AddPoint (Point< int > point) |
adds a single point at the end of the curve More... | |
void | AddPoints (std::vector< Point< int > > points) |
adds a series of points at the end of the curve More... | |
std::vector< Point< int > > | GetPoints () |
gets the stl vector with the points on the curve | |
Point< int > | GetStartPoint () const |
gets first point in the stl vector with the points on the curve | |
Point< int > | GetEndPoint () const |
gets last point in the stl vector with the points on the curve | |
std::vector< Point< int > > | GetExtremePointsX (int &xMin, int &xMax, bool usePoints=false) |
Gets the points on the curve with minimum and maximum x coordinate. More... | |
std::vector< Point< int > > | GetPointsMinimumX (int &xMin, bool usePoints=false) |
Gets the points on the curve with minimum x coordinate. More... | |
std::vector< Point< int > > | GetPointsMaximumX (int &xMax, bool usePoints=false) |
Gets the points on the curve with maximum x coordinate. More... | |
Point< int > | GetPoint (int i) const |
gets point with index i in the stl vector with the points on the curve | |
bool | ChangeCoordinatesForPoint (int i, int x, int y) |
void | SortOnCoordinateX () |
sorts all points in the stl vector on their x coordinates | |
void | SortOnCoordinateY () |
sorts all points in the stl vector on their y coordinates | |
void | WritePointsToStdOut (int intervalSize=10) |
writes points of the curve to standard out More... | |
bool | GetIsUsed () |
Gets if the curve is already used. | |
void | SetIsUsed (bool isUsed) |
Sets if the curve is already used. More... | |
bool | GetHadBranches () |
void | SetHadBranches (bool hadBranches) |
bool | GetDoesCurveSpanFullImage () |
void | SetDoesCurveSpanFullImage (bool doesSpan) |
std::pair< Point< int >, Point< int > > | GetClosestEndPoints (Curve otherCurve) |
given two open curves, we find which of the end points of the two curves are closest This method is used to determine how to connect two curves by their closest end points More... | |
Curve | CreateMergedCurve (Curve otherCurve) |
creates a new curve that is build from the current curve connected with the curve passed in the argument More... | |
void | ConnectToCurve (Curve otherCurve) |
connects the curve passed in the argument to the current curve More... | |
std::pair< double, double > | ComputeVerticalDistanceToCurve (Curve otherCurve) |
computes point-to-point absolute distance between the y coordinates of the curve passed in the argument and this curve More... | |
bool | AreNeighbors (Point< int > inPoint1, Point< int > inPoint2) |
checks if two given points are neighbors More... | |
void | SmoothCurveY (int smoothHalfDistance) |
smooths a curve in the y direction by averaging y coordinates of points along the curve More... | |
bool | WritePointsToText (std::string fileName) |
writes points of current curve to a text file More... | |
class that contains a curve. For us, a curve is a list of 8-neighborhood connected pixels in an stl vector
stira::common::Curve::Curve | ( | std::vector< Point< int > > | pointsOnCurve | ) |
constructor with initial set of points
pointsOnCurve | stl vector containing all points on the curve |
void stira::common::Curve::AddPoint | ( | Point< int > | point | ) |
adds a single point at the end of the curve
point | point added at end of curve |
Referenced by AddPoints().
void stira::common::Curve::AddPoints | ( | std::vector< Point< int > > | points | ) |
adds a series of points at the end of the curve
References AddPoint().
Referenced by ConnectToCurve(), and CreateMergedCurve().
checks if two given points are neighbors
inPoint1 | first point to be checked |
inPoint2 | second point to be checked |
References stira::common::Point< T >::x, and stira::common::Point< T >::y.
std::pair< double, double > stira::common::Curve::ComputeVerticalDistanceToCurve | ( | Curve | otherCurve | ) |
computes point-to-point absolute distance between the y coordinates of the curve passed in the argument and this curve
otherCurve | the other curve to merge this curve with (adds it to this curve, so original curve doen not exist anymore ) |
References GetLength(), and GetPoints().
void stira::common::Curve::ConnectToCurve | ( | Curve | otherCurve | ) |
connects the curve passed in the argument to the current curve
otherCurve | the other curve to merge this curve with (adds it to this curve, so original curve doen not exist anymore ) |
References AddPoints(), stira::common::DrawFigures::BresenhamDrawLine(), stira::common::Point< T >::GetDistance(), GetEndPoint(), GetPoints(), GetStartPoint(), SortOnCoordinateX(), stira::common::Point< T >::x, and stira::common::Point< T >::y.
Referenced by CreateMergedCurve().
creates a new curve that is build from the current curve connected with the curve passed in the argument
otherCurve | the other curve to merge this curve with (returns new merged curve, leaving this curve unaltered) |
References AddPoints(), and ConnectToCurve().
std::pair< Point< int >, Point< int > > stira::common::Curve::GetClosestEndPoints | ( | Curve | otherCurve | ) |
given two open curves, we find which of the end points of the two curves are closest This method is used to determine how to connect two curves by their closest end points
otherCurve | the other curve to check the end points from |
References stira::common::Point< T >::GetDistance(), GetEndPoint(), GetStartPoint(), and stira::common::Point< T >::SetType().
std::vector< Point< int > > stira::common::Curve::GetExtremePointsX | ( | int & | xMin, |
int & | xMax, | ||
bool | usePoints = false |
||
) |
Gets the points on the curve with minimum and maximum x coordinate.
xMin | the minimum x coordinate; if usePoints is false, it will be computed in this method |
xMax | the maximum x coordinate; if usePoints is false, it will be computed in this method |
usePoints | if true, the xMin and xMax values will be used without checking; if false, the values are determined in this method |
References GetPointsMaximumX(), and GetPointsMinimumX().
std::vector< Point< int > > stira::common::Curve::GetPointsMaximumX | ( | int & | xMax, |
bool | usePoints = false |
||
) |
Gets the points on the curve with maximum x coordinate.
xMax | the maximum x coordinate; if usePoints is false, it will be computed in this method |
usePoints | if true, the xMax value the points will be used without checking; if false, the values are determined in this method |
Referenced by GetExtremePointsX().
std::vector< Point< int > > stira::common::Curve::GetPointsMinimumX | ( | int & | xMin, |
bool | usePoints = false |
||
) |
Gets the points on the curve with minimum x coordinate.
xMin | the minimum x coordinate; if usePoints is false, it will be computed in this method |
usePoints | if true, the xMin value will be used without checking; if false, the values are determined in this method |
Referenced by GetExtremePointsX().
int stira::common::Curve::GetY | ( | int | x | ) | const |
Gets y coordinate that corresponds to the given x coordinate along the curve If there are more points, the first that is encountered is returned; if no point was found, -1 is returned.
x | x coordinate |
void stira::common::Curve::SetIsUsed | ( | bool | isUsed | ) |
Sets if the curve is already used.
isUsed | flag if current curve is used |
void stira::common::Curve::SmoothCurveY | ( | int | smoothHalfDistance | ) |
smooths a curve in the y direction by averaging y coordinates of points along the curve
smoothHalfDistance | half of the smoothing window |
References GetLength(), and SortOnCoordinateX().
void stira::common::Curve::WritePointsToStdOut | ( | int | intervalSize = 10 | ) |
writes points of the curve to standard out
intervalSize | we write only every intervalSize'th point to standard out |
bool stira::common::Curve::WritePointsToText | ( | std::string | fileName | ) |
writes points of current curve to a text file
fileName | name of text file to write the points to |