public double Sqr(Romb obj) { double sqr; double A = Math.Sqrt(Math.Pow(obj.Point[3, 0] - obj.Point[0, 0], 2.0) + Math.Pow(obj.Point[3, 1] - obj.Point[0, 1], 2.0)); double B = Math.Sqrt(Math.Pow(obj.Point[2, 0] - obj.Point[1, 0], 2.0) + Math.Pow(obj.Point[2, 1] - obj.Point[1, 1], 2.0)); double h = obj.Point[1, 1] - obj.Point[0, 1]; sqr = ((A + B) / 2) * h; return(sqr); }
public double Per(Romb obj) { double per; double A = Math.Sqrt(Math.Pow(obj.Point[3, 0] - obj.Point[0, 0], 2.0) + Math.Pow(obj.Point[3, 1] - obj.Point[0, 1], 2.0)); double B = Math.Sqrt(Math.Pow(obj.Point[2, 0] - obj.Point[1, 0], 2.0) + Math.Pow(obj.Point[2, 1] - obj.Point[1, 1], 2.0)); double C = Math.Sqrt(Math.Pow(obj.Point[1, 0] - obj.Point[0, 0], 2.0) + Math.Pow(obj.Point[1, 1] - obj.Point[0, 1], 2.0)); double D = Math.Sqrt(Math.Pow(obj.Point[2, 0] - obj.Point[3, 0], 2.0) + Math.Pow(obj.Point[2, 1] - obj.Point[3, 1], 2.0)); per = A + B + C + D; return(per); }
static void Main(string[] args) { Romb obj = new Romb(-1, -3, 1, 2, 3, -3, 1, -8); double[] P1 = obj.Cords(1); double[] P2 = obj.Cords(2); double[] P3 = obj.Cords(3); double[] P4 = obj.Cords(4); double per = obj.Per(obj); double sqr = obj.Sqr(obj); double lenth = obj.Len(1, 2); }