Question: import java.util. * ; import javax.swing. * ; import java.awt.image. * ; import java.awt. * ; class Bezier extends JApplet { BufferedImage image = new
import java.util.;
import javax.swing.;
import java.awt.image.;
import java.awt.;
class Bezier extends JApplet
BufferedImage image new BufferedImage BufferedImage.TYPEINTARGB;
WritableRaster raster image.getRaster;
private final double controlPoints;
private final double steps;
Bezierdouble controPoints int steps
this.controlPoints controPoints;
this.steps steps;
public void init
setSize;
repaint;
int computePointfloat u
float cccc;
cu uu uuu;
cu uu uuu;
cuu uuu;
c uuu;
int ptx intc controlPoints c controlPoints c controlPoints c controlPoints;
int pty intc controlPoints c controlPoints c controlPoints c controlPoints;
int ptsptx pty;
return pts;
public void paintGraphics g
int prevPointx ;
int prevPointy ;
int color;
forint i ; i steps; i
int pts computePointifloatsteps;
int x pts;
int y pts;
ifi
gdrawLineprevPointx prevPointy, x y;
prevPointx x;
prevPointy y;
raster.setPixelx ycolor;
gdrawImageimage null;
public class Main
public static void mainString args
Scanner input new java.util.ScannerSystemin;
double points new double;
System.out.printlnEnter p p p p x and y coordinates respectively";
forint i ; i points.length; i
pointsi input.nextInt;
pointsi input.nextInt;
System.out.printEnter how many steps to do: ;
int steps input.nextInt;
JFrame frame new JFrameBezier Cubic Spline";
frame.setDefaultCloseOperationJFrameEXITONCLOSE;
Bezier curve new Bezierpoints steps;
curve.setPreferredSizenew Dimension;
frame.addcurve;
frame.pack;
frame.setVisibletrue;
based on the prev code we need to do this:
Write a program to draw curves sing Beizer curve for P P control points and P P tangent vectors
Modify the above program along with the curve add an object shape of the ball at the end of the point P using D graphics.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
