コード例 #1
0
 internal SimpleEdge()
 {
     m_value        = -1;
     m_line         = new com.epl.geometry.Line();
     m_dxdy         = 55555555;
     m_b_horizontal = false;
     m_b_curve      = false;
     m_env          = new com.epl.geometry.Envelope1D();
     m_env.SetCoordsNoNaN_(0, 0);
 }
コード例 #2
0
        protected internal virtual int CompareVertex_(com.epl.geometry.Treap treap, int node, int vertex)
        {
            bool bCurve = m_shape.GetSegment(vertex) != null;

            if (!bCurve)
            {
                m_shape.QueryLineConnector(vertex, m_line_1);
                m_env.SetCoordsNoNaN_(m_line_1.GetStartX(), m_line_1.GetEndX());
            }
            if (bCurve)
            {
                throw new com.epl.geometry.GeometryException("not implemented");
            }
            if (m_point_of_interest.x + m_tolerance < m_env.vmin)
            {
                return(-1);
            }
            if (m_point_of_interest.x - m_tolerance > m_env.vmax)
            {
                return(1);
            }
            if (m_line_1.GetStartY() == m_line_1.GetEndY())
            {
                m_current_node            = node;
                m_b_intersection_detected = true;
                return(0);
            }
            m_line_1.OrientBottomUp_();
            com.epl.geometry.Point2D start  = m_line_1.GetStartXY();
            com.epl.geometry.Point2D vector = new com.epl.geometry.Point2D();
            vector.Sub(m_line_1.GetEndXY(), start);
            vector.RightPerpendicular();
            com.epl.geometry.Point2D v_2 = new com.epl.geometry.Point2D();
            v_2.Sub(m_point_of_interest, start);
            double dot = vector.DotProduct(v_2);

            dot /= vector.Length();
            if (dot < -m_tolerance * 10)
            {
                return(-1);
            }
            if (dot > m_tolerance * 10)
            {
                return(1);
            }
            if (m_line_1.IsIntersecting(m_point_of_interest, m_tolerance))
            {
                double absDot = System.Math.Abs(dot);
                if (absDot < m_min_dist)
                {
                    m_current_node = node;
                    m_min_dist     = absDot;
                }
                m_b_intersection_detected = true;
                if (absDot < 0.25 * m_tolerance)
                {
                    return(0);
                }
            }
            return(dot < 0 ? -1 : 1);
        }