Generate menu for all of the given keyboard functionalities

Assignment Help C/C++ Programming
Reference no: EM13869135

Homework 1: Done and working good

Programming problem: Interactive Natural Cubic Spline

In mathematics, a spline is a numeric function that is piecewise-defined by polynomial functions, and which possesses a high degree of smoothness at the places where the polynomial pieces connect (which are known as knots).

Cubic splines are the most popular spline functions. They are smooth functions with which to fit data, and when used for interpolation, they do not have the oscillatory behavior that is characteristic of high-degree polynomial interpolation.

703_Cubic Splines.png

The idea behind computing a cubic spline is as follows:

• Let s(x) = a(i) + b(i)*x + c(i)*x^2 + d(i)*x*3 for x(i-1)<= x <= x(i), i = 1,..,n

• This gives 4*n unknown coefficients. So, we need 4*n constraints to solve the problem.

• First we require (i) s(x(i)) = y(i) for i = 0,1,...,n

• Next we require (ii) s(x(i)+0) = s(x(i)-0); (iii) s'(x(i)+0) = s'(x(i)-0); (iv) s''(x(i)+0) = s''(x(i)-0) for i = 1,...,n-1

• This gives us n+1 constraints from (i) and 3(n-1) constraints from (ii)-(iv). Thus, we have 4n-2 constraints leaving 2 degrees of freedom for choosing the coefficients.

Detail algorithm and pseudo code can be found on https://blog.ivank.net/interpolation-with-cubic-splines.html .

Your programming tasks include:

1. Interactively define the initial control spline, i.e. end-users will use the mouse to click points on the screen to define the vertices of the cubic spline, and the program should draw the current natural cubic spline every time a vertex is defined. You are also required to use the motion callback function to generate "picking-and-moving" of control vertices

2. Receiving a character from keyboard as a keyboard event. The character invokes the following actions :

a. ‘q' or ‘Q': exit the program

b. ‘+' or ‘-': increase or decrease the interpolation steps between control points

3. Generate a menu for all of the above keyboard functionalities

4.

a. Keyboard event ‘d' and mouse-picking to delete an existing control vertex

b. Keyboard ‘ ' (space bar) to close the spline as a closed natural cubic spline

Homework 2: not complete and don't works well

The programming problem is based on Homework #1. Our goal is now to extend the 2-dimensional spline into full 3-dimensional space, with user interface elements to rotate and scale the 3D graphic scene. Other tasks include using cylinders to replace the original 2D line segments, with colors and materials.

Your programming tasks include:

1. Extend the original cubic spline algorithms into 3D. Your mouse will be able to pick and move the control points, moving in x-y plane with mouse pointer, and moving in z-direction with the support of a modifier key.

2. Implement a "rolling-ball" interface to rotate the scene in 3D with mouse. Implement a "zoom-in/out" interface with mouse motion and a modifier key.

3. Replacing the line segment with cylinders, adding appropriate colors and materials.

4. When the rolling ball interface receives mouse event with momentum, the rotation will be kept until another mouse click happens.

Homework 3: I need help to achieve that

The programming problem is based on Homework #2. Our goal is now to apply force-directed relaxation algorithm to refine the curve topology.

Two forces are used, an attractive "mechanical" force ( ) applied between adjacent beads on the same component and a repulsive "electrical" force ( ) applied between all other pairs of beads.

Your programming tasks include:

1. Implement the force model so that your sketched curves can be relaxed automatically to a refined shape.

2. Adding collision avoidance mechanism: during each iteration of shape refinement, check to determine if moving the bead to its desired location will cause the knot to move into an unsafe position. If so, bring the unsafe components apart to avoid collisions.

3. Adding a shadow to the 3D scene.

4. Implement view finding function, so that after each relaxation is done the system will rotate the curves into a position that users see the fewest intersections.

Reference no: EM13869135

Questions Cloud

How can i design a distributed shared memory over sockets : How can I design a distributed shared memory over sockets? Using two or more computers, i want project includedistributed system shared memory between to computer.
Inputs to maximize short-run profits : A price taking firm chooses its inputs to maximize short-run profits. Its Cobb-Douglass production function has the following form: q(L, K) = L ^(1/2)K^(1/3) . The output price is 1,000 per unit and the cost of each unit of input is 10. In the short-..
The angle between the direction of a and positive direction : The x and y components of a vector A are -25.0 m +40.0 m. respective y. What is the angle between the direction of A and positive direction of x?
Monopolist faces an inverse market demand : A monopolist faces an inverse market demand P(Q) = 200 − 1 2Q and a marginal cost of MC(Q) = 20 + Q. What is the unregulated monopolist’s optimal quantity? What would an appropriate regulatory instrument to bring this market back to efficiency? What ..
Generate menu for all of the given keyboard functionalities : Generate a menu for all of the above keyboard functionalities. Keyboard event ‘d' and mouse-picking to delete an existing control vertex
Expenditures under the grant and its billing to the state : To receive reimbursement, the district must submit quarterly reports showing its expenditures. Its expenditures for the quarter September through November 2012 were $ 450,000. Prepare separate journal entries to record its expenditures under the g..
Find the best response function for each firm : Two identical firms compete in competition (Cournot competition) in the same market where the inverse demand is P(Q) = 100 − Q. The constant marginal cost of both firms is 10. Find the best response function for each firm. (b) What is the Cournot (si..
What are the optimal quantity and price given the tax : The monopolist from the previous problem now faces a specific tax of 20, τ = 20. What are the optimal quantity and price given the tax? Calculate the welfare loss from the tax.
Discuss how a constructed wetland system works to treat : Discuss how a constructed wetland system works to treat municipal wastewater

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd