Exemplo n.º 1
0
        public EquilateralTriangle(Triangle t)
            : base(t.SegmentA, t.SegmentB, t.SegmentC)
        {
            if (!Utilities.CompareValues(t.SegmentA.Length, t.SegmentB.Length))
            {
                throw new ArgumentException("Equilateral Triangle constructed with non-congruent segments " + t.SegmentA.ToString() + " " + t.SegmentB.ToString());
            }

            if (!Utilities.CompareValues(t.SegmentA.Length, t.SegmentC.Length))
            {
                throw new ArgumentException("Equilateral Triangle constructed with non-congruent segments " + t.SegmentA.ToString() + " " + t.SegmentC.ToString());
            }

            if (!Utilities.CompareValues(t.SegmentB.Length, t.SegmentC.Length))
            {
                throw new ArgumentException("Equilateral Triangle constructed with non-congruent segments " + t.SegmentB.ToString() + " " + t.SegmentC.ToString());
            }

            provenIsosceles = true;
            provenEquilateral = true;

            // Need to capture all owners as well; if a triangle is strengthened.
            this.AddAtomicRegions(t.atoms);
            this.GetFigureAsAtomicRegion().AddOwners(t.GetFigureAsAtomicRegion().owners);
        }
Exemplo n.º 2
0
        public EquilateralTriangle(Triangle t) : base(t.SegmentA, t.SegmentB, t.SegmentC)
        {
            if (!Utilities.CompareValues(t.SegmentA.Length, t.SegmentB.Length))
            {
                throw new ArgumentException("Equilateral Triangle constructed with non-congruent segments " + t.SegmentA.ToString() + " " + t.SegmentB.ToString());
            }

            if (!Utilities.CompareValues(t.SegmentA.Length, t.SegmentC.Length))
            {
                throw new ArgumentException("Equilateral Triangle constructed with non-congruent segments " + t.SegmentA.ToString() + " " + t.SegmentC.ToString());
            }

            if (!Utilities.CompareValues(t.SegmentB.Length, t.SegmentC.Length))
            {
                throw new ArgumentException("Equilateral Triangle constructed with non-congruent segments " + t.SegmentB.ToString() + " " + t.SegmentC.ToString());
            }

            provenIsosceles   = true;
            provenEquilateral = true;

            // Need to capture all owners as well; if a triangle is strengthened.
            this.AddAtomicRegions(t.atoms);
            this.GetFigureAsAtomicRegion().AddOwners(t.GetFigureAsAtomicRegion().owners);
        }