IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13802


Ignore:
Timestamp:
Jun 13, 2007, 1:39:58 PM (19 years ago)
Author:
magnier
Message:

saturate the ellipse parameters on both minor and major axes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psEllipse.c

    r13425 r13802  
    4646
    4747// ellipse rotation (major, minor, theta) -> (x2, y2, xy)
     48// XXXX handle case where e0 < LIMIT
    4849psErrorCode psEllipsePolToAxes(const psEllipsePol pol,
    4950                               const float minMinorAxis,
     
    6364
    6465    float LIMIT = PS_SQR(minMinorAxis);
    65     if (2.0*(pol.e0 - ds) < LIMIT) {
    66         axes->major = sqrt(pol.e0 - LIMIT);
    67         axes->minor = sqrt(LIMIT);
     66    if (pol.e0 < LIMIT) {
     67        // if e0 is too small, we are really out of luck
     68        axes->major = minMinorAxis;
     69        axes->minor = minMinorAxis;
    6870    } else {
    69         axes->major = sqrt(0.5*(pol.e0 + ds));
    70         axes->minor = sqrt(0.5*(pol.e0 - ds));
     71        if (2.0*(pol.e0 - ds) < LIMIT) {
     72            // if e0 - ds is too small, saturate the minor axis at minMinorAxis
     73            axes->major = sqrt(pol.e0 - LIMIT);
     74            axes->minor = sqrt(LIMIT);
     75        } else {
     76            // normal values for e0 & ds
     77            axes->major = sqrt(0.5*(pol.e0 + ds));
     78            axes->minor = sqrt(0.5*(pol.e0 - ds));
     79        }
    7180    }
    7281
Note: See TracChangeset for help on using the changeset viewer.