Using Quadratic Eq for a Half Circle

Does any math minded forumer know how to fit a
QuadCurve2D to half a circle?
I made an app to test it out but no matter where i placed the
three points i couldnt get a fit over a circle.
It seems like the sides always "slump" down too much.
The problem im trying to solve is...
I have three points on a half circle in 3D space (so, with x, y, z):
A start point, 90 degs, and 180 degrees.
I need to find a java curve that can connect those three points
in a "circle" type way.
Like i said before, quad never seemed to line up - though i
would have thought that was the way to do this.
And before anyone chimes in with "use arc"... this half circle will
be rotated in every which way in three space so im looking for a
curve that will connect those three points retaining shape.
Im thinking about just making the circle a hexagon and then rotating
the points and connecting the points for a jagged edge -
but id prefer not to do this.
Id appreciate any advice, Thanks!
i found a site with an applet to play with these curves
http://www.doc.ic.ac.uk/~dfg/AndysSplineTutorial/Quadratic.html

apparently this is as close as you will get to matching a bezier
curve to a half circle but its VERY damned close.
play around with the iterations for cool curve effects.
enjoy.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class BezierTest{
public static void main(String[] args) {
     new BezierTest();
public BezierTest(){
//     fr.addMouseListener(this);
//     fr.addMouseMotionListener(this);
     displayFrame();
public void displayFrame(){
     fr.setContentPane(panel);
     fr.pack();
     fr.setLocationRelativeTo(null);
     fr.show();
public class Panel extends JPanel{
public Panel(){
     this.setPreferredSize(new Dimension(500, 500));
     this.setBackground(Color.white);
public void paintComponent(Graphics gr){
     super.paintComponent(gr);
     Graphics2D g = (Graphics2D)gr;
     // Points
     Point P1 = new Point(50, 300);
     Point P2 = new Point(450, 300);
     Point C1 = new Point(50, 34);
     Point C2 = new Point(450, 34);
     // circle
     g.setPaint(Color.black);
     g.drawOval(50, 100, 400, 400);
     // real curve
     g.setPaint(Color.red);
     cc.setCurve(P1, C1, C2, P2);
     g.draw(cc);
     // iterated curve
     g.setPaint(Color.black);
     double x1 = P1.x;
     double y1 = P1.y;
     double x2;
     double y2;
     double z = .5;
//     for(double z = .1; z <= .5; z = z + .1){
     for(double t = 0; t <= 1; t = t + z){
     x2 =
     (P1.x + t * (-P1.x * 3 + t * (3 * P1.x - P1.x * t))) +
     t * (3 * C1.x + t * (-6 * C1.x + C1.x * 3 * t)) +
     t * t * (C2.x * 3 - C2.x * 3 * t) +
     P2.x * t * t * t;
     y2 =
     (P1.y + t * (-P1.y * 3 + t * (3 * P1.y - P1.y * t))) +
     t * (3 * C1.y + t * (-6 * C1.y + C1.y * 3 * t)) +
     t * t * (C2.y * 3 - C2.y * 3 * t) +
     P2.y * t * t * t;
System.out.println("X: " + x2);
System.out.println("Y: " + y2);
System.out.println("\n");
     g.drawLine((int)x1, (int)y1, (int)x2, (int)y2);
     x1 = x2;
     y1 = y2;
     CubicCurve2D cc = new CubicCurve2D.Double();
     JFrame fr = new JFrame("Bezier Test");
     Panel panel = new Panel();
}

Similar Messages

  • When I try to turn on my homesharing on apple TV it says that either my apple id doesn't exist or the password is wrong. However, I've been using the id for almost half a year and I even changed my password and it still wouldn't work. How do I fix this?

    When I try to turn on my homesharing on apple TV it says that either my apple id doesn't exist or the password is wrong. However, I've been using the id for almost half a year and I even changed my password and it still wouldn't work. What can I do to fix this?

    Not sure if this Term is Relevant towards an iPhone but, my iPhone won't Post unless if it's plugged into a Charger.

  • I have a mid-2009 MBP and I've been using my BOSE Companion 20 with it for about half a year now. It was fine until recently, when i want to adjust the volume using the pod on the BOSE Companion 20, it will cause like a surge in volume, spiking it up

    I have a mid-2009 MBP and I've been using my BOSE Companion 20 with it for about half a year now. It was fine until recently, when i want to adjust the volume using the pod on the BOSE Companion 20, it will cause like a surge in volume, spiking it up and down. It will not stablise itself! It's very fustrating. Anybody with the same issue?

    I have the BOSE Companion 5 speakers and have had the same problem. I've searched everywhere and gotten nowhere. My speakers are way past their warranty, so calling Bose would probably get me no where either. Only thing I can think of is that the speakers overheat which causes the spikes in the volume. I've tried unplugging them for a few minutes and then plug them back on. The problem does go away, but after about 5 minutes, same problem.

  • Looking for setting for multi color circle effect, that i have used with photoshop 11

    Looking for the setting for multi color circle effect for photoshop 11. I have used it before, but cant find it again. I was able to change the size  of the circle , and only had to pick one color it  did the multi color by its self.

    Do you mean photoshop elements 11 or photoshop cs4 (photoshop 11)?
    Anyway since you posted about photoshop elements 11 before.
    Select the Expert Mode
    Select the Brush Tool
    In the Tool Options under Brush Settings use the Hue Jitter
    (select different foreground and background colors at the bottom tool box)

  • We have 3 iphones in my family. With the new upgrade 5.1 all the batteries last for just half day in normal use. The same problems happens to a lot fo friends after the upgrade! Is it possible to remove the problem?? Thanks. Mauro, Italy.

    We have 3 iphones in my family. With the new upgrade 5.1 all the batteries last for just half day in normal use. The same problem happens t a lot of friends of mine after the upgrade. Is it possible to remove the problem??? Thanx!

    We have 3 iphones in my family. With the new upgrade 5.1 all the batteries last for just half day in normal use. The same problem happens t a lot of friends of mine after the upgrade. Is it possible to remove the problem??? Thanx!

  • HT203177 I have not backed up my computer using Time Machine since before I updated to Mavericks.  It has been "preparing backup" for a half hour at least and shows no indication of how long this may take.  Is something wrong?

    I have not backed up my computer using Time Machine since before I updated to Mavericks.  It has been "preparing backup" for a half hour at least and shows no indication of how long this may take.  Is something wrong?

    No. TM has to look through your entire drive contents and copy them all. This will take some time.
    Once the first backup is made, then subsequent backup will be much quicker, depending on how much data has changed since the last one.

  • How can I make a half-circle line?

    I'm finding I can do simple but marvelous graphics with Pages. One thing I would like to be able to do (in a particular graphic) is create a 'half' circle: as if I could take a standard Pages circle, remove the fill, and then ERASE one half of the remaining 'line' or 'stroke' circle (as one can easily do in Photoshop).
    Would someone know if this is even possible? Or what other app I might use to create a half circle on some kind of transparent bg that would import into my Pages layout document?
    Ben

    Though new to this discussion forum, I've read all the answers posted so far to your original question. Yet, another technique for drawing semicircles or other complicated figures can be suggested by taking a picture of a part of the screen that you select. To do this either use a keyboard shortcut (such as Cmnd Ctrl Shft 4) for copying a picture to the clipboard with the Finder or use a different shortcut (such as Cmnd Shft A) for saving a picture to the desktop with the Grab utility.
    The clipboard image can be pasted directly into Pages (use Cmnd V), but the desktop picture would need two steps (use Cmnd Shft V for selecting and inserting). While it may be possible to change the background transparency of a desktop picture, I have been able to satisfy my drawing needs so far simply by continuing to draw over the opaque images that have been pasted from the clipboard and then perhaps taking another picture. In either case, it is important to keep the selection handles of the final group as conservatively constrained as possible.

  • Creating half circle 3d in cs5 extended.

    hello.
    im trying to figure out how to make this image into a half circle using cs5 extended.
    i want both ends of wall to come around.
    ive gone into repousse-bend and other settings but i cant get the perfect half circle bend.
    any help would be very much appreciated.
    phil.

    thanks for the reply
    i will keep that in mind. it is a very helpful suggestion.
    thank you.

  • Bend to half circle in cs5 extended.

    hello all.
    how would i bend this wall into a half circle using repousse in cs5 extended.
    im trying to make the ends of the wall come around into a half circle.
    regards...phil.

    mylenium.
    you are a star.
    thank you very much for your help and replying.
    once again a big big big thank you.
    cheers.
    phil.

  • TS3623 I have been using apple TV for a 2+ years now an I just purchased several new TVshows that started in Sept 2013.  In the past shows I have not yet watched had a green dot by them, but now this does not exist and i forget which show i have already w

    I have been using apple tv for 2+ years and i just purchased several new shows that began in Sept 2013.  In the past, episodes I have not yet watched were marked with a green dot, but now that dot is not there. 

    Wow, Karan Taneja, you've just embarrassed yourself on a worldwide support forum.  Not only is your post ridiculous and completely inappropriate for a technical support forum, but it also shows your ignorance as to whom you think the audience is.  Apple is not here.  It's users, like you. 
    If you would have spent half the time actually reading the Terms of Use of this forum that YOU agreed to by signing up to post, as you did composing that usesless, inappropriate post, you (and the rest of us on this forum) would have been much better off.

  • Once I create a html5 animation using the 'Toolkit for CreateJS' in flash, how do I then insert it..

    Once I create a html5 animation using the 'Toolkit for CreateJS' in flash, how do I then insert it into a webpage via Dreamweaver:
    This has been sending me round in circles for over a week - can anyone let me know how I do this or can they point me in the direction of a tutorial?  Thank you in advance - d;-)

    There are some tutorials on Adobe site:
    <http://www.adobe.com/devnet/createjs/articles/getting-started.html>
    <http://tv.adobe.com/watch/adc-presents/toolkit-for-createjs-part-1-designing-game-assets/>
    <http://tv.adobe.com/watch/adc-presents/toolkit-for-createjs-part-2-adding-game-interactivi ty/>
    The parts 1 and 2 are videos about 10 minutes each while the first link is a detailed article that you can print and practice on your machine.
    Hope this helps.

  • After I type in my login details and press "enter" on a website, Firefox freezes for around half minute.

    After I type in my login details and press "enter" on a website, Firefox freezes for around half minute. This has gone on for around 5 months. I've tried disabling add-ons to my Firefox but they don't seem to affect this problem. My version is 17.0.1.
    How do I combat this problem? Many thanks in advance.

    Provide the website name.
    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • HT1222 I just wish we had a "backwards" half circle to hit when we need to go back one page.  Does anyone else feel the same way?  How did I find this page anyway?

    I just wish we had a "backwards" half circle to hit when we need to go back one page.  Does anyone else feel the same way?  How did I find this page anyway?

    how about you just swipe from left to right.  works for me.

  • Have been using 3.6 for a j d edwards programme new computer is w8 what is the best compatable d/load

    have been using 3.6 for a j d edwards programme new computer is w8 what is the best compatable d/load have loaded latest version however when jd Edwards loads when each section within jd Edwards is opened blue circle saying launching application but that is as far as I can get . Had this problem with xp but wasa ble to dload older version of fire fox but it appears that these olderr versions are no use with windows 8

    Windows 8 Professional supports virtual machines, so you could install Windows XP in a VM and then use that to host an older version of Firefox. This does not appear to be minor undertaking: [http://4sysops.com/archives/windows-8-xp-mode-part-1-hyper-v/ Windows 8 “XP Mode” – Part 1: Hyper-V - 4sysops].
    Can you run your JD Edwards app in IE10 in compatibility mode? If so, that's probably the simplest workaround. You still can use Firefox for other browsing.

  • Using Business area for External Reporting-Pros & Cons?

    Dear Freinds,
    We are a Retail Business Group half way through SAP IS Retail implementation. We have 8 legal entities, currently their complete Annual Financials are being made & audited separately. In SAP the structure is that there is Single Co. Code & transactions will be seggregated by Business Area (made manadatory for data entry) and Annual Accounts will be drawn up using Business Area.
    This to me does not seem to be the right structure. I have joined the group recently, I will be much thankful to you all if you please help me list the Pros & Cons of using Business Area for external reporting.
    Rajesh Agarwal
    [email protected]
    Edited by: Rajesh Agarwal on Jan 27, 2008 6:54 PM

    Dan: <i>For management reporting you may not want to post eliminations between companies where the business areas are the same.</i>
    If the Business wants to see the eliminations between companies, within the same business area, as part of BEx reports, what should I do? They do not want to execute consolidation functions in UCMON but just want to see how the eliminations have taken place between companies with in the same business area. 
    Dan: <i>As long as the partner company and partner business area are consistently included for the intercompany transactions, the eliminations between Legal and Management will agree at the top-level of each hierarchy.</i>
    Have I to introduce one more InfoObject Partner Business Area in the data basis and assign the role Sub-assignment once again?
    Thanks in advance.

Maybe you are looking for

  • How do i switch library from one apple id to another

    How do I switch my Ipod library from on apple ID to another Apple ID number.   I have two email address and my main Ipod library is under one email apple id #.

  • Problem to update bios on radeon 9600 pro

    hello everybody! i've got a radeon rx 9600 pro since yesterday. i installed live update 3 that tell me my graphic card does not support live update !!! I don't understand because it was in the same package. Is there anybody to explain me where is the

  • Playing videos on a MAC

    Just switched over to mac, sadly when it comes to video playback... it doesn't "just work" I was hoping that by migrating to Mac I will kiss all codec/program drama goodbye. What is the best way to go about playing all popular video files on a Mac. I

  • Color management, PS5 and Epson 3880

    Hi I need help with printing on my new 3880 through Photoshop CS5 on an iMac 10.6.8. Using Photoshop CS5 as 'color handling'-- the color mode is greyed out (can't change it) in the print settings. How can I change the color modes? Mostly turn off col

  • Error Code 57E when installing KB2863911

    Hello, I am getting Error Code 57E when using Windows Update. The only update that doesn't install is KB2863911. I am running Windows 7 64-bit and Office 2013 64-bit. Any advice would be appreciated. Thank you.