/// <summary> /// override method get square for simple triangle /// </summary> /// <returns>Value of the square simple triangle</returns> public override double GetSquare() { double sizeSideAB = PointA.GetDistance(PointB); double sizeSideAC = PointA.GetDistance(PointC); double sizeSideBC = PointB.GetDistance(PointC); double poluPim = (sizeSideAB + sizeSideAC + sizeSideBC) / 2; return(Math.Sqrt(poluPim * (poluPim - sizeSideAB) * (poluPim - sizeSideAC) * (poluPim - sizeSideBC))); }
/// <summary> /// override method get square for right triangle /// </summary> /// <returns>Value of the square right triangle</returns> public override double GetSquare() { double sizeSideAB = PointA.GetDistance(PointB); double sizeSideAC = PointA.GetDistance(PointC); double sizeSideBC = PointB.GetDistance(PointC); if (sizeSideAB < sizeSideBC && sizeSideAC < sizeSideBC) { return(sizeSideAB * sizeSideAC / 2); } else { if (sizeSideAB < sizeSideBC && sizeSideBC < sizeSideAC) { return(sizeSideAB * sizeSideBC / 2); } } return(sizeSideAC * sizeSideBC / 2); }
public override double GetArea() { double p = this.GetPerimeter() / 2.0; return(Math.Sqrt(p * (p - PointA.GetDistance(PointB)) * (p - PointA.GetDistance(PointC)) * (p - PointB.GetDistance(PointC)))); }
public override double GetPerimeter() { return(PointA.GetDistance(PointB) + PointA.GetDistance(PointC) + PointB.GetDistance(PointC)); }
/// <summary> /// override method get square for equilateral triangle /// </summary> /// <returns>Value of the square equilateral triangle</returns> public override double GetSquare() { double sizeSideAB = PointA.GetDistance(PointB); return(sizeSideAB * sizeSideAB * Math.Sqrt(3) / 4); }