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 205027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:31:12+00:00 2026-05-11T17:31:12+00:00

Assuming I’m using some graphic API which allows me to draw bezier curves by

  • 0

Assuming I’m using some graphic API which allows me to draw
bezier curves by specifying the 4 necessary points:
start, end, two control points.

Can I reuse this function to draw x percent of the ‘original’ curve
(by adjusting the control points and the end point)?

Or is it impossible?

Unnecessary information, should someone care:

  • I need the whole thing to draw every n % of the original
    bezier curve
    with different color and/or line style
  • I’m using Java’s Path2D to draw bezier curves:

    Path2D p = new GeneralPath();
    p.moveTo(x1, y1);
    p.curveTo(bx1, by1, bx2, by2, x2, y2);
    g2.draw(p);
    
  • 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-11T17:31:13+00:00Added an answer on May 11, 2026 at 5:31 pm

    What you need is the De Casteljau algorithm. This will allow you to split your curve into whatever segments you’d like.

    However, since you’re dealing with just cubic curves, I’d like to suggest a slightly easier to use formulation that’ll give you a segment from t0 to t1 where 0 <= t0 <= t1 <= 1. Here’s some pseudocode:

    u0 = 1.0 - t0
    u1 = 1.0 - t1
    
    qxa =  x1*u0*u0 + bx1*2*t0*u0 + bx2*t0*t0
    qxb =  x1*u1*u1 + bx1*2*t1*u1 + bx2*t1*t1
    qxc = bx1*u0*u0 + bx2*2*t0*u0 +  x2*t0*t0
    qxd = bx1*u1*u1 + bx2*2*t1*u1 +  x2*t1*t1
    
    qya =  y1*u0*u0 + by1*2*t0*u0 + by2*t0*t0
    qyb =  y1*u1*u1 + by1*2*t1*u1 + by2*t1*t1
    qyc = by1*u0*u0 + by2*2*t0*u0 +  y2*t0*t0
    qyd = by1*u1*u1 + by2*2*t1*u1 +  y2*t1*t1
    
    xa = qxa*u0 + qxc*t0
    xb = qxa*u1 + qxc*t1
    xc = qxb*u0 + qxd*t0
    xd = qxb*u1 + qxd*t1
    
    ya = qya*u0 + qyc*t0
    yb = qya*u1 + qyc*t1
    yc = qyb*u0 + qyd*t0
    yd = qyb*u1 + qyd*t1
    

    Then just draw the Bézier curve formed by (xa,ya), (xb,yb), (xc,yc) and (xd,yd).

    Note that t0 and t1 are not exactly percentages of the curve distance but rather the curves parameter space. If you absolutely must have distance then things are much more difficult. Try this out and see if it does what you need.

    Edit: It’s worth noting that these equations simplify quite a bit if either t0 or t1 is 0 or 1 (i.e. you only want to trim from one side).

    Also, the relationship 0 <= t0 <= t1 <= 1 isn’t a strict requirement. For example t0 = 1 and t1 = 0 can be used to “flip” the curve backwards, or t0 = 0 and t1 = 1.5 could be used to extend the curve past the original end. However, the curve might look different than you expect if you try to extend it past the [0,1] range.

    Edit2: More than 3 years after my original answer, MvG pointed out an error in my equations. I forgot the last step (an extra linear interpolation to get the final control points). The equations above have been corrected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 109k
  • Answers 109k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer i personally think, a bubble chart is not really the… May 11, 2026 at 9:21 pm
  • Editorial Team
    Editorial Team added an answer A compiler. Edit: Or an emulator. Both very challenging. May 11, 2026 at 9:21 pm
  • Editorial Team
    Editorial Team added an answer The datatype:xml is the issue. I'm not sure where I… May 11, 2026 at 9:21 pm

Related Questions

Assuming I have only the class name of a generic as a string in
Assuming I have an open source web server or proxy I can enhance, let's
Assuming I'm trying to automate the installation of something on windows and I want
Assuming I have three tables : TableA (key, value) TableB (key, value) TableC (key,
Assuming I have a tree structure UL --LI ---INPUT (checkbox) And I want to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.