public static Point Generate(Boundaries boundX, Boundaries boundY) { double x = UniformDistribution.GetNum(boundX); double y = UniformDistribution.GetNum(boundY); return(new Point(x, y)); }
public Semicircle(Point b, Point d) { Center = new Point(d.X, b.Y); R = d.Y - b.Y; Area = 0.5 * Math.PI * R * R; boundX = new Boundaries(Center.X, Center.X + R); boundY = new Boundaries(d.Y - 2 * R, d.Y); }
public Rectangle(Point b, Point d) { var triangle = new Triangle(b, d); Width = triangle.Base; Length = triangle.Height + triangle.Base / 2; Area = Length * Width; boundX = new Boundaries(b.X, b.X + Length); boundY = new Boundaries(d.Y - triangle.Base, d.Y); }
public Triangle(Point b, Point d) { Base = 2 * (d.Y - b.Y); Height = d.X - b.X; Area = 0.5 * Base * Height; this.b = b; this.d = d; this.e = new Point(d.X, d.Y - Base); boundX = new Boundaries(b.X, d.X); boundY = new Boundaries(d.Y - Base, d.Y); }
private bool IsBetween(Boundaries boundaries, double num) => num >= boundaries.Min && num < boundaries.Max;
public static double GetNum(Boundaries boundaries) { var random = new Random(); return(random.NextDouble() * boundaries.Length + boundaries.Min); }