## Diff of /math.c[84521e] .. [839d2e]  Maximize  Restore

### Switch to unified view

a/math.c b/math.c
`...`
`...`
1160
```}
```
1160
```}
```
1161
1161
1162
```/** convert from panini_general to erect **/
```
1162
```/** convert from panini_general to erect **/
```
1163
```int erect_panini_general( double x_dest,double  y_dest, double* lambda_src, double* phi_src, void* params)
```
1163
```int erect_panini_general( double x_dest,double  y_dest, double* lambda_src, double* phi_src, void* params)
```
1164
```{  /* params -> MakeParams */
```
1164
```{  /* params -> MakeParams */
```
1165
```    double x, y, lambda, phi, d, distance;
```
1165
```    double x, y, lambda, phi, distance;
```
1166
```
```
1166
```
```
1167
```    Image * ppg = setup_panini_general(mp);
```
1167
```    Image * ppg = setup_panini_general(mp);
```
1168
```    if( !ppg )
```
1168
```    if( !ppg )
```
1169
```        return FALSE;
```
1169
```        return FALSE;
```
1170
1171
```    d = ppg->precomputedValue[0];
```
1172
1170
1173
```    distance = mp->distance;
```
1171
```    distance = mp->distance;
```
1174
```    y = y_dest/distance;
```
1172
```    y = y_dest/distance;
```
1175
```    x = x_dest/distance;
```
1173
```    x = x_dest/distance;
```
1176
1174
`...`
`...`
1199
```int panini_general_erect( double lambda_dest,double  phi_dest, double* x_src, double* y_src, void* params)
```
1197
```int panini_general_erect( double lambda_dest,double  phi_dest, double* x_src, double* y_src, void* params)
```
1200
```{
```
1198
```{
```
1201
```    /* params -> MakeParams */
```
1199
```    /* params -> MakeParams */
```
1202
1200
1203
```    double phi, lambda, y,x;
```
1201
```    double phi, lambda, y,x;
```
1204
```  double d;  // >= 0
```
1205
```    double distance;
```
1202
```    double distance;
```
1206
1203
1207
```    Image * ppg = setup_panini_general(mp);
```
1204
```    Image * ppg = setup_panini_general(mp);
```
1208
```    if( !ppg )
```
1205
```    if( !ppg )
```
1209
```        return 0;
```
1206
```        return 0;
```
1210
1207
1211
```  d = ppg->precomputedValue[0];
```
1212
```
```
1213
```    distance = mp->distance;
```
1208
```    distance = mp->distance;
```
1214
```    lambda = lambda_dest/distance;
```
1209
```    lambda = lambda_dest/distance;
```
1215
```    phi = phi_dest/distance;
```
1210
```    phi = phi_dest/distance;
```
1216
1211
1217
```  // fail if outside feasible FOV
```
1212
```  // fail if outside feasible FOV
```
`...`
`...`
1450
```int erect_stereographic( double x_dest,double  y_dest, double* lon, double* lat, void*  params)
```
1445
```int erect_stereographic( double x_dest,double  y_dest, double* lon, double* lat, void*  params)
```
1451
```{
```
1446
```{
```
1452
```    double rh;      /* height above sphere*/
```
1447
```    double rh;      /* height above sphere*/
```
1453
```    double c;       /* angle                    */
```
1448
```    double c;       /* angle                    */
```
1454
```    double sinc,cosc;   /* sin of c and cos of c            */
```
1449
```    double sinc,cosc;   /* sin of c and cos of c            */
```
1455
```    double con;
```
1456
1450
1457
```    /* Inverse equations
```
1451
```    /* Inverse equations
```
1458
```     -----------------*/
```
1452
```     -----------------*/
```
1459
```    double x = x_dest / distanceparam;
```
1453
```    double x = x_dest / distanceparam;
```
1460
```    double y = y_dest / distanceparam;
```
1454
```    double y = y_dest / distanceparam;
```
`...`
`...`
1469
```        return 0;
```
1463
```        return 0;
```
1470
```    }
```
1464
```    }
```
1471
```    else
```
1465
```    else
```
1472
```    {
```
1466
```    {
```
1473
```        *lat = asin((y * sinc) / rh) * distanceparam;
```
1467
```        *lat = asin((y * sinc) / rh) * distanceparam;
```
1474
```        con = HALF_PI;
```
1468
1475
```
```
1476
```        con = cosc;
```
1477
```        if ((fabs(cosc) < EPSLN) && (fabs(x) < EPSLN))
```
1469
```        if ((fabs(cosc) < EPSLN) && (fabs(x) < EPSLN))
```
1478
```            return 0;
```
1470
```            return 0;
```
1479
```        else
```
1471
```        else
```
1480
```            *lon = atan2((x * sinc), (cosc * rh)) * distanceparam;
```
1472
```            *lon = atan2((x * sinc), (cosc * rh)) * distanceparam;
```
1481
```    }
```
1473
```    }
```