How to draw a bezier curve WITHOUT knowing its control points, but four points on the curve?
I am developing a graphical editor application. It has a Bezier tool. I want to implement it similar to the bezier control in Paint.NET application, where two handles of the curve (in addition to the end points) are placed on the curve itself, by which the user can control the curvature. Placement of these handles on the curve, gives a better sense and feel to the graphist, as is shown in this figure:
But my problem is that DrawBezier method in .NET, gets two control points that are not guaranteed to be always placed on the curve.
Do you know how can I use the coordinates of these two on-curve handles to draw a Bezier?
.net graphics bezier
|
show 2 more comments
I am developing a graphical editor application. It has a Bezier tool. I want to implement it similar to the bezier control in Paint.NET application, where two handles of the curve (in addition to the end points) are placed on the curve itself, by which the user can control the curvature. Placement of these handles on the curve, gives a better sense and feel to the graphist, as is shown in this figure:
But my problem is that DrawBezier method in .NET, gets two control points that are not guaranteed to be always placed on the curve.
Do you know how can I use the coordinates of these two on-curve handles to draw a Bezier?
.net graphics bezier
If the parameter values (roughly equivalent to the distance along the curve) of these points are unknown, then you have 4 equations with 6 unknowns (in 2D), which is under-determined i.e. there are infinitely many Bezier curves that fit these 4 points. In Paint.NET these points probably correspond to known parameters e.g.t=1/3andt=2/3, in which case the problem is deterministic and the curve equation can be solved to obtain the control points.
– meowgoesthedog
Dec 28 '18 at 13:58
@meowgoesthedog Would you please specify those 6 equations?
– dghadagh
Dec 28 '18 at 14:42
1
Okay, after some digging into OpenPDN (the open-source fork of Paint.NET), it seems that the curve in question is in-fact not a cubic Bezier, but an interpolated cubic spline. Their implementation draws the curve "manually" as a series of straight lines. Go to github.com/rivy/OpenPDN and search forSplineInterpolator. Paint.NET does use Bezier curves elsewhere, but they are drawn by direct calls to GDI+ which require control points, and nowhere are these control points being computed.
– meowgoesthedog
Dec 28 '18 at 15:06
1
You can handle your points as interpolation cubic curve (or catmul rom) ... using this interpolation -> Bezier you simply convert the points into BEZIER control points. However you need to use parametert=<-1,+1>or use 3 BEZIER patches instead (by mirroring the missing control points) ... however such conversion might not copy the curve exactly ...
– Spektre
Dec 29 '18 at 10:55
1
You can use standard polynomial curve fitting (see pomax.github.io/bezierinfo/#curvefitting for instance, yielding the pretty similar looking i.imgur.com/HOjp4lh.png) but you're always going to have some free parameters because you don't just "not know the control points", you also don't know which time values those two on-curve points you do have belong to.
– Mike 'Pomax' Kamermans
Dec 29 '18 at 21:36
|
show 2 more comments
I am developing a graphical editor application. It has a Bezier tool. I want to implement it similar to the bezier control in Paint.NET application, where two handles of the curve (in addition to the end points) are placed on the curve itself, by which the user can control the curvature. Placement of these handles on the curve, gives a better sense and feel to the graphist, as is shown in this figure:
But my problem is that DrawBezier method in .NET, gets two control points that are not guaranteed to be always placed on the curve.
Do you know how can I use the coordinates of these two on-curve handles to draw a Bezier?
.net graphics bezier
I am developing a graphical editor application. It has a Bezier tool. I want to implement it similar to the bezier control in Paint.NET application, where two handles of the curve (in addition to the end points) are placed on the curve itself, by which the user can control the curvature. Placement of these handles on the curve, gives a better sense and feel to the graphist, as is shown in this figure:
But my problem is that DrawBezier method in .NET, gets two control points that are not guaranteed to be always placed on the curve.
Do you know how can I use the coordinates of these two on-curve handles to draw a Bezier?
.net graphics bezier
.net graphics bezier
edited Dec 30 '18 at 18:49
Mike 'Pomax' Kamermans
27.5k65797
27.5k65797
asked Dec 28 '18 at 12:37
dghadaghdghadagh
4111
4111
If the parameter values (roughly equivalent to the distance along the curve) of these points are unknown, then you have 4 equations with 6 unknowns (in 2D), which is under-determined i.e. there are infinitely many Bezier curves that fit these 4 points. In Paint.NET these points probably correspond to known parameters e.g.t=1/3andt=2/3, in which case the problem is deterministic and the curve equation can be solved to obtain the control points.
– meowgoesthedog
Dec 28 '18 at 13:58
@meowgoesthedog Would you please specify those 6 equations?
– dghadagh
Dec 28 '18 at 14:42
1
Okay, after some digging into OpenPDN (the open-source fork of Paint.NET), it seems that the curve in question is in-fact not a cubic Bezier, but an interpolated cubic spline. Their implementation draws the curve "manually" as a series of straight lines. Go to github.com/rivy/OpenPDN and search forSplineInterpolator. Paint.NET does use Bezier curves elsewhere, but they are drawn by direct calls to GDI+ which require control points, and nowhere are these control points being computed.
– meowgoesthedog
Dec 28 '18 at 15:06
1
You can handle your points as interpolation cubic curve (or catmul rom) ... using this interpolation -> Bezier you simply convert the points into BEZIER control points. However you need to use parametert=<-1,+1>or use 3 BEZIER patches instead (by mirroring the missing control points) ... however such conversion might not copy the curve exactly ...
– Spektre
Dec 29 '18 at 10:55
1
You can use standard polynomial curve fitting (see pomax.github.io/bezierinfo/#curvefitting for instance, yielding the pretty similar looking i.imgur.com/HOjp4lh.png) but you're always going to have some free parameters because you don't just "not know the control points", you also don't know which time values those two on-curve points you do have belong to.
– Mike 'Pomax' Kamermans
Dec 29 '18 at 21:36
|
show 2 more comments
If the parameter values (roughly equivalent to the distance along the curve) of these points are unknown, then you have 4 equations with 6 unknowns (in 2D), which is under-determined i.e. there are infinitely many Bezier curves that fit these 4 points. In Paint.NET these points probably correspond to known parameters e.g.t=1/3andt=2/3, in which case the problem is deterministic and the curve equation can be solved to obtain the control points.
– meowgoesthedog
Dec 28 '18 at 13:58
@meowgoesthedog Would you please specify those 6 equations?
– dghadagh
Dec 28 '18 at 14:42
1
Okay, after some digging into OpenPDN (the open-source fork of Paint.NET), it seems that the curve in question is in-fact not a cubic Bezier, but an interpolated cubic spline. Their implementation draws the curve "manually" as a series of straight lines. Go to github.com/rivy/OpenPDN and search forSplineInterpolator. Paint.NET does use Bezier curves elsewhere, but they are drawn by direct calls to GDI+ which require control points, and nowhere are these control points being computed.
– meowgoesthedog
Dec 28 '18 at 15:06
1
You can handle your points as interpolation cubic curve (or catmul rom) ... using this interpolation -> Bezier you simply convert the points into BEZIER control points. However you need to use parametert=<-1,+1>or use 3 BEZIER patches instead (by mirroring the missing control points) ... however such conversion might not copy the curve exactly ...
– Spektre
Dec 29 '18 at 10:55
1
You can use standard polynomial curve fitting (see pomax.github.io/bezierinfo/#curvefitting for instance, yielding the pretty similar looking i.imgur.com/HOjp4lh.png) but you're always going to have some free parameters because you don't just "not know the control points", you also don't know which time values those two on-curve points you do have belong to.
– Mike 'Pomax' Kamermans
Dec 29 '18 at 21:36
If the parameter values (roughly equivalent to the distance along the curve) of these points are unknown, then you have 4 equations with 6 unknowns (in 2D), which is under-determined i.e. there are infinitely many Bezier curves that fit these 4 points. In Paint.NET these points probably correspond to known parameters e.g.
t=1/3 and t=2/3, in which case the problem is deterministic and the curve equation can be solved to obtain the control points.– meowgoesthedog
Dec 28 '18 at 13:58
If the parameter values (roughly equivalent to the distance along the curve) of these points are unknown, then you have 4 equations with 6 unknowns (in 2D), which is under-determined i.e. there are infinitely many Bezier curves that fit these 4 points. In Paint.NET these points probably correspond to known parameters e.g.
t=1/3 and t=2/3, in which case the problem is deterministic and the curve equation can be solved to obtain the control points.– meowgoesthedog
Dec 28 '18 at 13:58
@meowgoesthedog Would you please specify those 6 equations?
– dghadagh
Dec 28 '18 at 14:42
@meowgoesthedog Would you please specify those 6 equations?
– dghadagh
Dec 28 '18 at 14:42
1
1
Okay, after some digging into OpenPDN (the open-source fork of Paint.NET), it seems that the curve in question is in-fact not a cubic Bezier, but an interpolated cubic spline. Their implementation draws the curve "manually" as a series of straight lines. Go to github.com/rivy/OpenPDN and search for
SplineInterpolator. Paint.NET does use Bezier curves elsewhere, but they are drawn by direct calls to GDI+ which require control points, and nowhere are these control points being computed.– meowgoesthedog
Dec 28 '18 at 15:06
Okay, after some digging into OpenPDN (the open-source fork of Paint.NET), it seems that the curve in question is in-fact not a cubic Bezier, but an interpolated cubic spline. Their implementation draws the curve "manually" as a series of straight lines. Go to github.com/rivy/OpenPDN and search for
SplineInterpolator. Paint.NET does use Bezier curves elsewhere, but they are drawn by direct calls to GDI+ which require control points, and nowhere are these control points being computed.– meowgoesthedog
Dec 28 '18 at 15:06
1
1
You can handle your points as interpolation cubic curve (or catmul rom) ... using this interpolation -> Bezier you simply convert the points into BEZIER control points. However you need to use parameter
t=<-1,+1> or use 3 BEZIER patches instead (by mirroring the missing control points) ... however such conversion might not copy the curve exactly ...– Spektre
Dec 29 '18 at 10:55
You can handle your points as interpolation cubic curve (or catmul rom) ... using this interpolation -> Bezier you simply convert the points into BEZIER control points. However you need to use parameter
t=<-1,+1> or use 3 BEZIER patches instead (by mirroring the missing control points) ... however such conversion might not copy the curve exactly ...– Spektre
Dec 29 '18 at 10:55
1
1
You can use standard polynomial curve fitting (see pomax.github.io/bezierinfo/#curvefitting for instance, yielding the pretty similar looking i.imgur.com/HOjp4lh.png) but you're always going to have some free parameters because you don't just "not know the control points", you also don't know which time values those two on-curve points you do have belong to.
– Mike 'Pomax' Kamermans
Dec 29 '18 at 21:36
You can use standard polynomial curve fitting (see pomax.github.io/bezierinfo/#curvefitting for instance, yielding the pretty similar looking i.imgur.com/HOjp4lh.png) but you're always going to have some free parameters because you don't just "not know the control points", you also don't know which time values those two on-curve points you do have belong to.
– Mike 'Pomax' Kamermans
Dec 29 '18 at 21:36
|
show 2 more comments
2 Answers
2
active
oldest
votes
We can use standard polynomial curve fitting to find a single cubic Bezier curve through any set of four points, but you're always going to be left with a free parameter problem: two of the points are going to be the start and end of the curve, so we know their time values are 0 and 1, but the two points are entirely free in terms of time value, and so you're going to have to come up with a reasonable assumption on what they should be before you can evaluate your curve fit.
See https://pomax.github.io/bezierinfo/#curvefitting for the maths if you want to implement this yourself, or find a library that does polynomial fitting (which means any half-decent statistics package), and then for timing values you have a few options:
- Assume the points line up with t=0, t=1/3, t=2/3, and t=1. This is almost always a bad idea because points are rarely evenly spaced with respects to the cubic distribution.
- Guess the t values based on linear distance, with the full length of the polyline p0-p1-p2-p3 set to 1, and the value at each point simply equal to the distance along the polyline, so t0=0, t1=dist(p0,p1), t2=dist(p0,p1)+dist(p1,2), t3=1.
- Get fancier and pick an initial set of t values, then analyze the resulting Bezier and iteratively generate new curves, optimizing on some quality like curvature homogeneity, bounding box/hull area, aligning p1/p2 on minimum radius, etc.
Of these, obviously 2 is going to give "reasonable" results with the least amount of effort, but if you're writing a graphics application, "reasonable" depends on what your users need, not what is easy for you.
add a comment |
The DrawCurve method of the Graphics class does the job. That is, instead of using Bezier curves, you should use Canonical Spline.
I found it in Charles Petzold's book (Programming Windows with C#):
"The Canonical Spline - The Graphic class includes a second type of spline called the canonical spline, meaning a standard or normal spline..."
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53958748%2fhow-to-draw-a-bezier-curve-without-knowing-its-control-points-but-four-points-o%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
We can use standard polynomial curve fitting to find a single cubic Bezier curve through any set of four points, but you're always going to be left with a free parameter problem: two of the points are going to be the start and end of the curve, so we know their time values are 0 and 1, but the two points are entirely free in terms of time value, and so you're going to have to come up with a reasonable assumption on what they should be before you can evaluate your curve fit.
See https://pomax.github.io/bezierinfo/#curvefitting for the maths if you want to implement this yourself, or find a library that does polynomial fitting (which means any half-decent statistics package), and then for timing values you have a few options:
- Assume the points line up with t=0, t=1/3, t=2/3, and t=1. This is almost always a bad idea because points are rarely evenly spaced with respects to the cubic distribution.
- Guess the t values based on linear distance, with the full length of the polyline p0-p1-p2-p3 set to 1, and the value at each point simply equal to the distance along the polyline, so t0=0, t1=dist(p0,p1), t2=dist(p0,p1)+dist(p1,2), t3=1.
- Get fancier and pick an initial set of t values, then analyze the resulting Bezier and iteratively generate new curves, optimizing on some quality like curvature homogeneity, bounding box/hull area, aligning p1/p2 on minimum radius, etc.
Of these, obviously 2 is going to give "reasonable" results with the least amount of effort, but if you're writing a graphics application, "reasonable" depends on what your users need, not what is easy for you.
add a comment |
We can use standard polynomial curve fitting to find a single cubic Bezier curve through any set of four points, but you're always going to be left with a free parameter problem: two of the points are going to be the start and end of the curve, so we know their time values are 0 and 1, but the two points are entirely free in terms of time value, and so you're going to have to come up with a reasonable assumption on what they should be before you can evaluate your curve fit.
See https://pomax.github.io/bezierinfo/#curvefitting for the maths if you want to implement this yourself, or find a library that does polynomial fitting (which means any half-decent statistics package), and then for timing values you have a few options:
- Assume the points line up with t=0, t=1/3, t=2/3, and t=1. This is almost always a bad idea because points are rarely evenly spaced with respects to the cubic distribution.
- Guess the t values based on linear distance, with the full length of the polyline p0-p1-p2-p3 set to 1, and the value at each point simply equal to the distance along the polyline, so t0=0, t1=dist(p0,p1), t2=dist(p0,p1)+dist(p1,2), t3=1.
- Get fancier and pick an initial set of t values, then analyze the resulting Bezier and iteratively generate new curves, optimizing on some quality like curvature homogeneity, bounding box/hull area, aligning p1/p2 on minimum radius, etc.
Of these, obviously 2 is going to give "reasonable" results with the least amount of effort, but if you're writing a graphics application, "reasonable" depends on what your users need, not what is easy for you.
add a comment |
We can use standard polynomial curve fitting to find a single cubic Bezier curve through any set of four points, but you're always going to be left with a free parameter problem: two of the points are going to be the start and end of the curve, so we know their time values are 0 and 1, but the two points are entirely free in terms of time value, and so you're going to have to come up with a reasonable assumption on what they should be before you can evaluate your curve fit.
See https://pomax.github.io/bezierinfo/#curvefitting for the maths if you want to implement this yourself, or find a library that does polynomial fitting (which means any half-decent statistics package), and then for timing values you have a few options:
- Assume the points line up with t=0, t=1/3, t=2/3, and t=1. This is almost always a bad idea because points are rarely evenly spaced with respects to the cubic distribution.
- Guess the t values based on linear distance, with the full length of the polyline p0-p1-p2-p3 set to 1, and the value at each point simply equal to the distance along the polyline, so t0=0, t1=dist(p0,p1), t2=dist(p0,p1)+dist(p1,2), t3=1.
- Get fancier and pick an initial set of t values, then analyze the resulting Bezier and iteratively generate new curves, optimizing on some quality like curvature homogeneity, bounding box/hull area, aligning p1/p2 on minimum radius, etc.
Of these, obviously 2 is going to give "reasonable" results with the least amount of effort, but if you're writing a graphics application, "reasonable" depends on what your users need, not what is easy for you.
We can use standard polynomial curve fitting to find a single cubic Bezier curve through any set of four points, but you're always going to be left with a free parameter problem: two of the points are going to be the start and end of the curve, so we know their time values are 0 and 1, but the two points are entirely free in terms of time value, and so you're going to have to come up with a reasonable assumption on what they should be before you can evaluate your curve fit.
See https://pomax.github.io/bezierinfo/#curvefitting for the maths if you want to implement this yourself, or find a library that does polynomial fitting (which means any half-decent statistics package), and then for timing values you have a few options:
- Assume the points line up with t=0, t=1/3, t=2/3, and t=1. This is almost always a bad idea because points are rarely evenly spaced with respects to the cubic distribution.
- Guess the t values based on linear distance, with the full length of the polyline p0-p1-p2-p3 set to 1, and the value at each point simply equal to the distance along the polyline, so t0=0, t1=dist(p0,p1), t2=dist(p0,p1)+dist(p1,2), t3=1.
- Get fancier and pick an initial set of t values, then analyze the resulting Bezier and iteratively generate new curves, optimizing on some quality like curvature homogeneity, bounding box/hull area, aligning p1/p2 on minimum radius, etc.
Of these, obviously 2 is going to give "reasonable" results with the least amount of effort, but if you're writing a graphics application, "reasonable" depends on what your users need, not what is easy for you.
answered Dec 30 '18 at 18:58
Mike 'Pomax' KamermansMike 'Pomax' Kamermans
27.5k65797
27.5k65797
add a comment |
add a comment |
The DrawCurve method of the Graphics class does the job. That is, instead of using Bezier curves, you should use Canonical Spline.
I found it in Charles Petzold's book (Programming Windows with C#):
"The Canonical Spline - The Graphic class includes a second type of spline called the canonical spline, meaning a standard or normal spline..."
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
add a comment |
The DrawCurve method of the Graphics class does the job. That is, instead of using Bezier curves, you should use Canonical Spline.
I found it in Charles Petzold's book (Programming Windows with C#):
"The Canonical Spline - The Graphic class includes a second type of spline called the canonical spline, meaning a standard or normal spline..."
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
add a comment |
The DrawCurve method of the Graphics class does the job. That is, instead of using Bezier curves, you should use Canonical Spline.
I found it in Charles Petzold's book (Programming Windows with C#):
"The Canonical Spline - The Graphic class includes a second type of spline called the canonical spline, meaning a standard or normal spline..."
The DrawCurve method of the Graphics class does the job. That is, instead of using Bezier curves, you should use Canonical Spline.
I found it in Charles Petzold's book (Programming Windows with C#):
"The Canonical Spline - The Graphic class includes a second type of spline called the canonical spline, meaning a standard or normal spline..."
answered Dec 28 '18 at 17:40
dghadaghdghadagh
4111
4111
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
add a comment |
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
Can you show some code that demonstrates that this indeed does the job? Otherwise this is more of a comment than an answer.
– Mike 'Pomax' Kamermans
Dec 30 '18 at 18:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53958748%2fhow-to-draw-a-bezier-curve-without-knowing-its-control-points-but-four-points-o%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If the parameter values (roughly equivalent to the distance along the curve) of these points are unknown, then you have 4 equations with 6 unknowns (in 2D), which is under-determined i.e. there are infinitely many Bezier curves that fit these 4 points. In Paint.NET these points probably correspond to known parameters e.g.
t=1/3andt=2/3, in which case the problem is deterministic and the curve equation can be solved to obtain the control points.– meowgoesthedog
Dec 28 '18 at 13:58
@meowgoesthedog Would you please specify those 6 equations?
– dghadagh
Dec 28 '18 at 14:42
1
Okay, after some digging into OpenPDN (the open-source fork of Paint.NET), it seems that the curve in question is in-fact not a cubic Bezier, but an interpolated cubic spline. Their implementation draws the curve "manually" as a series of straight lines. Go to github.com/rivy/OpenPDN and search for
SplineInterpolator. Paint.NET does use Bezier curves elsewhere, but they are drawn by direct calls to GDI+ which require control points, and nowhere are these control points being computed.– meowgoesthedog
Dec 28 '18 at 15:06
1
You can handle your points as interpolation cubic curve (or catmul rom) ... using this interpolation -> Bezier you simply convert the points into BEZIER control points. However you need to use parameter
t=<-1,+1>or use 3 BEZIER patches instead (by mirroring the missing control points) ... however such conversion might not copy the curve exactly ...– Spektre
Dec 29 '18 at 10:55
1
You can use standard polynomial curve fitting (see pomax.github.io/bezierinfo/#curvefitting for instance, yielding the pretty similar looking i.imgur.com/HOjp4lh.png) but you're always going to have some free parameters because you don't just "not know the control points", you also don't know which time values those two on-curve points you do have belong to.
– Mike 'Pomax' Kamermans
Dec 29 '18 at 21:36