Interactive natural cubic spline

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

My project depends on previous homework because of that I posted all the questions to be clear, but the main project that I need help with is the homework3

Homework 1: Done and working great in the attachments
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.

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)
• 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:

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 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

Generate a menu for all of the above keyboard functionalities
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 with me in the attachments also

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:

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.
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.
Replacing the line segment with cylinders, adding appropriate colors and materials.
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 this part for now

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:

Implement the force model so that your sketched curves can be relaxed automatically to a refined shape.
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.

Adding a shadow to the 3D scene.

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.
I post all the homework because it is related to each others, but I need help with the assignment 3 for now

Specific requirements: 1. Don't use external libraries just opengl glut

the first homework is a correct code use the same math for hw 3
I upload some of professor demo use it to help you

Reference no: EM13939977

Questions Cloud

Uncertainties when unpredicting global climate change : Write examination question that you hope to answer it from the Digram. Do not include the anthroponcy in this. For example for the question you could talk about it (it is not necessary): What are the uncertainties when unpredicting global climate ..
Manufacture and retail own-branded barbecues and products : The first opportunity is to manufacture and retail own-branded barbecues and products. Manufacture would take place at a leased plant in India as BBQfun has no manufacturing capability. Also, manufacture in Australia would be too expensive.
Rewrittting codes in java : However, I am told the above code would not be written by an experienced Java programmer because the showMessageDialog method is static within the class. How would a pro would write it?
Application of revenue management in hospitality industry : In the past few years there has been a rapid development in the application of revenue management in the hospitality industry, and this can be supported by the volume of material published in this area.
Interactive natural cubic spline : My project depends on previous homework because of that I posted all the questions to be clear, but the main project that I need help with is the homework3
How many employee objects exist in the heap : Assume you have a class called Employee whose constructor takes two arguments: the employee's name and id number
Prepare a statement of cost of goods manufactured for april : Prepare a statement of cost of goods manufactured for April. Assume that the begin- ning balance in the raw materials account was $1,400 and that the beginning bal- ance in the work-in-process account was zero.
Write a payroll applicaion in java : The program should allow the user to enter information for any number of employees in this manner.
Discuss the critical points within service delivery process : Identify and discuss the critical points within the service delivery process that are likely to have a significant bearing on the customer's experience.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Analyze the time complexity and space complexity

Develop a simple prototype version of algorithm in C++. Specifically, you will build an in-place, order reversal algorithm - analyze the time complexity and space complexity of your algorithm

  Define a 2-element array of characters

Write an if statement that sets the variable age to 21 when the flag variable adult is set and define a 2-element array of characters named alpha initialized with the characters P, Q.

  Write a c++ statement that multiplies the value

Write a program that prompts the user to input a decimal number and outputs the number rounded to the nearest integer.

  Write a printf or scanf statement

Write a printf or scanf statement for each of the following:a. Print unsigned integer 40000 left justified in a 15-digit field with 8 digits.b. Read a hexadecimal value into variable hex.

  Write class player contains attributes for players name

Write a class player contains attributes for the player's name, average and team. write 3 functions to input change and display these attributes. also write a constructor that asks for input to initialize all the attributes

  Determine the manner in which each of the provided concepts

Provide a short code example of the use of C++ syntax within the context of an employee database and determine the manner in which each of the provided concepts relates to the concept of object-oriented programming.

  Find out if damjibhai can win

Once a jewel type is removed from the necklace, all other instances of the same jewel type is treated as polished by the person who removed the jewel

  When should an attribute of a class be static

Is there ever a reason to have a public attribute in a class?

  Determine the rate of heat loss from the absorber plate by

some at plate solar collectors change their tilt angle throughout the day in order to intercept the maximum amount of

  A constructor that constructs a rectangle2d

A constructor that constructs a Rectangle2D with specified points as coordinates.A no-argument constructor that creates the rectangle with points (0, 0), (5, 5) and (0, 5) and

  Farey fractions of level one

Write a program that for a number n entered by the user creates-by constantly extending it-a linked list of fractions at level n and then displays them.

  Write a program which allows the user to perform simple task

Write a program which allows the user to perform simple tasks on a calculator. A series of functions allows the user to select an operation to perform and then enter operands.

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