Commit Graph

21 Commits

Author SHA1 Message Date
BobLd
c6e2de1b0c
Make all structs readonly when possible 2023-10-18 23:44:11 +01:00
BobLd
980c6e2316 Use Euclidean distance in PdfRectangle's width and height 2021-01-15 11:20:45 +00:00
Eliot Jones
f3f7533507 add string culture in core code #190 2020-07-26 13:53:34 +01:00
BobLd
bb33741552 Fix KdTree.FindNearestNeighbours(k) returning the pivot itself 2020-05-10 15:49:00 +01:00
BobLd
42245d70ca Improve PdfRectangle.GetWidthHeight();
Improve and simplify Word's oriented bounding box
2020-02-23 11:23:27 +00:00
BobLd
36566f42e6 Create generic methods for lines in GeometryExtensions 2020-02-23 11:23:27 +00:00
BobLd
b8d1eba8ee PdfLine.Insersect() 2020-02-23 11:23:27 +00:00
BobLd
d2ac2f598a update Centroid, GetWidthHeight and tests 2020-02-23 11:23:27 +00:00
Eliot Jones
10ca77a034 move values back to computed properties
the additional stored fields made the struct slower to copy and had an impact on the performance. this moves non-essential fields back to computed properties.
2020-01-31 16:24:59 +00:00
BobLd
6dce4b1f8d Use double.NaN instead of double.MinValue
Only compute t, cos and sin once
2020-01-31 16:24:59 +00:00
Eliot Jones
b585fe9581 make width, height, area, rotation and centroid lazy
since the rectangle constructor is a hot path any calculations slow the library down considerably. for this reason we move calculations for the following properties into the property getter:
* width (cached)
* height (cached)
* rotation
* area
* centroid

where values are cached they set their backing field once calculated. this won't be thread safe if the same rectangle is accessed on multiple threads.
2020-01-31 16:24:59 +00:00
Eliot Jones
0e84fa34a8 fix usages of rectangle constructor.
now that rectangle constructor uses the order [ llx, lly, urx, ury ] and does not apply correction for points constructor parameters must be passed in the correct order. this change fixes the hyperlink factory which was passing them in the wrong order.

in addition the pdfpath bounding box was using left, right, top and bottom to calculate the minimum bounding box. this produced incorrect values now individual path operator bounding boxes are rotated, since for a rotated rectangle top may be less than bottom.

the performance seems to have taken a hit due to these changes however.
2020-01-31 16:24:59 +00:00
BobLd
483b30f44d Remove rounding 2020-01-31 16:24:59 +00:00
BobLd
0dad611cb1 Implement minimum bounding box algorithm 2020-01-31 16:24:59 +00:00
BobLd
ea27820ca4 Improve Word bounding box TextDirection.Other case 2020-01-31 16:24:59 +00:00
BobLd
2e5fdb5867 Fix PdfRectangle's Centroid and Translate() 2020-01-31 16:24:59 +00:00
BobLd
6d8744e722 More decimals to Width and Height
+ handle the case where both bottom points are identical
2020-01-31 16:24:59 +00:00
BobLd
9bcafdaa98 Update word bounding box computation 2020-01-31 16:24:59 +00:00
BobLd
27edf6cf77 Handle Width and Height for rotated rectangles 2020-01-31 16:24:59 +00:00
BobLd
75821919a7 Fix NearestNeighbourWordExtractor for rotated text 2020-01-31 16:24:59 +00:00
Eliot Jones
7c0ef111ea move classes to new projects
to make the project more useful and expose more usable classes we're rearchitecting in the following way. code used to read fonts from external file formats like truetype, adobe font metrics (afm) and adobe type 1 fonts are moving to a new project which doesn't reference most of the pdf logic. the shared logic is moving to a new flat-structured project called core. this is a sort-of onion type architecture, with core being the... core, fonts being the next layer of the onion, pdfpig itself the next. this will then support additional libraries/projects as outer layers of the onion as well as releasing standalone version of the font library as pdfbox does with fontbox.
2020-01-04 16:38:18 +00:00