Code covered by the BSD License
-
FindBezierControlPointsND(p,v...
INPUT
-
Q=bezierInterp(P0,P1,P2,P3,va...
Bezier interpolation for given four control points.
-
[MatGlobalInterp]=BezierInter...
% Cubic Bezier interpolation of control points based on segmentation values of
-
[MatOut]=FindGivenRangeMatche...
i stands for index, v stands for value
-
[p0mat,p1mat,p2mat,p3mat,fbi,...
Approximation of data by Cubic Bezier Curves.
-
[p0mat,p1mat,p2mat,p3mat,tout...
% Find Cubic Bezier Control Points of given segments
-
[sqDistAry,indexAryGlobal]=Ma...
There are two matrices mat1 & mat2
-
[squaredmax,rowIndex]=MaxSqDi...
% find max. square distance and corresponding row index
-
ans=isvec(x)
return 1 if input argument is vecotor else return 0
-
plot2d_bz_org_intrp_cp(Mat,Ma...
% plot original data, interpolated data, control points of bezier curve
-
vout=getcolvector(vin)
% if vin is row vector change it to column vector then return it.
-
main.m
-
View all files
from
cubic Bezier least square fitting
by Dr. Murtaza Khan
Approximation of data using cubic Bezier curve least square fitting
|
| [sqDistAry,indexAryGlobal]=MaxSqDistAndInd4EachSegbw2Mat(mat1,mat2,segIndex)
|
% There are two matrices mat1 & mat2
% One can think each row of Mat as [w, x, y, z,....] i.e. each row have one
% point P=(w,x,y,z....) then mat1 and mat2 format is like following
% [P1;
% P2;
% P3;
% P4;
% ...
% PN];
% Points are segmented at indices stored in vector segIndex.
% For each segment this function finds maxium square distance and its
% corresponding golobal index (i.e. w.r.t mat1 rows (or mat2 same)).
% The algorithms is based on euclidean distance
function [sqDistAry,indexAryGlobal]=MaxSqDistAndInd4EachSegbw2Mat(mat1,mat2,segIndex)
sqDistAry=[];
indexAryGlobal=[];
for k=1:length(segIndex)-1
mat1Seg=mat1(segIndex(k):segIndex(k+1),:);
mat2Seg=mat2(segIndex(k):segIndex(k+1),:);
[squaredmaxLocal,indexLocal]=MaxSqDistAndRowIndexbw2Mat(mat1Seg,mat2Seg);
sqDistAry(k)=squaredmaxLocal;
indexGlobal=indexLocal+segIndex(k)-1;
indexAryGlobal(k)=indexGlobal;
end
% So original boundary points are stored in mat1 and interpolated boundary
% points (parametric values) are in mat2. segIndex have indices w.r.t to
% mat1 where we do segmentation of boundary (i.e. where essentially two
% corresopding points of mat1 and mat2 intersect.
% % % --------------------------------
% % % Author: Dr. Murtaza Khan
% % % Email : drkhanmurtaza@gmail.com
% % % --------------------------------
|
|
Contact us at files@mathworks.com