Java代写 | 159.235 Assignment 2 Wireframe Data Viewer

本次新西兰代写主要为Java jframe的的assignment

159.235 Assignment 2
Wireframe Data Viewer
Write a Java program that renders a 3 dimensional triangle wireframe surface data model
and allows one to view the model from any viewing angle. This could be thought of as a
simple CAD program.
The first thing you should do is set up the user interface of your program. It is suggested
you construct this as follows. Note: you are welcome to set up an alternative user interface,
but don’t spend too much time on that. This isn’t the main point of this exercise.
This assignment requires the application of knowledge of coordinate transformations and
hidden surface removal. These topics will be convered in the lectures.
• Make your program extend a JFrame, or instantiate a JFrame when starting up your
program. Your main program should act as the “controler” where the appropriate
event handler interfaces are implemented
• Add a File menu to your JFrame with Open and Quit menu items. The Open item is to
be used to read the contents of a wireframe data file.
• Make a “control panel” by adding a separate JPanel to the content pane of your JFrame.
Add 3 sliders and 2 push buttons to this panel. The sliders will be used to control the
rotation angles of the wireframe data in the xy, xz, and yz planes. The push buttons
will be used to control the scaling of the figure with one button making it smaller and
the other enlarging it. Your program could look something like that shown on the next
• Make a display panel by extending a JPanel. Draw all your figures on this panel.
A set of startup code that does all this has been put on the Stream site.
Your program should be able to rotate the figure about any axis in response to moving
the sliders. The push buttons should also scale accordingly. A set of wireframe data files
for various object surfaces is provided on the course web site. These files list the (x, y, z)
coordinates of each vertex in the wireframe and then lists the vertex number for each surface
triangle. You will need to devise some way of storing and organizing this information in your

A screencast of a working version of this assignment will be placed on Stream.

You will need to decide how to transform the vertex coordinates in the wireframe data for
the given rotations and scalings. You can then draw each triangle on the Graphics2D canvas
with the transformed vertex positions. The wireframe outlines should be clearly visible It is
suggested that you draw each triangle using something like:
// xdraw and ydraw are s i z e 3 arrays giving the t r iangle vertex posi t ions
Polygon aTriangle = new Polygon(xdraw, ydraw, 3);
// . . . assign values to aTriangle . . .
// The implementation de tai l s wi l l depend upon how you have
// designed your program
g2.fill(aTriangle); // Colour in the t r iangle surface
g2.draw(aTriangle); // Draw the t r iangle out l ine
Your rendered wireframe figures should appear “solid”, ie you need to implement some proce-
dure to remove hidden surfaces. You should at least implement the back face culling method.
You should find that this will remove most hidden surfaces—but not all of them. Top marks
will be earned by those programs that are able to remove all hidden surfaces. Note: you do
not need to apply any lighting or shading to the surfaces—this will be dealt with later on in
the course.
Fine print
This assignment will count up 15% of your final grade.
Due date: 2021 May 2, 11:55pm. Please submit via the submission link on the course
site on Stream.



本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx