Question: Functions - 25 course points This assignment consists of three parts First, write a library of static methods that performs geometric transforms on polygons Refer

 Functions - 25 course points This assignment consists of three parts
First, write a library of static methods that performs geometric transforms on
polygons Refer to our Programming Assignments FAQ for instructions on how to

Functions - 25 course points This assignment consists of three parts First, write a library of static methods that performs geometric transforms on polygons Refer to our Programming Assignments FAQ for instructions on how to instal Code, how to use the commandine and how to submit your assaments Start your assignment early Programming Writo 1 programs and submit on Autolab We provide this ZIP FILE containing Polygon Transformjava Observe the following rules DO NOT Use System exit) DO NOT add the project or package statements DO NOT change the class namo DO NOT change the headers at ANY of the given methods DO NOT add any new class fields ONLY display the result as specified by the example for each problem DO NOT print other messages follow the examples for each problem USE Std. Stdout SidRandom, and Starow libraries Payoon transform (25 points) Wita library of static methods that performs vanous geometne transforms on poorwe Mamatovy a pogon is dit by its soquence of vertices Yol. 11), l.in Java we will represent a polygon by storing the randy.coordinates of the vicino Darrays) andy! lex) -1, 1 soole yll - [...]. 1) Three useful geometric transforms are scale, translate and rotate Scale the coordinates of each vertex (x) by a factor a *i=ax vi = ay . Translate each vertex (xy) by a given offset (dx dy) X=+dx v1 = y + dy Rotato each vertex (x, y) by degrees counterclockwise, around the origin X = Xicos - y sin e Yicos + x sine Write a two-dimensional transformation library by implementing the following API public class Polygon Transform VI Returns a new array object that is an exact copy of the given array: The given array is not mutated. public static double copy(double array) // Scales the polygon by the factor alpha public static void scale(doublef] x, doublecl y. double alpha) W Translates the polygon by (dx, dy). public static void translate( double[] x. double) y, double dx, double dy Witotates the polygon theta degrees counterclockie, about the origin public static void rotate(double) *, double[1 y, double theta) 1/ Tests each of the API methods by directly calling them public static void main(String ares) Note that the transformation methods and trust and run mutite me polygons Here we com examples coses (tests lor copy are not stown Spolyon by the actor 2 Scale 1: do) be 11 ya 30 Poncolor(stdraw. HED) pl tapha PencalorStora. pol. ) Translation (2:1) Str. scale 1.0, 1.0) Solo [0, 1.1. double y (.2.1) double, dy 1 Staristicelor Straw Stobraw.polyun translate) Stronale Straw.pl Bottes polo Ostale 0.11. 1.1 theta 45.0 color) browoli to that bow.colorir wy 10. 10.0 10.0 0.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!