All pastes #626695 Raw Edit

Untitled

public text v1 · immutable
·published 2007-07-19 20:41 UTC
rendered paste body
            float const centerLat=m_planetAxis.pitch();
            float const centerLng=-m_planetAxis.yaw();
            double PiRestriction = 5 * M_PI / 6;
            bool flag = false;
            int lastSign =0;
            ScreenPolygon otherPolygon;
            otherPolygon.setClosed( m_polygon.closed() );

            double xyFactor = (float)(2*m_radius)/M_PI;
            double degX;
            double degY;
            qpos = itPoint->quaternion();
            qpos.getSpherical(degX,degY);
            double x = m_imgwidth/2 + xyFactor * (degX + centerLng);
            double y = m_imgheight/2 + xyFactor * (degY + centerLat);
            m_currentPoint = QPointF( x, y );
            int sign = (int) (degX / fabs(degX) );
            if( sign != lastSign && fabs(degX) > PiRestriction ) {
                flag = !flag;
            }
            if( !flag )
                m_polygon<<m_currentPoint;
            else
                otherPolygon<<m_currentPoint;

            lastSign = sign;
        }
    }

    if ( m_polygon.size() >= 2 ) {
        append(m_polygon);
    }

    if( otherPolygon.size() >=2 ) {
        append(otherPolygon);
    }