Revision: 16616
http://sourceforge.net/p/skim-app/code/16616
Author: hofman
Date: 2026-10-05 17:26:17 +0000 (Mon, 05 Oct 2026)
Log Message:
-----------
avoid some calculations when path points coincide
Modified Paths:
--------------
trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
Modified: trunk/SkimNotes/PDFAnnotation_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/PDFAnnotation_SKNExtensions.m 2026-10-05 17:10:44 UTC
(rev 16615)
+++ trunk/SkimNotes/PDFAnnotation_SKNExtensions.m 2026-10-05 17:26:17 UTC
(rev 16616)
@@ -1125,18 +1125,18 @@
diff1.x = point1.x - point0.x;
diff1.y = point1.y - point0.y;
+ d1 = sqrt(diff1.x * diff1.x + diff1.y * diff1.y);
+
diff2.x = point.x - point1.x;
diff2.y = point.y - point1.y;
-
- d1 = sqrt(diff1.x * diff1.x + diff1.y * diff1.y);
d2 = sqrt(diff2.x * diff2.x + diff2.y * diff2.y);
- d0 = sqrt(d1 * d2);
- diff1.x = d2 * diff1.x + d1 * diff2.x;
- diff1.y = d2 * diff1.y + d1 * diff2.y;
-
controlPoint = point1;
- if (d2 > 0.0) {
+ if (d1 > 0.0 && d2 > 0.0) {
+ diff1.x = d2 * diff1.x + d1 * diff2.x;
+ diff1.y = d2 * diff1.y + d1 * diff2.y;
+ d0 = sqrt(d1 * d2);
+
controlPoint.x -= diff1.x / (3.0 * (d0 + d2));
controlPoint.y -= diff1.y / (3.0 * (d0 + d2));
}
@@ -1151,7 +1151,7 @@
}
controlPoint = point1;
- if (d1 > 0.0) {
+ if (d1 > 0.0 && d2 > 0.0) {
controlPoint.x += diff1.x / (3.0 * (d0 + d1));
controlPoint.y += diff1.y / (3.0 * (d0 + d1));
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit