Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6538139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:42:04+00:00 2026-05-25T10:42:04+00:00

According to cairo example code , following code double x=25.6, y=128.0; double x1=102.4, y1=230.4,

  • 0

According to cairo example code, following code

double x=25.6,  y=128.0;
double x1=102.4, y1=230.4,
       x2=153.6, y2=25.6,
       x3=230.4, y3=128.0;

cairo_move_to (cr, x, y);
cairo_curve_to (cr, x1, y1, x2, y2, x3, y3);

cairo_set_line_width (cr, 10.0);
cairo_stroke (cr);

cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_set_line_width (cr, 6.0);
cairo_move_to (cr,x,y);   cairo_line_to (cr,x1,y1);
cairo_move_to (cr,x2,y2); cairo_line_to (cr,x3,y3);
cairo_stroke (cr);

can generate the curve and two pink lines.

enter image description here

But that need 4 points, (x,y), (x1,y1), (x2,y2), (x3,y3)

If I only have x,y and x3, y3 (start and end points of the curve),
is there any math formula to generate those pink lines without knowing x1,y1 and x2,y2?

Edit:

Its for the case that I generate the curve through following way.

cairo_move_to (cr, x, y);
cairo_curve_to (cr, x, y3, x3, y, x3, y3);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:42:04+00:00Added an answer on May 25, 2026 at 10:42 am

    Just make the points up:

    • start with your two known points, (x1,y1) and (x3,y3):

    enter image description here

    • join the two lines:

    enter image description here

    • create P2 as halfway between P1 and P3:

    enter image description here

    • now rotate P3 90° clockwise:

    enter image description here

    • do with same with P4, create it halfway between P1 and P3:

    enter image description here

    • rotate P4 90° clockwise:

    enter image description here

    • Now you have your four points, and can draw your bézier curve:

    enter image description here


    The midpoint can be calculated as:

    Pmid = (x1+x3)/2 , (y1+y3)/2

    double x1=25.6,  y1=128.0;
    double x3=153.6, y3=25.6;
    
    double xm = (x1+x3)/2;
    double ym = (y1+y3)/2;
    
    //rotate Pm by 90degrees around p1 to get p2
    double x2 = -(ym-y1) + y1;
    double y2 =  (xm-x1) + x1;
    
    //rotate Pm by 90degrees around p3 to get p4
    double x4 = -(ym-y3) + y3;
    double y4 =  (xm-x3) + x3;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to what I have found so far, I can use the following code:
According to the PHP docs, one can initialize properties in classes with the following
According to http://msdn.microsoft.com/en-us/library/ms535934(v=VS.85).aspx and http://msdn.microsoft.com/en-us/library/ms535262(v=VS.85).aspx , I should be able to do the following
According to this discussion , the iphone agreement says that it doesn't allow loading
According to the manual , git dcommit will create a revision in SVN for
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
According to MSDN form.RightToLeftLayout = True; form.RightToLeft = ifWeWantRTL() ? RightToLeft.True : RightToLeft.False; is
According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and
According to the answers to this question, I cannot embed a file version in
According to Wikipedia, on the Comparison of programming languages page, it says that F#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.