1 # include <stdio.h> 2 3 # include <geoQuadTree.h> 4 # include <geoAffineTransform.h> 5 # include <geoLineFitter.h> 6 7 /************************************************************************/ 8 /* */ 9 /* Find line segments and dump them. */ 10 /* */ 11 /************************************************************************/ 12 13 typedef struct SegmentCluster 14 { 15 LineSegment2DI * scSegments; 16 int scSegmentCount; 17 DocumentRectangle scRectangle; 18 int scX0; 19 int scY0; 20 int scX1; 21 int scY1; 22 double scLength; 23 LineFitter scLineFitter; 24 double scA; 25 double scB; 26 double scC; 27 AffineTransform2D scTransform; 28 } SegmentCluster; 29 30 typedef struct ClusterSegments 31 { 32 FILE * csFile; 33 QuadTree * csClusterTree; 34 SegmentCluster * csCurrentCluster; 35 DocumentRectangle csCurrentRectangle; 36 int csMerged; 37 double csDiagonal; 38 int csSegmentCount; 39 int csClusterCount; 40 41 QuadTree * csLongClusterTree; 42 SegmentCluster ** csLongClusters; 43 int csLongClusterCount; 44 45 int csRectPaddingPercent; 46 int csDistance; 47 } ClusterSegments; 48 49 /************************************************************************/ 50 /* */ 51 /* Routine declarations. */ 52 /* */ 53 /************************************************************************/ 54 55 56 extern void geoInitClusterSegments( ClusterSegments * cs ); 57 extern void geoCleanClusterSegments( ClusterSegments * cs ); 58 59 extern int geoClusterSegmentsAddSegment(ClusterSegments * cs, 60 int x0, 61 int y0, 62 int x1, 63 int y1 ); 64 65 extern int geoClusterSegmentsAllocateTree( 66 ClusterSegments * cs, 67 const DocumentRectangle * dr ); 68 69 extern int geoClusterSegmentsSetFile( 70 ClusterSegments * cs, 71 const char * fileName ); 72 73 extern int geoRunClusterSegments( ClusterSegments * cs ); 74