bezierans1.mw

>

with(plots): with(plottools):

 

>

lerp := proc(p,q,r,s,t)

  local R; R:= (s - t)/(s - r)*p + (t - r)/(s - r)*q;  end:

 

>

badecas:=proc(L,r,s) local i, b;

b:=L;

for i from 1 to nops(L)-1 do

b:=seq( lerp(b[j], b[j+1], r,s,t), j=1..nops(L)-i);

od;

 b;

end:

 

>

decas:=proc(L,r,s) local i,j, b, cc,c;

b:=L;

for i from 1 to nops(L)-1 do

b:=seq( lerp(b[j], b[j+1], r,s,t), j=1..nops(L)-i);

cc(i):=b;  

od;

c:=seq([cc(i)],i=1..nops(L)-1);

end:

 

>

beziercurve:=proc(L, u) local n, b, k;

n:=nops(L)-1;
b:= [sum(n!/(k!*(n-k)!)*(u^k)*((1-u)^(n-k))*L[k+1][1], k=0..n),

sum(n!/(k!*(n-k)!)*(u^k)*((1-u)^(n-k))*L[k+1][2],k=0..n)]:

end:

 

>

bezierplot:=proc(L, r, s)  local bb;
bb:=badecas(L, 0, 1):
plot([bb[1],bb[2], t=r..s],color=blue, thickness=2);
end:

 

>

cpoly:=[[-1, 1], [0, -1], [1, 1]];

bezierplot(cpoly, 0,1);

 

`assign`(cpoly, [[-1, 1], [0, -1], [1, 1]]) 

 

Plot_2d

 

>

bezierplot(cpoly, -1,2);

 

>

cpoly:=[[-1, 0], [0, 2], [1, 0]];

bezierplot(cpoly, 0,1);

 

`assign`(cpoly, [[-1, 0], [0, 2], [1, 0]]) 

 

Plot_2d

 

>

beziercurve(cpoly, t);

 

[`+`(`-`(`*`(`^`(`+`(1, `-`(t)), 2))), `*`(`^`(t, 2))), `+`(`*`(4, `*`(t, `*`(`+`(1, `-`(t))))))]

 

問題1の答    [`+`(`-`(`*`(`^`(`+`(1, `-`(t)), 2))), `*`(`^`(t, 2))), `+`(`*`(4, `*`(t, `*`(`+`(1, `-`(t))))))] 

>

factor(%);

 

[`+`(`-`(1), `*`(2, `*`(t))), `+`(`-`(`*`(4, `*`(t, `*`(`+`(`-`(1), t))))))]

 

>

cpoly:=[[0, -1], [2, 0], [0, 1]];

AA:=plot(cpoly, color=black, thickness=2):

display(AA, bezierplot(cpoly, 0,1));

 

`assign`(cpoly, [[0, -1], [2, 0], [0, 1]]) 

 

Plot_2d

 

>

cpoly:=[[-1, 1], [0, -1], [1, 1]];

bezier:=badecas(cpoly,0,1):

ppoint:=k->pointplot(eval(bezier, t=k/64) , color=black, thickness=2):

BB:=decas(cpoly, 0,1):

frame:=k-> seq(plot(eval(BB[i],t=k/64), thickness=2), i=1..nops(cpoly)-1):

AA:=plot(cpoly, color=black, thickness=2):

frame(0):=AA:

p:=NULL:

for k from 0 to 64 do

p:=p, display(AA,frame(k), ppoint(k),
plot([bezier[1],bezier[2], t=0..1],color=blue, thickness=2) ):

end do:               

display(p,insequence=true, axes=none);

 

`assign`(cpoly, [[-1, 1], [0, -1], [1, 1]]) 

 

Plot_2d

 

>

cpoly:=[[1, 0], [1, 1], [0, 1]];

bezier:=badecas(cpoly,0,1):

ppoint:=k->pointplot(eval(bezier, t=k/64), color=black, thickness=2):

BB:=decas(cpoly, 0,1):

frame:=k-> seq(plot(eval(BB[i],t=k/64), thickness=2), i=1..nops(cpoly)-1):

AA:=plot(cpoly, color=black, thickness=2):

frame(0):=AA:

p:=NULL:

for k from 0 to 64 do

p:=p, display(AA,frame(k), ppoint(k),
plot([bezier[1],bezier[2], t=0..1],color=blue, thickness=2) ):

end do:               

display(p,insequence=true, axes=none);

 

`assign`(cpoly, [[1, 0], [1, 1], [0, 1]]) 

 

Plot_2d

 

>

cpoly:=[[3,2], [-1, -3], [-1, 3], [3,-2]];

bezier:=badecas(cpoly,0,1):

ppoint:=k->pointplot(eval(bezier, t=k/64) , color=black, thickness=2):

BB:=decas(cpoly, 0,1):

frame:=k-> seq(plot(eval(BB[i],t=k/64), thickness=2), i=1..nops(cpoly)-1):

AA:=plot(cpoly, color=black, thickness=2):

frame(0):=AA:

p:=NULL:

for k from 0 to 64 do

p:=p, display(AA,frame(k), ppoint(k), plot([bezier[1],bezier[2], t=0..1],color=blue, thickness=2) ):

end do:               

display(p,insequence=true, axes=none);
bezier;

 

`assign`(cpoly, [[3, 2], [-1, -3], [-1, 3], [3, -2]]) 

 

Plot_2d 

 

`+`(`*`(`+`(1, `-`(t)), `*`(`+`(`*`(`+`(1, `-`(t)), `*`(`+`(`*`(`+`(1, `-`(t)), `*`([3, 2])), `*`(t, `*`([-1, -3]))))), `*`(t, `*`(`+`(`*`(`+`(1, `-`(t)), `*`([-1, -3])), `*`(t, `*`([-1, 3])))))))), `...
`+`(`*`(`+`(1, `-`(t)), `*`(`+`(`*`(`+`(1, `-`(t)), `*`(`+`(`*`(`+`(1, `-`(t)), `*`([3, 2])), `*`(t, `*`([-1, -3]))))), `*`(t, `*`(`+`(`*`(`+`(1, `-`(t)), `*`([-1, -3])), `*`(t, `*`([-1, 3])))))))), `...

 

>

cpoly:=[[-1,-1],[-3/5,1],[-1/5,-1],[1/5,1], [3/5,-1], [1,1]];

beziercurve(cpoly, t);
 

 

`assign`(cpoly, [[-1, -1], [-`/`(3, 5), 1], [-`/`(1, 5), -1], [`/`(1, 5), 1], [`/`(3, 5), -1], [1, 1]])

 

[`+`(`-`(`*`(`^`(`+`(1, `-`(t)), 5))), `-`(`*`(3, `*`(t, `*`(`^`(`+`(1, `-`(t)), 4))))), `-`(`*`(2, `*`(`^`(t, 2), `*`(`^`(`+`(1, `-`(t)), 3))))), `*`(2, `*`(`^`(t, 3), `*`(`^`(`+`(1, `-`(t)), 2)))), ...
[`+`(`-`(`*`(`^`(`+`(1, `-`(t)), 5))), `-`(`*`(3, `*`(t, `*`(`^`(`+`(1, `-`(t)), 4))))), `-`(`*`(2, `*`(`^`(t, 2), `*`(`^`(`+`(1, `-`(t)), 3))))), `*`(2, `*`(`^`(t, 3), `*`(`^`(`+`(1, `-`(t)), 2)))), ...

 

>

factor(%);

 

[`+`(`-`(1), `*`(2, `*`(t))), `*`(`^`(`+`(`-`(1), `*`(2, `*`(t))), 5))]

 

問題2の答  
[`+`(`-`(`*`(`^`(`+`(1, `-`(t)), 5))), `-`(`*`(3, `*`(t, `*`(`^`(`+`(1, `-`(t)), 4))))), `-`(`*`(2, `*`(`^`(t, 2), `*`(`^`(`+`(1, `-`(t)), 3))))), `*`(2, `*`(`^`(t, 3), `*`(`^`(`+`(1, `-`(t)), 2)))), ...
[`+`(`-`(`*`(`^`(`+`(1, `-`(t)), 5))), `-`(`*`(3, `*`(t, `*`(`^`(`+`(1, `-`(t)), 4))))), `-`(`*`(2, `*`(`^`(t, 2), `*`(`^`(`+`(1, `-`(t)), 3))))), `*`(2, `*`(`^`(t, 3), `*`(`^`(`+`(1, `-`(t)), 2)))), ...
 

>

cpoly:=[[2652/15625, 200512416/244140625],


[-106132/234375, -9917022752/3662109375],


[-1342484/1640625, -19394337248/25634765625],


[-528372/546875, 1869010208/1220703125],


[-219388/234375, 8206418272/3662109375],


[-251836/328125, 11238002464/8056640625],


[-273468/546875, -317292768/3759765625],  


[-40612/234375, -9268160096/8056640625],


[40612/234375, -9268160096/8056640625],


[273468/546875, -317292768/3759765625],


[251836/328125, 11238002464/8056640625],  


[219388/234375, 8206418272/3662109375],


[528372/546875, 1869010208/1220703125],  


[1342484/1640625, -19394337248/25634765625],


[106132/234375, -9917022752/3662109375],


[-2652/15625, 200512416/244140625]];  

plot([beziercurve(cpoly,t)[1],beziercurve(cpoly,t)[2], t=0..1], color=blue, thickness=2);

 

`assign`(cpoly, [[`/`(2652, 15625), `/`(200512416, 244140625)], [-`/`(106132, 234375), -`/`(9917022752, 3662109375)], [-`/`(1342484, 1640625), -`/`(19394337248, 25634765625)], [-`/`(528372, 546875), `...
`assign`(cpoly, [[`/`(2652, 15625), `/`(200512416, 244140625)], [-`/`(106132, 234375), -`/`(9917022752, 3662109375)], [-`/`(1342484, 1640625), -`/`(19394337248, 25634765625)], [-`/`(528372, 546875), `...
`assign`(cpoly, [[`/`(2652, 15625), `/`(200512416, 244140625)], [-`/`(106132, 234375), -`/`(9917022752, 3662109375)], [-`/`(1342484, 1640625), -`/`(19394337248, 25634765625)], [-`/`(528372, 546875), `...
`assign`(cpoly, [[`/`(2652, 15625), `/`(200512416, 244140625)], [-`/`(106132, 234375), -`/`(9917022752, 3662109375)], [-`/`(1342484, 1640625), -`/`(19394337248, 25634765625)], [-`/`(528372, 546875), `...
`assign`(cpoly, [[`/`(2652, 15625), `/`(200512416, 244140625)], [-`/`(106132, 234375), -`/`(9917022752, 3662109375)], [-`/`(1342484, 1640625), -`/`(19394337248, 25634765625)], [-`/`(528372, 546875), `...
 

 

Plot_2d

 

>

AA:=plot(cpoly, color=black, thickness=2):

p:=NULL:
for j from 0 to 64 do  

p:=p,

display(AA, plot([beziercurve(cpoly,t)[1],beziercurve(cpoly,t)[2], t=-0.001..j/64], color=blue, thickness=2));  

end do:  
display(p,insequence=true, axes=none);

 

Plot_2d

 

>

elevt:=proc(L, rr) local j, i, b, bb ;

b:=L;

for i from 1 to rr

do
bb:=seq( lerp(b[j], b[j+1], 0,1,(nops(L)-j+i-1)/(nops(L)+i-1) ), j=1..nops(L)-2+i);


b:=[ L[1], bb, L[nops(L)] ];
od; b;
end;
 

 

`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...
`assign`(elevt, proc (L, rr) local j, i, b, bb; `assign`(b, L); for i to rr do `assign`(bb, seq(lerp(b[j], b[`+`(j, 1)], 0, 1, `/`(`*`(`+`(nops(L), `-`(j), i, `-`(1))), `*`(`+`(nops(L), i, `-`(1))))),...

 

>

cpoly:=[[-1, 1], [0, -1], [1, 1]];

 

`assign`(cpoly, [[-1, 1], [0, -1], [1, 1]])

 

>

plot(cpoly,  color=blue, thickness=2);

 

Plot_2d

 

>

elevt(cpoly, 4);

 

[[-1, 1], [-`/`(2, 3), `/`(1, 3)], [-`/`(1, 3), -`/`(1, 15)], [0, -`/`(1, 5)], [`/`(1, 3), -`/`(1, 15)], [`/`(2, 3), `/`(1, 3)], [1, 1]]

 

問題3の答   [[-1, 1], [-`/`(2, 3), `/`(1, 3)], [-`/`(1, 3), -`/`(1, 15)], [0, -`/`(1, 5)], [`/`(1, 3), -`/`(1, 15)], [`/`(2, 3), `/`(1, 3)], [1, 1]] 

>

plot(elevt(cpoly, 4), color=red, thickness=2);

 

Plot_2d

 

>

cpoly:=[[3,2], [-1, -2], [-1, 2], [3,-2]];

 

`assign`(cpoly, [[3, 2], [-1, -2], [-1, 2], [3, -2]])

 

>

a1:=plot(elevt(cpoly, 2), color=red, thickness=2):

a2:=plot(elevt(cpoly, 4), color=blue, thickness=2):
display(a1,a2);

 

Plot_2d

 

>

lsubdivstep:=proc(L,r,s) local  lpoly ;

lpoly:=[L[1], seq(eval(decas(L, r,s)[i][1],t=(r+s)/2), i=1..nops(L)-1)];

end;

 

`assign`(lsubdivstep, proc (L, r, s) local lpoly; `assign`(lpoly, [L[1], seq(eval(decas(L, r, s)[i][1], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`(1)))]) end p...
`assign`(lsubdivstep, proc (L, r, s) local lpoly; `assign`(lpoly, [L[1], seq(eval(decas(L, r, s)[i][1], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`(1)))]) end p...
`assign`(lsubdivstep, proc (L, r, s) local lpoly; `assign`(lpoly, [L[1], seq(eval(decas(L, r, s)[i][1], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`(1)))]) end p...
`assign`(lsubdivstep, proc (L, r, s) local lpoly; `assign`(lpoly, [L[1], seq(eval(decas(L, r, s)[i][1], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`(1)))]) end p...

 

>

rsubdivstep:=proc(L,r,s) local  rpoly;

rpoly:=[seq(eval(decas(L, r,s)[nops(L)-i][i],t=(r+s)/2), i=1..nops(L)-1), L[nops(L)]];

end;

 

`assign`(rsubdivstep, proc (L, r, s) local rpoly; `assign`(rpoly, [seq(eval(decas(L, r, s)[`+`(nops(L), `-`(i))][i], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`...
`assign`(rsubdivstep, proc (L, r, s) local rpoly; `assign`(rpoly, [seq(eval(decas(L, r, s)[`+`(nops(L), `-`(i))][i], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`...
`assign`(rsubdivstep, proc (L, r, s) local rpoly; `assign`(rpoly, [seq(eval(decas(L, r, s)[`+`(nops(L), `-`(i))][i], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`...
`assign`(rsubdivstep, proc (L, r, s) local rpoly; `assign`(rpoly, [seq(eval(decas(L, r, s)[`+`(nops(L), `-`(i))][i], t = `+`(`*`(`/`(1, 2), `*`(r)), `*`(`/`(1, 2), `*`(s)))), i = 1 .. `+`(nops(L), `-`...

 

>

subdivstep2:=proc(L, n) local i,j, b, c,d, dpoly;

b[1]:=L;

c[1]:=lsubdivstep(b[1], 0, 1); d[1]:=rsubdivstep(b[1], 0, 1);  

for j from 1 to n do

b[2*i-1]:=c[i]; b[2*i]:=d[i];

for i from 1 to 2^j do
c[i]:=lsubdivstep(b[i], 0, 1);   d[i]:=rsubdivstep(b[i], 0, 1);

od;

for i from 1 to 2^j do

b[2*i-1]:=c[i]; b[2*i]:=d[i];

od: od:

dpoly:=seq(b[j], j=1..2^(n));

end:

 

>

cpoly:=[[-1, 1], [0, -1], [1, 1]];

subdivstep2(cpoly, 2);

 

`assign`(cpoly, [[-1, 1], [0, -1], [1, 1]])

 

[[-1, 1], [-`/`(3, 4), `/`(1, 2)], [-`/`(1, 2), `/`(1, 4)]], [[-`/`(1, 2), `/`(1, 4)], [-`/`(1, 4), 0], [0, 0]], [[0, 0], [`/`(1, 4), 0], [`/`(1, 2), `/`(1, 4)]], [[`/`(1, 2), `/`(1, 4)], [`/`(3, 4), ...
[[-1, 1], [-`/`(3, 4), `/`(1, 2)], [-`/`(1, 2), `/`(1, 4)]], [[-`/`(1, 2), `/`(1, 4)], [-`/`(1, 4), 0], [0, 0]], [[0, 0], [`/`(1, 4), 0], [`/`(1, 2), `/`(1, 4)]], [[`/`(1, 2), `/`(1, 4)], [`/`(3, 4), ...

 

>

AA:=plot(cpoly, color=black, thickness=2);
subdivstep2(cpoly, 2);

display(AA, plot([subdivstep2(cpoly, 2)],color=red, axes=none, thickness=2));

 

`assign`(AA, INTERFACE_PLOT(CURVES([[-1., 1.], [0., -1.], [1., 1.]]), THICKNESS(2), AXESLABELS("", ""), COLOUR(RGB, 0, 0, 0), VIEW(DEFAULT, DEFAULT))) 

[[-1, 1], [-`/`(3, 4), `/`(1, 2)], [-`/`(1, 2), `/`(1, 4)]], [[-`/`(1, 2), `/`(1, 4)], [-`/`(1, 4), 0], [0, 0]], [[0, 0], [`/`(1, 4), 0], [`/`(1, 2), `/`(1, 4)]], [[`/`(1, 2), `/`(1, 4)], [`/`(3, 4), ...
[[-1, 1], [-`/`(3, 4), `/`(1, 2)], [-`/`(1, 2), `/`(1, 4)]], [[-`/`(1, 2), `/`(1, 4)], [-`/`(1, 4), 0], [0, 0]], [[0, 0], [`/`(1, 4), 0], [`/`(1, 2), `/`(1, 4)]], [[`/`(1, 2), `/`(1, 4)], [`/`(3, 4), ...
 

 

Plot_2d

 

>

display(AA, plot([subdivstep2(cpoly, 4)], color=red, axes=none, thickness=2));

 

Plot_2d

 

>

cpoly:=[[0,0],[-3,0],[-3,1],[-1,1], [-1,3], [-3,3]];
subdivstep2(cpoly, 2);

 

`assign`(cpoly, [[0, 0], [-3, 0], [-3, 1], [-1, 1], [-1, 3], [-3, 3]])

 

[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...

 

>

AA:=plot(cpoly, color=black, thickness=2):
subdivstep2(cpoly, 2);

 

[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...

 

問題4の答   
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
 

>

display(AA, plot([subdivstep2(cpoly, 4)], color=red, axes=none, thickness=2));

 

Plot_2d

 

>

cpoly:=[[0,0],[-3,0],[-3,1],[-1,1], [-1,3], [-3,3]];

 

`assign`(cpoly, [[0, 0], [-3, 0], [-3, 1], [-1, 1], [-1, 3], [-3, 3]])

 

>

AA:=plot(cpoly, color=black, thickness=2):
subdivstep2(cpoly, 2);

 

[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...
[[0, 0], [-`/`(3, 4), 0], [-`/`(21, 16), `/`(1, 16)], [-`/`(109, 64), `/`(5, 32)], [-`/`(499, 256), `/`(69, 256)], [-`/`(2133, 1024), `/`(51, 128)]], [[-`/`(2133, 1024), `/`(51, 128)], [-`/`(1135, 512...

 

>

display(AA, plot([subdivstep2(cpoly, 1),subdivstep2(cpoly, 2),subdivstep2(cpoly, 4)], color=red, axes=none, thickness=2));

 

Plot_2d

 

>

 

 

>