private int edgeAngleCompare_ ( /* const */ Edge edge1 , /* const */ Edge edge2 ) { if ( edge1 . equals ( edge2 ) ) return 0 ; Point2D v1 = edge1 . m_segment . _getTangent ( edge1 . getReversed ( ) ? 1.0 : 0.0 ) ; if ( edge1 . getReversed ( ) ) v1 . negate ( ) ; Point2D v2 = edge2 . m_segment . _getTangent ( edge2 . getReversed ( ) ? 1.0 : 0.0 ) ; if ( edge2 . getReversed ( ) ) v2 . negate ( ) ; int q1 = v1 . _getQuarter ( ) ; int q2 = v2 . _getQuarter ( ) ; if ( q2 == q1 ) { double cross = v1 . crossProduct ( v2 ) ; double crossError = 4 * NumberUtils . doubleEps ( ) * ( Math . abs ( v2 . x * v1 . y ) + Math . abs ( v2 . y * v1 . x ) ) ; if ( Math . abs ( cross ) <= crossError ) { cross -- ; // To avoid warning of "this line has no effect" from // cross = cross. cross ++ ; } assert ( Math . abs ( cross ) > crossError ) ; return cross < 0 ? 1 : ( cross > 0 ? - 1 : 0 ) ; } else { return q1 < q2 ? - 1 : 1 ; } }
compares angles between two edges