mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-08 02:12:40 +08:00
partial doxygen ccstruct/coutln.cpp
This commit is contained in:
parent
0b8de99f14
commit
0b5b35cb34
@ -38,11 +38,11 @@ ICOORD C_OUTLINE::step_coords[4] = {
|
|||||||
ICOORD (-1, 0), ICOORD (0, -1), ICOORD (1, 0), ICOORD (0, 1)
|
ICOORD (-1, 0), ICOORD (0, -1), ICOORD (1, 0), ICOORD (0, 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::C_OUTLINE
|
* @name C_OUTLINE::C_OUTLINE
|
||||||
*
|
*
|
||||||
* Constructor to build a C_OUTLINE from a CRACKEDGE LOOP.
|
* Constructor to build a C_OUTLINE from a CRACKEDGE LOOP.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
C_OUTLINE::C_OUTLINE (
|
C_OUTLINE::C_OUTLINE (
|
||||||
//constructor
|
//constructor
|
||||||
@ -71,11 +71,11 @@ ICOORD top_right, inT16 length //length of loop
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::C_OUTLINE
|
* @name C_OUTLINE::C_OUTLINE
|
||||||
*
|
*
|
||||||
* Constructor to build a C_OUTLINE from a C_OUTLINE_FRAG.
|
* Constructor to build a C_OUTLINE from a C_OUTLINE_FRAG.
|
||||||
**********************************************************************/
|
*/
|
||||||
C_OUTLINE::C_OUTLINE (
|
C_OUTLINE::C_OUTLINE (
|
||||||
//constructor
|
//constructor
|
||||||
//steps to copy
|
//steps to copy
|
||||||
@ -130,11 +130,11 @@ inT16 length //length of loop
|
|||||||
ASSERT_HOST (stepcount >= 4);
|
ASSERT_HOST (stepcount >= 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::C_OUTLINE
|
* @name C_OUTLINE::C_OUTLINE
|
||||||
*
|
*
|
||||||
* Constructor to build a C_OUTLINE from a rotation of a C_OUTLINE.
|
* Constructor to build a C_OUTLINE from a rotation of a C_OUTLINE.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
C_OUTLINE::C_OUTLINE( //constructor
|
C_OUTLINE::C_OUTLINE( //constructor
|
||||||
C_OUTLINE *srcline, //outline to
|
C_OUTLINE *srcline, //outline to
|
||||||
@ -247,11 +247,11 @@ void C_OUTLINE::FakeOutline(const TBOX& box, C_OUTLINE_LIST* outlines) {
|
|||||||
ol_it.add_to_end(outline);
|
ol_it.add_to_end(outline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::area
|
* @name C_OUTLINE::area
|
||||||
*
|
*
|
||||||
* Compute the area of the outline.
|
* Compute the area of the outline.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
inT32 C_OUTLINE::area() const {
|
inT32 C_OUTLINE::area() const {
|
||||||
int stepindex; //current step
|
int stepindex; //current step
|
||||||
@ -281,11 +281,11 @@ inT32 C_OUTLINE::area() const {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::perimeter
|
* @name C_OUTLINE::perimeter
|
||||||
*
|
*
|
||||||
* Compute the perimeter of the outline and its first level children.
|
* Compute the perimeter of the outline and its first level children.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
inT32 C_OUTLINE::perimeter() const {
|
inT32 C_OUTLINE::perimeter() const {
|
||||||
inT32 total_steps; // Return value.
|
inT32 total_steps; // Return value.
|
||||||
@ -301,11 +301,11 @@ inT32 C_OUTLINE::perimeter() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::outer_area
|
* @name C_OUTLINE::outer_area
|
||||||
*
|
*
|
||||||
* Compute the area of the outline.
|
* Compute the area of the outline.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
inT32 C_OUTLINE::outer_area() const {
|
inT32 C_OUTLINE::outer_area() const {
|
||||||
int stepindex; //current step
|
int stepindex; //current step
|
||||||
@ -333,11 +333,11 @@ inT32 C_OUTLINE::outer_area() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::count_transitions
|
* @name C_OUTLINE::count_transitions
|
||||||
*
|
*
|
||||||
* Compute the number of x and y maxes and mins in the outline.
|
* Compute the number of x and y maxes and mins in the outline.
|
||||||
**********************************************************************/
|
*/
|
||||||
|
|
||||||
inT32 C_OUTLINE::count_transitions( //winding number
|
inT32 C_OUTLINE::count_transitions( //winding number
|
||||||
inT32 threshold //on size
|
inT32 threshold //on size
|
||||||
@ -461,16 +461,15 @@ inT32 C_OUTLINE::count_transitions( //winding number
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::operator<
|
* @name C_OUTLINE::operator<
|
||||||
*
|
*
|
||||||
* Return TRUE if the left operand is inside the right one.
|
* @return TRUE if the left operand is inside the right one.
|
||||||
**********************************************************************/
|
* @param other other outline
|
||||||
|
*/
|
||||||
|
|
||||||
BOOL8
|
BOOL8
|
||||||
C_OUTLINE::operator< ( //winding number
|
C_OUTLINE::operator< (const C_OUTLINE & other) const
|
||||||
const C_OUTLINE & other //other outline
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
inT16 count = 0; //winding count
|
inT16 count = 0; //winding count
|
||||||
ICOORD pos; //position of point
|
ICOORD pos; //position of point
|
||||||
@ -498,15 +497,14 @@ const C_OUTLINE & other //other outline
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::winding_number
|
* @name C_OUTLINE::winding_number
|
||||||
*
|
*
|
||||||
* Return the winding number of the outline around the given point.
|
* @return the winding number of the outline around the given point.
|
||||||
**********************************************************************/
|
* @param point point to wind around
|
||||||
|
*/
|
||||||
|
|
||||||
inT16 C_OUTLINE::winding_number( //winding number
|
inT16 C_OUTLINE::winding_number(ICOORD point) const {
|
||||||
ICOORD point //point to wind around
|
|
||||||
) const {
|
|
||||||
inT16 stepindex; //index to cstep
|
inT16 stepindex; //index to cstep
|
||||||
inT16 count; //winding count
|
inT16 count; //winding count
|
||||||
ICOORD vec; //to current point
|
ICOORD vec; //to current point
|
||||||
@ -590,15 +588,14 @@ void C_OUTLINE::reverse() { //reverse drection
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**
|
||||||
* C_OUTLINE::move
|
* @name C_OUTLINE::move
|
||||||
*
|
*
|
||||||
* Move C_OUTLINE by vector
|
* Move C_OUTLINE by vector
|
||||||
**********************************************************************/
|
* @param vec vector to reposition OUTLINE by
|
||||||
|
*/
|
||||||
|
|
||||||
void C_OUTLINE::move( // reposition OUTLINE
|
void C_OUTLINE::move(const ICOORD vec) {
|
||||||
const ICOORD vec // by vector
|
|
||||||
) {
|
|
||||||
C_OUTLINE_IT it(&children); // iterator
|
C_OUTLINE_IT it(&children); // iterator
|
||||||
|
|
||||||
box.move (vec);
|
box.move (vec);
|
||||||
@ -608,10 +605,12 @@ void C_OUTLINE::move( // reposition OUTLINE
|
|||||||
it.data ()->move (vec); // move child outlines
|
it.data ()->move (vec); // move child outlines
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if *this and its children are legally nested.
|
/**
|
||||||
// The outer area of a child should have the opposite sign to the
|
* Returns true if *this and its children are legally nested.
|
||||||
// parent. If not, it means we have discarded an outline in between
|
* The outer area of a child should have the opposite sign to the
|
||||||
// (probably due to excessive length).
|
* parent. If not, it means we have discarded an outline in between
|
||||||
|
* (probably due to excessive length).
|
||||||
|
*/
|
||||||
bool C_OUTLINE::IsLegallyNested() const {
|
bool C_OUTLINE::IsLegallyNested() const {
|
||||||
if (stepcount == 0) return true;
|
if (stepcount == 0) return true;
|
||||||
int parent_area = outer_area();
|
int parent_area = outer_area();
|
||||||
|
Loading…
Reference in New Issue
Block a user