Question
Question: For the unit 7 Programming Assignment, we will implement a function grapher. Program that can plot a function that is in the form z
Question:
For the unit 7 Programming Assignment, we will implement a function grapher.
Program that can plot a function that is in the form
z = f(x,y)
Your program must generate input values between -1 and 1 in increments of .1 and use this to plot x, y, and z vertices to be included as part of a mesh that will then be graphically displayed.
If you would like you can implement the functionality to allow both the function to be mapped as expressed as a mathematical formula and the input values to be entered by the user of your program, however, this is optional.
Your program must implement mouse controls such that the function that you have mapped can be rotated and scaled using the mouse.
Your project MUST include a plane and an axis helper to provide a point of reference for your function that indicates the origin which is assumed to be x=0, y=0, and z=0.
The axis helper is an object that can be added to you scene that looks like the following and indicates the direction of x, y, and z within the scene.
Your completed project should look like the following example (you do not need to provide the input box in the upper right hand corner):
In the above example we are graphing the function z = f(x,y) where f(x,y) = x2 + y2. Your function grapher should be able to accommodate any function that can be expressed and evaluated as a mathematical function. In the case of the above example the input values of x and y are evaluated to produce a value of z producing the coordinates for a vertex. Although your program should be able to graph any function in the form z = f(x,y), you should use one of the following to submit as part of the assignment:
- produces a cone shape
- produces a hyperbolic paraboloid
NOTE: that if you implement the functionality to allow the user to enter any function that they want then this is NOT required so long as your program can graph any of them.
The input values can be generated using simple for loops as indicated below or by using one of the other examples that have been identified.
for (x=Min_x; x
{
for(y=Min_y; y
{
z = fun(x,y); // note that fun must evaluate the expression
new Vector3 ( ....);
}
}
Keep in mind that you must capture all of the vertices that you are defining and provide them as input into one of the geometry functions within Three.js. The ParametricGeometry object is perhaps the best one to use, however, if your research identifies another approach feel free to use it so long as you can achieve the same results.
Does the assignment demonstrate the ability to graph a given function? (Yes/No)
Does the assignment include one of the specified formulas or does it allow the user to enter the formula? (Yes/No)
Can the user rotate and scale the graphed function? (Yes/No)
Was an Axis helper included in the scene (the object that indicates the x, y, and z dimensions)? (Yes/No)
Was a plane (either solid or wireframe) perpendicular to the object at the origin included? (Yes/No)
Was the JavaScript / Three.js code well documented (Scale of 1-4 where 1 is no comments and 4 is comprehensive comments)
http://prntscr.com/13g5cjc
https://pastebin.com/fRtP4dCV
I almost have it, but im getting an error
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started