/* * ValidateSquare ensures that all vertecies have an angle of 90 */ public void ValidateSquare() { var LineAC = new Line(Line1.Point1, Line2.Point2); if ( (Math.Acos((Math.Pow(Line1.ComputeLength(), 2) + Math.Pow(Line4.ComputeLength(), 2) - Math.Pow(LineAC.ComputeLength(), 2) / (2 * Line1.ComputeLength() * Line4.ComputeLength())))) != 90 ) { throw new ShapeException("Invalid rectangle"); } }
/* * Validator will check to ensure: * 1. The length of any edge does not exceed the sum of the other two * 2. The points that make up the line must not reside on the same line */ public void ValidateTriangle() { if ((Line1.ComputeLength() > Line2.ComputeLength() + Line3.ComputeLength()) || (Line2.ComputeLength() > Line1.ComputeLength() + Line3.ComputeLength()) || (Line3.ComputeLength() > Line1.ComputeLength() + Line2.ComputeLength())) { throw new ShapeException("Invalid triangle"); } if (Line1.ComputeSlope() == Line2.ComputeSlope() || Line2.ComputeSlope() == Line3.ComputeSlope() || Line3.ComputeSlope() == Line1.ComputeSlope()) { throw new ShapeException("Invalid Triangle"); } }
public double ComputeArea() { double area = Math.Pow(Line1.ComputeLength(), 2); return(area); }
public double ComputeArea() { double area = Line1.ComputeLength() * Line2.ComputeLength(); return(area); }