Write a java program, MyRandArt_YI.java to create an abstract painting using the geometric functions in the StdDraw library and the random function to generate points, colors, and thickness. Note: make sure to restrict ranges for each feature.
Geometric Abstract Painting: Mary Heilmann
- Write a java program, MyCubicArt_YI.java to create an abstract painting using the geometric functions in the StdDraw library in the link below.
Students’ work from previous years
How to create your own colors:
setPenColor(int red, int green, int blue)
Creates an opaque RGB color with the specified red, green, and blue values.
Parameters:
red – the amount of red (between 0 and 255)
green – the amount of green (between 0 and 255)
blue – the amount of blue (between 0 and 255)
- Write a java program, MyRandCubicArt_YI.java to create an abstract painting using the geometric functions in the StdDraw library and the random function to generate points, colors, and thickness. Note: make sure to restrict ranges for each feature.
How to draw a polygon:
Write a short program with a polygon and play with it until you understand how it works.
[spoiler title=’APoly’]
/** * Playing with colors and shapes. * * @GE * @java 1.8.4 * 12/5/18 */ public class APoly { public static void main(String [] args) { // rescale the coordinate system StdDraw.setXscale(0, 2); StdDraw.setYscale(0, 2); StdDraw.setPenColor(255,0,255); double y[] = {.5,.5,1.5,1.5}; // y coordinates of each vertex double x[] = {.5,1.5,1.5,.5}; // x coordinates of each vertex //StdDraw.setPenColor(255,0,255); StdDraw.filledPolygon(x,y); StdDraw.setPenColor(0,0,255); StdDraw.setPenRadius(0.008); StdDraw.polygon(x,y); } }
[/spoiler]
How to change thickness:
setPenRadius(0.05)
Sets the pen size to the default size (0.002). The pen is circular, so that lines have rounded ends, and when you set the pen radius and draw a point, you get a circle of the specified radius.