Exemplo n.º 1
0
        public override bool Equals(Object obj)
        {
            CircleCircleIntersection inter = obj as CircleCircleIntersection;

            if (inter == null)
            {
                return(false);
            }
            return(this.otherCircle.Equals(inter.otherCircle) &&
                   this.intersect.Equals(inter.intersect) &&
                   this.theCircle.Equals(inter.theCircle));
        }
Exemplo n.º 2
0
 public ArcArcBisector(CircleCircleIntersection b)
     : base()
 {
     bisected = b;
 }
Exemplo n.º 3
0
 public ArcArcBisector(CircleCircleIntersection b) : base()
 {
     bisected = b;
 }
        /// <summary>
        /// Calculate all points of intersection between circles.
        /// Updates segments by creating segments.
        /// </summary>
        public void CalcCircleCircleIntersections(out List<GeometryTutorLib.ConcreteAST.CircleCircleIntersection> ccIntersections)
        {
            ccIntersections = new List<CircleCircleIntersection>();

            for (int c1 = 0; c1 < implied.circles.Count - 1; c1++)
            {
                for (int c2 = c1 + 1; c2 < implied.circles.Count; c2++)
                {
                    //
                    // Find any intersection points between the circle and the segment;
                    // the intersection MUST be between the segment endpoints
                    //
                    Point inter1 = null;
                    Point inter2 = null;
                    implied.circles[c1].FindIntersection(implied.circles[c2], out inter1, out inter2);

                    List<Point> intersectionPts = new List<Point>();
                    if (inter1 != null) intersectionPts.Add(inter1);
                    if (inter2 != null) intersectionPts.Add(inter2);

                    // normalized to drawing point (names)
                    intersectionPts = implied.NormalizePointsToDrawing(intersectionPts);

                    // and add to each figure (circle and polygon).
                    implied.circles[c1].AddIntersectingPoints(intersectionPts);
                    implied.circles[c2].AddIntersectingPoints(intersectionPts);

                    //
                    // Construct the intersections
                    //
                    CircleCircleIntersection ccInter = null;

                    if (inter1 != null)
                    {
                        ccInter = new CircleCircleIntersection(inter1, implied.circles[c1], implied.circles[c2]);
                        GeometryTutorLib.Utilities.AddStructurallyUnique<CircleCircleIntersection>(ccIntersections, ccInter);
                    }
                    if (inter2 != null)
                    {
                        ccInter = new CircleCircleIntersection(inter2, implied.circles[c1], implied.circles[c2]);
                        GeometryTutorLib.Utilities.AddStructurallyUnique<CircleCircleIntersection>(ccIntersections, ccInter);
                    }

                    // Add an implied collinear relationship so that the appropriate segments are generated.
                    // ONLY for tangent situations.
                    if (inter1 != null && inter2 == null)
                    {
                        //Determine the endpoints (the intersection point could be an endpoint if the tangency is internal)
                        Point e1, e2, m;
                        Point center1 = implied.circles[c1].center;
                        Point center2 = implied.circles[c2].center;
                        if (GeometryTutorLib.ConcreteAST.Segment.Between(inter1, center1, center2))
                        {
                            e1 = center1;
                            e2 = center2;
                            m = inter1;
                        }
                        else if (GeometryTutorLib.ConcreteAST.Segment.Between(center1, inter1, center2))
                        {
                            e1 = inter1;
                            e2 = center2;
                            m = center1;
                        }
                        else
                        {
                            e1 = inter1;
                            e2 = center1;
                            m = center2;
                        }
                        Collinear coll = new Collinear();
                        coll.AddCollinearPoint(e1);
                        coll.AddCollinearPoint(m);
                        coll.AddCollinearPoint(e2);
                        implied.collinear.Add(coll);
                    }
                }
            }

            // Construct any radii and chords.
            foreach (GeometryTutorLib.ConcreteAST.Circle circle in implied.circles)
            {
                AddImpliedSegments(circle);
            }
        }