Fossil SCM

Yet another update to Pikchr to fix the arc bounding box problem.

drh 2025-03-19 16:27 trunk
Commit f78e48fe174dd31d60888a79f35311dd1c13829e04d9b184c8aaba388c992a0a
--- extsrc/pikchr-worker.js
+++ extsrc/pikchr-worker.js
@@ -206,11 +206,11 @@
206206
data:{step: ++f.last.step, text: text||null}
207207
});
208208
}
209209
};
210210
211
- importScripts('pikchr-v7583078860.js');
211
+ importScripts('pikchr-v2813665466.js');
212212
/**
213213
initPikchrModule() is installed via pikchr.js due to
214214
building with:
215215
216216
emcc ... -sMODULARIZE=1 -sEXPORT_NAME=initPikchrModule
217217
--- extsrc/pikchr-worker.js
+++ extsrc/pikchr-worker.js
@@ -206,11 +206,11 @@
206 data:{step: ++f.last.step, text: text||null}
207 });
208 }
209 };
210
211 importScripts('pikchr-v7583078860.js');
212 /**
213 initPikchrModule() is installed via pikchr.js due to
214 building with:
215
216 emcc ... -sMODULARIZE=1 -sEXPORT_NAME=initPikchrModule
217
--- extsrc/pikchr-worker.js
+++ extsrc/pikchr-worker.js
@@ -206,11 +206,11 @@
206 data:{step: ++f.last.step, text: text||null}
207 });
208 }
209 };
210
211 importScripts('pikchr-v2813665466.js');
212 /**
213 initPikchrModule() is installed via pikchr.js due to
214 building with:
215
216 emcc ... -sMODULARIZE=1 -sEXPORT_NAME=initPikchrModule
217
+32 -19
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -25,17 +25,17 @@
2525
** The following is the concatenation of all %include directives from the
2626
** input grammar file:
2727
*/
2828
/************ Begin %include sections from the grammar ************************/
2929
#line 1 "VERSION.h"
30
-#define MANIFEST_UUID "9b9b3133644ff804f8312bb839ad4eb43d1eb1869558f7a3a50b788b2c4a706a"
31
-#define MANIFEST_VERSION "[9b9b313364]"
32
-#define MANIFEST_DATE "2025-03-19 12:41:21"
30
+#define MANIFEST_UUID "8a43b020141f772a0ac45291a7fd73041d2efba5e3665c6bd2f334ad9b2e9845"
31
+#define MANIFEST_VERSION "[8a43b02014]"
32
+#define MANIFEST_DATE "2025-03-19 16:19:43"
3333
#define MANIFEST_YEAR "2025"
34
-#define MANIFEST_ISODATE "20250319124121"
34
+#define MANIFEST_ISODATE "20250319161943"
3535
#define MANIFEST_NUMERIC_DATE 20250319
36
-#define MANIFEST_NUMERIC_TIME 124121
36
+#define MANIFEST_NUMERIC_TIME 161943
3737
#define RELEASE_VERSION "1.0"
3838
#define RELEASE_VERSION_NUMBER 10000
3939
#define RELEASE_RESOURCE_VERSION 1,0,0,0
4040
#define COMPILER "gcc-13.3.0"
4141
#line 2 "pikchr.y"
@@ -3687,44 +3687,57 @@
36873687
** than true arcs. Multiple reasons: (1) the legacy-PIC parameters
36883688
** that control arcs are obscure and I could not figure out what they
36893689
** mean based on available documentation. (2) Arcs are rarely used,
36903690
** and so do not seem that important.
36913691
*/
3692
-static PPoint arcControlPoint(int cw, PPoint f, PPoint t, PNum rScale, PNum rPct){
3692
+static PPoint arcControlPoint(int cw, PPoint f, PPoint t){
36933693
PPoint m;
36943694
PNum dx, dy;
3695
- m.x = rPct*(f.x+t.x);
3696
- m.y = rPct*(f.y+t.y);
3695
+ m.x = 0.5*(f.x+t.x);
3696
+ m.y = 0.5*(f.y+t.y);
36973697
dx = t.x - f.x;
36983698
dy = t.y - f.y;
36993699
if( cw ){
3700
- m.x -= 0.5*rScale*dy;
3701
- m.y += 0.5*rScale*dx;
3700
+ m.x -= 0.5*dy;
3701
+ m.y += 0.5*dx;
37023702
}else{
3703
- m.x += 0.5*rScale*dy;
3704
- m.y -= 0.5*rScale*dx;
3703
+ m.x += 0.5*dy;
3704
+ m.y -= 0.5*dx;
37053705
}
37063706
return m;
37073707
}
37083708
static void arcCheck(Pik *p, PObj *pObj){
3709
- PPoint m;
3709
+ PPoint f, m, t;
3710
+ PNum sw;
3711
+ int i;
37103712
if( p->nTPath>2 ){
37113713
pik_error(p, &pObj->errTok, "arc geometry error");
37123714
return;
37133715
}
3714
- m = arcControlPoint(pObj->cw, p->aTPath[0], p->aTPath[1], 0.5, 0.25);
3715
- pik_bbox_add_xy(&pObj->bbox, m.x, m.y);
3716
- m = arcControlPoint(pObj->cw, p->aTPath[0], p->aTPath[1], 0.5, 0.75);
3717
- pik_bbox_add_xy(&pObj->bbox, m.x, m.y);
3716
+ f = p->aTPath[0];
3717
+ t = p->aTPath[1];
3718
+ m = arcControlPoint(pObj->cw, f, t);
3719
+ sw = pObj->sw;
3720
+ for(i=1; i<16; i++){
3721
+ PNum t1, t2, a, b, c, x, y;
3722
+ t1 = 0.0625*i;
3723
+ t2 = 1.0 - t1;
3724
+ a = t2*t2;
3725
+ b = 2*t1*t2;
3726
+ c = t1*t1;
3727
+ x = a*f.x + b*m.x + c*t.x;
3728
+ y = a*f.y + b*m.y + c*t.y;
3729
+ pik_bbox_addellipse(&pObj->bbox, x, y, sw, sw);
3730
+ }
37183731
}
37193732
static void arcRender(Pik *p, PObj *pObj){
37203733
PPoint f, m, t;
37213734
if( pObj->nPath<2 ) return;
37223735
if( pObj->sw<0.0 ) return;
37233736
f = pObj->aPath[0];
37243737
t = pObj->aPath[1];
3725
- m = arcControlPoint(pObj->cw,f,t,1.0,0.5);
3738
+ m = arcControlPoint(pObj->cw,f,t);
37263739
if( pObj->larrow ){
37273740
pik_draw_arrowhead(p,&m,&f,pObj);
37283741
}
37293742
if( pObj->rarrow ){
37303743
pik_draw_arrowhead(p,&m,&t,pObj);
@@ -8317,6 +8330,6 @@
83178330
83188331
83198332
#endif /* PIKCHR_TCL */
83208333
83218334
8322
-#line 8322 "pikchr.c"
8335
+#line 8335 "pikchr.c"
83238336
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -25,17 +25,17 @@
25 ** The following is the concatenation of all %include directives from the
26 ** input grammar file:
27 */
28 /************ Begin %include sections from the grammar ************************/
29 #line 1 "VERSION.h"
30 #define MANIFEST_UUID "9b9b3133644ff804f8312bb839ad4eb43d1eb1869558f7a3a50b788b2c4a706a"
31 #define MANIFEST_VERSION "[9b9b313364]"
32 #define MANIFEST_DATE "2025-03-19 12:41:21"
33 #define MANIFEST_YEAR "2025"
34 #define MANIFEST_ISODATE "20250319124121"
35 #define MANIFEST_NUMERIC_DATE 20250319
36 #define MANIFEST_NUMERIC_TIME 124121
37 #define RELEASE_VERSION "1.0"
38 #define RELEASE_VERSION_NUMBER 10000
39 #define RELEASE_RESOURCE_VERSION 1,0,0,0
40 #define COMPILER "gcc-13.3.0"
41 #line 2 "pikchr.y"
@@ -3687,44 +3687,57 @@
3687 ** than true arcs. Multiple reasons: (1) the legacy-PIC parameters
3688 ** that control arcs are obscure and I could not figure out what they
3689 ** mean based on available documentation. (2) Arcs are rarely used,
3690 ** and so do not seem that important.
3691 */
3692 static PPoint arcControlPoint(int cw, PPoint f, PPoint t, PNum rScale, PNum rPct){
3693 PPoint m;
3694 PNum dx, dy;
3695 m.x = rPct*(f.x+t.x);
3696 m.y = rPct*(f.y+t.y);
3697 dx = t.x - f.x;
3698 dy = t.y - f.y;
3699 if( cw ){
3700 m.x -= 0.5*rScale*dy;
3701 m.y += 0.5*rScale*dx;
3702 }else{
3703 m.x += 0.5*rScale*dy;
3704 m.y -= 0.5*rScale*dx;
3705 }
3706 return m;
3707 }
3708 static void arcCheck(Pik *p, PObj *pObj){
3709 PPoint m;
 
 
3710 if( p->nTPath>2 ){
3711 pik_error(p, &pObj->errTok, "arc geometry error");
3712 return;
3713 }
3714 m = arcControlPoint(pObj->cw, p->aTPath[0], p->aTPath[1], 0.5, 0.25);
3715 pik_bbox_add_xy(&pObj->bbox, m.x, m.y);
3716 m = arcControlPoint(pObj->cw, p->aTPath[0], p->aTPath[1], 0.5, 0.75);
3717 pik_bbox_add_xy(&pObj->bbox, m.x, m.y);
 
 
 
 
 
 
 
 
 
 
 
3718 }
3719 static void arcRender(Pik *p, PObj *pObj){
3720 PPoint f, m, t;
3721 if( pObj->nPath<2 ) return;
3722 if( pObj->sw<0.0 ) return;
3723 f = pObj->aPath[0];
3724 t = pObj->aPath[1];
3725 m = arcControlPoint(pObj->cw,f,t,1.0,0.5);
3726 if( pObj->larrow ){
3727 pik_draw_arrowhead(p,&m,&f,pObj);
3728 }
3729 if( pObj->rarrow ){
3730 pik_draw_arrowhead(p,&m,&t,pObj);
@@ -8317,6 +8330,6 @@
8317
8318
8319 #endif /* PIKCHR_TCL */
8320
8321
8322 #line 8322 "pikchr.c"
8323
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -25,17 +25,17 @@
25 ** The following is the concatenation of all %include directives from the
26 ** input grammar file:
27 */
28 /************ Begin %include sections from the grammar ************************/
29 #line 1 "VERSION.h"
30 #define MANIFEST_UUID "8a43b020141f772a0ac45291a7fd73041d2efba5e3665c6bd2f334ad9b2e9845"
31 #define MANIFEST_VERSION "[8a43b02014]"
32 #define MANIFEST_DATE "2025-03-19 16:19:43"
33 #define MANIFEST_YEAR "2025"
34 #define MANIFEST_ISODATE "20250319161943"
35 #define MANIFEST_NUMERIC_DATE 20250319
36 #define MANIFEST_NUMERIC_TIME 161943
37 #define RELEASE_VERSION "1.0"
38 #define RELEASE_VERSION_NUMBER 10000
39 #define RELEASE_RESOURCE_VERSION 1,0,0,0
40 #define COMPILER "gcc-13.3.0"
41 #line 2 "pikchr.y"
@@ -3687,44 +3687,57 @@
3687 ** than true arcs. Multiple reasons: (1) the legacy-PIC parameters
3688 ** that control arcs are obscure and I could not figure out what they
3689 ** mean based on available documentation. (2) Arcs are rarely used,
3690 ** and so do not seem that important.
3691 */
3692 static PPoint arcControlPoint(int cw, PPoint f, PPoint t){
3693 PPoint m;
3694 PNum dx, dy;
3695 m.x = 0.5*(f.x+t.x);
3696 m.y = 0.5*(f.y+t.y);
3697 dx = t.x - f.x;
3698 dy = t.y - f.y;
3699 if( cw ){
3700 m.x -= 0.5*dy;
3701 m.y += 0.5*dx;
3702 }else{
3703 m.x += 0.5*dy;
3704 m.y -= 0.5*dx;
3705 }
3706 return m;
3707 }
3708 static void arcCheck(Pik *p, PObj *pObj){
3709 PPoint f, m, t;
3710 PNum sw;
3711 int i;
3712 if( p->nTPath>2 ){
3713 pik_error(p, &pObj->errTok, "arc geometry error");
3714 return;
3715 }
3716 f = p->aTPath[0];
3717 t = p->aTPath[1];
3718 m = arcControlPoint(pObj->cw, f, t);
3719 sw = pObj->sw;
3720 for(i=1; i<16; i++){
3721 PNum t1, t2, a, b, c, x, y;
3722 t1 = 0.0625*i;
3723 t2 = 1.0 - t1;
3724 a = t2*t2;
3725 b = 2*t1*t2;
3726 c = t1*t1;
3727 x = a*f.x + b*m.x + c*t.x;
3728 y = a*f.y + b*m.y + c*t.y;
3729 pik_bbox_addellipse(&pObj->bbox, x, y, sw, sw);
3730 }
3731 }
3732 static void arcRender(Pik *p, PObj *pObj){
3733 PPoint f, m, t;
3734 if( pObj->nPath<2 ) return;
3735 if( pObj->sw<0.0 ) return;
3736 f = pObj->aPath[0];
3737 t = pObj->aPath[1];
3738 m = arcControlPoint(pObj->cw,f,t);
3739 if( pObj->larrow ){
3740 pik_draw_arrowhead(p,&m,&f,pObj);
3741 }
3742 if( pObj->rarrow ){
3743 pik_draw_arrowhead(p,&m,&t,pObj);
@@ -8317,6 +8330,6 @@
8330
8331
8332 #endif /* PIKCHR_TCL */
8333
8334
8335 #line 8335 "pikchr.c"
8336
--- extsrc/pikchr.js
+++ extsrc/pikchr.js
@@ -300,11 +300,11 @@
300300
301301
// end include: URIUtils.js
302302
// include: runtime_exceptions.js
303303
// end include: runtime_exceptions.js
304304
function findWasmBinary() {
305
- var f = "pikchr-v7583078860.wasm";
305
+ var f = "pikchr-v2813665466.wasm";
306306
if (!isDataURI(f)) {
307307
return locateFile(f);
308308
}
309309
return f;
310310
}
311311
--- extsrc/pikchr.js
+++ extsrc/pikchr.js
@@ -300,11 +300,11 @@
300
301 // end include: URIUtils.js
302 // include: runtime_exceptions.js
303 // end include: runtime_exceptions.js
304 function findWasmBinary() {
305 var f = "pikchr-v7583078860.wasm";
306 if (!isDataURI(f)) {
307 return locateFile(f);
308 }
309 return f;
310 }
311
--- extsrc/pikchr.js
+++ extsrc/pikchr.js
@@ -300,11 +300,11 @@
300
301 // end include: URIUtils.js
302 // include: runtime_exceptions.js
303 // end include: runtime_exceptions.js
304 function findWasmBinary() {
305 var f = "pikchr-v2813665466.wasm";
306 if (!isDataURI(f)) {
307 return locateFile(f);
308 }
309 return f;
310 }
311
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
cannot compute difference between binary files
11
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
0 annot compute difference between binary files
1
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
0 annot compute difference between binary files
1

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button