コード例 #1
0
ファイル: CongruentArcs.cs プロジェクト: wcatykid/GeoShader
        public Arc OtherArc(Arc thatArc)
        {
            if (ca1.StructurallyEquals(thatArc)) return ca2;
            if (ca2.StructurallyEquals(thatArc)) return ca1;

            return null;
        }
コード例 #2
0
ファイル: MinorArc.cs プロジェクト: wcatykid/GeoShader
        public override bool HasSubArc(Arc that)
        {
            if (!this.theCircle.StructurallyEquals(that.theCircle)) return false;

            if (that is MajorArc || that is Semicircle) return false;

            return this.HasMinorSubArc(that);
        }
コード例 #3
0
        public bool AddArcMeasureDegree(Arc thatArc, double measure)
        {
            if (ArcMeasureKnown(thatArc)) return false;

            arcs.Add(new KeyValuePair<Arc, double>(thatArc, measure));

            return true;
        }
コード例 #4
0
ファイル: Sector.cs プロジェクト: wcatykid/GeoShader
        public Sector(Arc a)
        {
            theArc = a;
            radius1 = new Segment(theArc.theCircle.center, theArc.endpoint1);
            radius2 = new Segment(theArc.theCircle.center, theArc.endpoint2);

            thisAtomicRegion = new ShapeAtomicRegion(this);
        }
コード例 #5
0
ファイル: Utilities.cs プロジェクト: boubre/TutorAI
        public static ConcreteAST.Point AcquireRestrictedPoint(List <ConcreteAST.Point> points, ConcreteAST.Point that,
                                                               ConcreteAST.Arc arc1, ConcreteAST.Arc arc2)
        {
            ConcreteAST.Point pt = AcquirePoint(points, that);

            if (pt == null)
            {
                return(null);
            }

            return(!arc1.PointLiesOn(pt) || !arc2.PointLiesOn(pt) ? null : pt);
        }
コード例 #6
0
ファイル: MajorArc.cs プロジェクト: wcatykid/GeoShader
        public override bool HasSubArc(Arc that)
        {
            if (!this.theCircle.StructurallyEquals(that.theCircle)) return false;

            if (that is MajorArc) return this.HasMajorSubArc(that);
            if (that is Semicircle)
            {
                Semicircle semi = that as Semicircle;
                return this.HasMinorSubArc(new MinorArc(semi.theCircle, semi.endpoint1, semi.middlePoint)) &&
                       this.HasMinorSubArc(new MinorArc(semi.theCircle, semi.endpoint2, semi.middlePoint));
            }

            return this.HasMinorSubArc(that);
        }
コード例 #7
0
ファイル: CongruentArcs.cs プロジェクト: wcatykid/GeoShader
        public CongruentArcs(Arc a1, Arc a2)
            : base()
        {
            ca1 = a1;
            ca2 = a2;

            if (!Utilities.CompareValues(a1.theCircle.radius, a2.theCircle.radius))
            {
                throw new ArgumentException("Arcs deduced congruent when radii differ " + this);
            }

            if (!Utilities.CompareValues(a1.minorMeasure, a2.minorMeasure))
            {
                throw new ArgumentException("Arcs deduced congruent when measure differ " + this);
            }
        }
コード例 #8
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        //
        // Orthogonal
        //
        //
        // Orthogonal arcs intersect at 90^0: radii connecting to intersection point are perpendicular.
        //
        public bool AreOrthognal(Arc thatArc)
        {
            if (!this.theCircle.AreOrthognal(thatArc.theCircle)) return false;

            // Find the intersection points
            Point inter1;
            Point inter2;
            this.theCircle.FindIntersection(thatArc.theCircle, out inter1, out inter2);

            // Is the intersection between the endpoints of both arcs? Check both.
            if (Arc.BetweenMinor(inter1, this) && Arc.BetweenMinor(inter1, thatArc)) return true;
            if (Arc.BetweenMinor(inter2, this) && Arc.BetweenMinor(inter2, thatArc)) return true;

            return false;
        }
コード例 #9
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        public static bool StrictlyBetweenMinor(Point m, Arc originalArc)
        {
            if (m == null) return false;

            if (originalArc.HasEndpoint(m)) return false;

            return BetweenMinor(m, originalArc);
        }
コード例 #10
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        //
        // Is M between A and B in the minor arc
        //
        public static bool BetweenMinor(Point m, Arc originalArc)
        {
            if (m == null) return false;

            // Is the point on this circle?
            if (!originalArc.theCircle.PointLiesOn(m)) return false;

            // Create two arcs from this new point to the endpoints; just like with segments,
            // the sum of the arc measures must equate to the overall arc measure.
            MinorArc arc1 = new MinorArc(originalArc.theCircle, m, originalArc.endpoint1);
            MinorArc arc2 = new MinorArc(originalArc.theCircle, m, originalArc.endpoint2);

            return Utilities.CompareValues(arc1.minorMeasure + arc2.minorMeasure, originalArc.minorMeasure);
        }
コード例 #11
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        //
        // If it's on the circle and not in the minor arc, it's in the major arc.
        //
        public static bool BetweenMajor(Point m, Arc originalArc)
        {
            if (originalArc.HasEndpoint(m)) return true;

            if (m == null) return false;

            // Is the point on this circle?
            if (!originalArc.theCircle.PointLiesOn(m)) return false;

            // Is it on the arc minor?
            if (BetweenMinor(m, originalArc)) return false;

            return true;
        }
コード例 #12
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        public Point SharedEndpoint(Arc that)
        {
            if (this.endpoint1.StructurallyEquals(that.endpoint1)) return endpoint1;
            if (this.endpoint1.StructurallyEquals(that.endpoint2)) return endpoint1;

            if (this.endpoint2.StructurallyEquals(that.endpoint1)) return endpoint2;
            if (this.endpoint2.StructurallyEquals(that.endpoint2)) return endpoint2;

            return null;
        }
コード例 #13
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 // Does this arc contain a sub-arc:
 // A-------B-------C------D
 // A subarc is: AB, AC, AD, BC, BD, CD
 public bool HasMinorSubArc(Arc arc)
 {
     return Arc.BetweenMinor(arc.endpoint1, this) && Arc.BetweenMinor(arc.endpoint2, this);
 }
コード例 #14
0
        private static EdgeAggregator CreateClause(Intersection inter, GroundedClause original, Angle theAngle, Arc theArc)
        {
            Multiplication product = new Multiplication(new NumericValue(2), theAngle);
            GeometricAngleArcEquation angArcEq = new GeometricAngleArcEquation(product, theArc);

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);
            antecedent.Add(inter);

            return new EdgeAggregator(antecedent, angArcEq, annotation);
        }
コード例 #15
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 //
 // Is this segment proportional to the given segment in terms of the coordinatization from the UI?
 // We should not report proportional if the ratio between segments is 1
 //
 public KeyValuePair<int, int> CoordinateProportional(Arc a)
 {
     return Utilities.RationalRatio(this.length, a.length);
 }
コード例 #16
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        //
        // Do these arcs cross each other (pseudo-X)?
        //
        public bool Crosses(Arc that)
        {
            // Need to be from different circles.
            if (this.theCircle.StructurallyEquals(that.theCircle)) return false;

            // Need to touch at a point not at the endpoints;
            if (this.HasEndpoint(that.endpoint1) && this.HasEndpoint(that.endpoint2)) return false;

            Point inter1, inter2;
            this.FindIntersection(that, out inter1, out inter2);

            if (inter1 == null && inter2 == null) return false;

            // Pseudo-X
            if (inter1 != null && inter2 == null)
            {
                return this.PointLiesStrictlyOn(inter1) && that.PointLiesStrictlyOn(inter1);
            }

            // Cursive r; an endpoint may be shared here.
            if (inter1 != null && inter2 != null)
            {
                return true;
            }

            return false;
        }
コード例 #17
0
ファイル: Polygon.cs プロジェクト: wcatykid/GeoShader
        //
        // An arc is covered if one side of the polygon defines the endpoints of the arc.
        //
        public bool Covers(Arc that)
        {
            foreach (Segment side in orderedSides)
            {
                if (side.Covers(that)) return true;
            }

            return false;
        }
コード例 #18
0
ファイル: Segment.cs プロジェクト: wcatykid/GeoShader
 public override void FindIntersection(Arc that, out Point inter1, out Point inter2)
 {
     that.FindIntersection(this, out inter1, out inter2);
 }
コード例 #19
0
ファイル: Segment.cs プロジェクト: wcatykid/GeoShader
 public bool Covers(Arc that)
 {
     return that.HasEndpoint(this.Point1) && that.HasEndpoint(this.Point2);
 }
コード例 #20
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        //
        // Tangent circle have 1 intersection point
        //
        public Point AreTangent(Arc thatArc)
        {
            Point intersection = this.theCircle.AreTangent(thatArc.theCircle);

            // Is the intersection between the endpoints of both arcs? Check both.
            if (Arc.BetweenMinor(intersection, this) && Arc.BetweenMinor(intersection, thatArc)) return intersection;
            if (Arc.BetweenMinor(intersection, this) && Arc.BetweenMinor(intersection, thatArc)) return intersection;

            return null;
        }
コード例 #21
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 public abstract bool HasSubArc(Arc that);
コード例 #22
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 //
 // Is this arc congruent to the given arc in terms of the coordinatization from the UI?
 //
 public bool CoordinateCongruent(Arc a)
 {
     return Utilities.CompareValues(this.length, a.length);
 }
コード例 #23
0
ファイル: Sector.cs プロジェクト: wcatykid/GeoShader
        //
        // An arc is covered if one side of the polygon defines the endpoints of the arc.
        //
        public bool Covers(Arc that)
        {
            if (radius1.Covers(that)) return true;

            if (radius2.Covers(that)) return true;

            return theArc.Covers(that);
        }
コード例 #24
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 public bool Covers(Arc that)
 {
     return this.PointLiesStrictlyOn(that.endpoint1) || this.PointLiesStrictlyOn(that.endpoint1);
 }
コード例 #25
0
ファイル: Utilities.cs プロジェクト: boubre/TutorAI
        public static ConcreteAST.Point AcquireRestrictedPoint(List <ConcreteAST.Point> points, ConcreteAST.Point that,
                                                               ConcreteAST.Segment seg, ConcreteAST.Arc arc)
        {
            ConcreteAST.Point pt = AcquirePoint(points, that);

            if (pt == null)
            {
                return(null);
            }

            return(!seg.PointLiesOnAndBetweenEndpoints(pt) || !arc.PointLiesOn(pt) ? null : pt);
        }
コード例 #26
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
        public override void FindIntersection(Arc that, out Point inter1, out Point inter2)
        {
            // Find the points of intersection
            this.theCircle.FindIntersection(that.theCircle, out inter1, out inter2);

            // The points must be on this minor arc.
            if (this is MinorArc)
            {
                if (!Arc.BetweenMinor(inter1, this)) inter1 = null;
                if (!Arc.BetweenMinor(inter2, this)) inter2 = null;
            }
            else
            {
                if (!Arc.BetweenMajor(inter1, this)) inter1 = null;
                if (!Arc.BetweenMajor(inter2, this)) inter2 = null;
            }

            // The points must be on thatArc
            if (that is MinorArc)
            {
                if (!Arc.BetweenMinor(inter1, that)) inter1 = null;
                if (!Arc.BetweenMinor(inter2, that)) inter2 = null;
            }
            else
            {
                if (!Arc.BetweenMajor(inter1, that)) inter1 = null;
                if (!Arc.BetweenMajor(inter2, that)) inter2 = null;
            }

            if (inter1 == null && inter2 != null)
            {
                inter1 = inter2;
                inter2 = null;
            }
        }
コード例 #27
0
ファイル: Circle.cs プロジェクト: wcatykid/GeoShader
 //
 // An arc is covered if one side of the polygon defines the endpoints of the arc.
 //
 public bool Covers(Arc that)
 {
     return this.StructurallyEquals(that.theCircle);
 }
コード例 #28
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 public bool HasStrictMinorSubArc(Arc arc)
 {
     return Arc.StrictlyBetweenMinor(arc.endpoint1, this) && Arc.StrictlyBetweenMinor(arc.endpoint2, this);
 }
コード例 #29
0
ファイル: Circle.cs プロジェクト: wcatykid/GeoShader
 public bool HasArc(Arc arc)
 {
     return this.StructurallyEquals(arc.theCircle);
 }
コード例 #30
0
ファイル: Arc.cs プロジェクト: wcatykid/GeoShader
 //
 // Concentric
 //
 public bool IsConcentricWith(Arc thatArc)
 {
     return this.theCircle.AreConcentric(thatArc.theCircle);
 }
コード例 #31
0
 public GeometricCongruentArcs(Arc c1, Arc c2)
     : base(c1, c2)
 {
 }
コード例 #32
0
ファイル: Figure.cs プロジェクト: wcatykid/GeoShader
 public virtual void FindIntersection(Arc that, out Point inter1, out Point inter2)
 {
     inter1 = null; inter2 = null;
 }
コード例 #33
0
ファイル: SemiCircle.cs プロジェクト: wcatykid/GeoShader
 public override bool PointLiesOn(Point pt)
 {
     return(Arc.BetweenMinor(pt, new MinorArc(theCircle, endpoint1, middlePoint)) ||
            Arc.BetweenMinor(pt, new MinorArc(theCircle, endpoint2, middlePoint)));
 }