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

  • SEARCH
  • Home
  • 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 8562059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:38:47+00:00 2026-06-11T16:38:47+00:00

I’ve got some primitive version of bezier curve drawing routine, here it is void

  • 0

I’ve got some primitive version of bezier curve drawing
routine, here it is

void DrawBezier(float ax, float ay,
            float bx, float by,
            float cx, float cy,
            float dx, float dy, unsigned color)
{
    float step = 1.0/1000.0;

    for(float t=0; t<=1; t+=step)
    {
    float u = 1.0-t;

    float a =     u*u*u;
    float b = 3.0*u*u*t;
    float c = 3.0*u*t*t;
    float d =     t*t*t;

    float x = ax*a + bx*b + cx*c + dx*d;
    float y = ay*a + by*b + cy*c + dy*d;

    SetPixel(int(x),int(y), color);

    }

}

This is terribly slow because of slow float->int casting,
at least on my old pentium 4 (such casting consumes 90% of time here
really, 3k beziers/second versus 30k beziers/s when setpixel is commented).

So I got an idea to rewrite it to fixed point arthimetic but I am not
much experienced with this – how to rewrite it to fixed point?
(notice that t is in the range of 0.0 to 1.0 )

EDIT:
The second part of question: how to estimate the length of bezier
curve in pixels (pixels need to be drawn)? Got no idea

  • 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-06-11T16:38:48+00:00Added an answer on June 11, 2026 at 4:38 pm

    Allrite I ve done it such way

        void DrawBezierFX( int ax, int ay,
                   int bx, int by,
                   int cx, int cy,
                   int dx, int dy, unsigned color)
        {
    
        for(unsigned i=0; i<=1024; i+=1)
        {
         unsigned t = i<<5;
    
         unsigned u = (1024-i)<<5;
    
         unsigned a = ((((u*u)>>15)*u)>>15);
         unsigned b = ((((t*u)>>15)*u)>>15)*3;
         unsigned c = ((((t*t)>>15)*u)>>15)*3;
         unsigned d = ((((t*t)>>15)*t)>>15);
    
    
         int x = ax*a + bx*b + cx*c + dx*d;
         int y = ay*a + by*b + cy*c + dy*d;
    
         SetPixel(x>>15 ,y>>15, color);
    
         }
    
         }
    

    It is 3.5 x faster becouse of no float to int conversions.
    When I measured times of calculations it is about 115 ms
    versus 80 ms, (3k of it and on my old processor), so ints
    are not so much faster here (aqbout 30% only :O )

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
i got an object with contents of html markup in it, for example: string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.