Task: Develop an algorithm to randomly place rectangles in a 2D matrix
Detailed Specifications: For a matrix of a given size, randomly (in center position and angle) place rectangles in the matrix until a given percentage of the matrix is covered by rectangles. While the size of the rectangles are constant, the angle and center position of each rectangle can vary randomly. In addition, rectangles should not overlap with each other
Input/Output Specifications: Fixed Parameters: Length (10) and Width (10) of the Matrix Input Parmeters: Rectangle Height(rh), Rectangle Width (rw), % of Matrix to fill. Output: a binary matrix indicating position of rectangles.
Example of program flow (the way your program flows may be different):
Computer Prompt | User Input |
---|---|
Input the Height of the rectangles to place | 3 |
Input the Length of the rectangles to place | 5 |
Input the percent of matrix to be filled | 60 |
© Jonathon David White - "With a Servant's Heart" - Last updated: |