this is the code that i managed to write after reading for a while.

CubicCurve2D cubic = new CubicCurve2D.Double (20.0, 200.0, 200.0,270.0, 30.0,30.0, 250.0, 170);
 Graphics2D g2 = (Graphics2D) g; 


and this is the output,


Now, like u have seen , everything works fine, i get my output and am happy, but there still exists doubt about which control point controls what area of the curve bcoz i completed this by trial and error . i have a vague idea but i need to be sure before i present it in front of the class.
So please help in explaining how the x1, y1 , y1,y2 etc points control the curve and how with respect to the co-ordinates i have used in my codes.

thanks for reading this post.

you can check here,
ctrlx and ctrly means a control point's x and y coordinates...

thnx for the link. i see the control point. But what i dont understand is how would the curve get affected if i move the control point to the left/right/top/bottom . how would it change the curve ?:sad:

well, if you move control points far away from your original points, your curve bends more.

you can draw normal lines with the points that you use for cubicCurve, so that you can see both control points and how the curve bends

hope that helps...

commented: very helpful +1

thank you. that helped alot.:lol:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.