File:Tangente par Bezier cubique.svg
Original file (SVG file, nominally 320 × 600 pixels, file size: 1 KB)
Captions
Summary
[edit]DescriptionTangente par Bezier cubique.svg |
Français : Fonction tangentee approchée par une courbe de Bézier cubique (chemin SVG). NB : une courbe de Bézier quadratique ne donne pas une approximation satisfaisante.
English: Tangent function approximated by a quadraticic Bézier curve (SVG path). NB: a quadratic Bézier curve does not give a satisfying approximation. |
Date | |
Source | Own work |
Author | Cdang |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="320px" height="600px" version="1.1"
viewBox="0 0 320 200"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title> Titre </title>
<desc> Description </desc>
<defs>
<style type="text/css"><![CDATA[
path {
fill: none;
stroke: black;
stroke-width: 1
}
]]></style>
</defs>
<g id="tangenteC" transform="scale(0.5093, -0.5) translate(157.1, -100)">
<path
id="c1"
d="M0 0
C113.4 105.6, 129.7 192.5, 141.4 631.4"
/>
<use xlink:href="#c1"
transform="translate(0, 0) scale(-1, -1)" />
</g>
</svg>
The control points are obtained by optimisation, using Scilab:
n=10;
t = linspace(0, 1, n+1);
t($) = [];
x = %pi/2*t;
y = tan(x);
P0C = [x(1) ; y(1)] ;
P3C = [x($) ; y($)];
P1initC = 1/3*(P0 + P2);
P2initC = 2/3*(P0 + P2);
P12initC = [P1initC, P2initC];
// ****************************
// * Courbe de Bézier cubique *
// ****************************
function [X] = bezierC(P, t)
unMoinsT = [1 ; 1]*(1 - t);
tMat = [1 ; 1]*t;
tMat2 = tMat.*tMat;
tMat3 = tMat2.*tMat;
unVec = ones(t);
P0 = P(:, 1)*unVec;
P1 = P(:, 2)*unVec;
P2 = P(:, 3)*unVec;
P3 = P(:, 4)*unVec;
X = ((P0.*unMoinsT + 3*P1.*tMat).*unMoinsT + 3*P2.*tMat2).*unMoinsT...
+ P3.*tMat3;
endfunction
function [f] = diffquadC(P)
X = bezierC(P, t);
x = X(1, :); ybez = X(2, :); ytan = tan(x);
difference = ybez-ytan;
f = sum(difference.*difference);
endfunction
function [f, g, ind] = costfC(P12, ind)
epsilon = 1e-3;
P = [P0C, P12, P3C];
f = diffquadC(P);
g = zeros(P1);
for i = 1:4;
epsilonMat = zeros(P12);
epsilonMat(i) = epsilon;
dP = P + [[0 ; 0], epsilonMat, [0 ; 0]];
g(i) = diffquadC(dP)-f;
end
endfunction
// ***********************
// * programme principal *
// ***********************
[foptC, P12optC] = optim(costfC, P12initC);
PoptC = [P0C, P12optC, P3C];
X = bezierC(PoptC, t);
x1=linspace(0, X(1, $), 100);
y1 = tan(x1);
scf(1);
clf();
plot(X(1 ,:), X(2, :), "+");
plot(x1, y1, "g");
Licensing
[edit]This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. | |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 00:35, 1 December 2018 | 320 × 600 (1 KB) | Cdang (talk | contribs) | better size, +axes | |
17:18, 29 November 2018 | 320 × 600 (830 bytes) | Cdang (talk | contribs) | User created page with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Short title | Tangente par Bézier cubique |
---|---|
Image title | Courbe de Bézier cubique approchant au mieux la fonction tangente |
Width | 320px |
Height | 600px |