/ Check-in [33576b12]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the name of the trig function approximation in geopoly. No functional changes to the code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 33576b12b450a37b467ba012e77b297eb80d7147b12a5b23302009bb32455720
User & Date: drh 2018-11-29 12:00:02
Context
2018-11-30
20:59
Fix a typo in a comment. No changes to code. check-in: 23684cb8 user: drh tags: trunk
18:22
Merge the pre-3.26.0 fixes from trunk. check-in: 2c76ce4f user: drh tags: apple-osx
2018-11-29
12:00
Fix the name of the trig function approximation in geopoly. No functional changes to the code. check-in: 33576b12 user: drh tags: trunk
2018-11-28
19:23
Fix a typo in a comment used to generate documentation. No changes to code. check-in: 62360cea user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/rtree/geopoly.c.

   540    540          4+8*p->nVertex, SQLITE_TRANSIENT);
   541    541       sqlite3_free(p);
   542    542     }            
   543    543   }
   544    544   
   545    545   #define GEOPOLY_PI 3.1415926535897932385
   546    546   
   547         -/* Fast approximation for cosine(X) for X between -0.5*pi and 2*pi
          547  +/* Fast approximation for sine(X) for X between -0.5*pi and 2*pi
   548    548   */
   549         -static double geopolyCosine(double r){
          549  +static double geopolySine(double r){
   550    550     assert( r>=-0.5*GEOPOLY_PI && r<=2.0*GEOPOLY_PI );
   551    551     if( r>=1.5*GEOPOLY_PI ){
   552    552       r -= 2.0*GEOPOLY_PI;
   553    553     }
   554    554     if( r>=0.5*GEOPOLY_PI ){
   555         -    return -geopolyCosine(r-GEOPOLY_PI);
          555  +    return -geopolySine(r-GEOPOLY_PI);
   556    556     }else{
   557    557       double r2 = r*r;
   558    558       double r3 = r2*r;
   559    559       double r5 = r3*r2;
   560    560       return 0.9996949*r - 0.1656700*r3 + 0.0075134*r5;
   561    561     }
   562    562   }
................................................................................
   589    589     i = 1;
   590    590     p->hdr[0] = *(unsigned char*)&i;
   591    591     p->hdr[1] = 0;
   592    592     p->hdr[2] = (n>>8)&0xff;
   593    593     p->hdr[3] = n&0xff;
   594    594     for(i=0; i<n; i++){
   595    595       double rAngle = 2.0*GEOPOLY_PI*i/n;
   596         -    p->a[i*2] = x - r*geopolyCosine(rAngle-0.5*GEOPOLY_PI);
   597         -    p->a[i*2+1] = y + r*geopolyCosine(rAngle);
          596  +    p->a[i*2] = x - r*geopolySine(rAngle-0.5*GEOPOLY_PI);
          597  +    p->a[i*2+1] = y + r*geopolySine(rAngle);
   598    598     }
   599    599     sqlite3_result_blob(context, p->hdr, 4+8*n, SQLITE_TRANSIENT);
   600    600     sqlite3_free(p);
   601    601   }
   602    602   
   603    603   /*
   604    604   ** If pPoly is a polygon, compute its bounding box. Then: