public sealed override double Perimeter() { /// <summary> /// It returns the permeter of a Trapezium (trapezoid). /// </summary> /// // Calculating distance between the base and the top most points of a trapezium (trapezoid) // in order to get its first side double side1 = this.heightTop.Distance(this.X, this.Y); // Creating two other points in order to calculate the last side of the trapezium (trapezoid) Dot thirdPoint = new Dot(this.heightTop.X + this.b, this.heightTop.Y); Dot fourthPoint = new Dot(this.X + this.B, this.Y); double side4 = thirdPoint.Distance(fourthPoint); // Now calculate the trapezium (trapezoid) perimeter return(side1 + this.B + this.b + side4); }
public sealed override double Perimeter() { /// <summary> /// It returns the perimeter of a triangle. /// </summary> /// // Calculating distance between the base and the top most points of a triangle // in order to get its first side double side1 = this.heightTop.Distance(this.X, this.Y); // Creating another point in order to get the triangle last side afterwards // (one of the sides is its width) Dot thirdPoint = new Dot(this.X + this.width, this.Y); double side3 = thirdPoint.Distance(this.heightTop); // Now calculate the triangle perimeter return(side1 + this.width + side3); }