コード例 #1
0
        private bool StronglyRelated(GroundedClause firstNode, GroundedClause secondNode)
        {
            if (firstNode is SegmentRatio && secondNode is SegmentRatio)
            {
                return(true);
            }
            if (firstNode is ProportionalAngles && secondNode is ProportionalAngles)
            {
                return(true);
            }

            if (firstNode is Congruent && secondNode is Congruent)
            {
                if (firstNode is CongruentAngles && secondNode is CongruentAngles)
                {
                    return(true);
                }
                if (firstNode is CongruentSegments && secondNode is CongruentSegments)
                {
                    return(true);
                }
                if (firstNode is CongruentTriangles && secondNode is CongruentTriangles)
                {
                    return(true);
                }
                return(false);
            }

            if (firstNode is Equation && secondNode is Equation)
            {
                if (firstNode is AngleEquation && secondNode is AngleEquation)
                {
                    return(true);
                }
                if (firstNode is SegmentEquation && secondNode is SegmentEquation)
                {
                    return(true);
                }
                return(false);
            }

            //
            // We may strenghthen for many reasons (right triangle, isosceles triangle as well as perpendicular bisector)
            // Compare those strengthened values for a relationship
            //
            if (firstNode is Strengthened && secondNode is Strengthened)
            {
                Strengthened streng1 = firstNode as Strengthened;
                Strengthened streng2 = secondNode as Strengthened;

                return(StronglyRelated(streng1.strengthened, streng2.strengthened));
            }

            //if (firstNode is Similar)
            //{
            //    return secondNode is Similar;
            //}

            return(firstNode.GetType() == secondNode.GetType());
        }
コード例 #2
0
        /// <summary>
        /// Determines if the given nodes are the same regardless of type or the specific type of relationship.
        /// </summary>
        /// <param name="node1">Integer representation of the node in the hypergraph</param>
        /// <param name="node2">Integer representation of the node in the hypergraph</param>
        /// <returns>That is, this function will return TRUE if one node is congruence of segments and the other is congruence of triangles</returns>
        private bool WeaklyRelated(int node1, int node2)
        {
            GroundedClause firstNode  = graph.GetNode(node1);
            GroundedClause secondNode = graph.GetNode(node2);

            //System.Diagnostics.Debug.WriteLine("Related Nodes? " + firstNode.ToString() + " " + secondNode.ToString());

            if (firstNode is Congruent)
            {
                return(secondNode is Congruent);
            }

            if (firstNode is Equation)
            {
                return(secondNode is Equation);
            }

            //if (firstNode is Similar)
            //{
            //    return secondNode is Similar;
            //}

            return(firstNode.GetType() == secondNode.GetType());
        }