-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_butterfly_curve.m
15 lines (15 loc) · 2.03 KB
/
demo_butterfly_curve.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
%% Define
ControlPoints = [0.000000, 0.000000; 0.203000, 0.000000; 0.317800, -0.504800; 0.457800, -1.433600; 3.016400, -0.156200; 4.659200, 1.286600; 7.205600, 2.989000; 10.298600, 2.331000; 9.165000, -0.946200; 8.058800, -2.467200; 7.578200, -4.328600; 5.791200, -3.677800; 7.479200, -4.725400; 6.990800, -6.349600; 5.745000, -7.338400; 6.625800, -9.461800; 5.290600, -8.574400; 5.068200, -7.520800; 4.316400, -8.723600; 3.138200, -7.917600; 1.935800, -7.054800; 1.100200, -6.003400; 0.237600, -3.156000; 0.486600, -5.429000; 1.054600, -6.462200; 0.000000, -7.439800; -1.054600, -6.462200; -0.486600, -5.429000; -0.237600, -3.156000; -1.100200, -6.003400; -1.935800, -7.054800; -3.138200, -7.917600; -4.316400, -8.723600; -5.068200, -7.520800; -5.290600, -8.574400; -6.625800, -9.461800; -5.745000, -7.338400; -6.990800, -6.349600; -7.479200, -4.725400; -5.791200, -3.677800; -7.578200, -4.328600; -8.058800, -2.467200; -9.165000, -0.946200; -10.298600, 2.331000; -7.205600, 2.989000; -4.659200, 1.286600; -3.016400, -0.156200; -0.457800, -1.433600; -0.317800, -0.504800; -0.203000, 0.000000; 0.000000, 0.000000]';
Weights = [1.0, 1.0, 1.0, 1.2, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 1.0, 1.0, 5.0, 3.0, 1.0, 1.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.1, 1.0, 3.0, 5.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.2, 1.0, 1.0, 1.0];
Knot = [0, 0, 0, 0, 0.0083, 0.0150, 0.0361, 0.0855, 0.1293, 0.1509, 0.1931, 0.2273, 0.2435, 0.2561, 0.2692, 0.2889, 0.3170, 0.3316, 0.3482, 0.3553, 0.3649, 0.3837, 0.4005, 0.4269, 0.4510, 0.4660, 0.4891, 0.5000, 0.5109, 0.5340, 0.5489, 0.5731, 0.5994, 0.6163, 0.6351, 0.6447, 0.6518, 0.6683, 0.6830, 0.7111, 0.7307, 0.7439, 0.7565, 0.7729, 0.8069, 0.8491, 0.8707, 0.9145, 0.9639, 0.9850, 0.9917, 1.0, 1.0, 1.0, 1.0];
%%
us = linspace(0,1,10001);
Xu = nurbs_curve(ControlPoints,Knot,Weights,us);
% [Xu,dX,d2X,d3X] = nurbs_curve_and_derivatives(ControlPoints,Knot,Weights,us);
%%
figure
plot(Xu(1,:),Xu(2,:))
hold on
plot(ControlPoints(1,:),ControlPoints(2,:),'ro-')
hold off
axis equal