フィルターのクリア

How do I draw the Museum of Contemporary Art building by Oscar Niemeyer?

1 回表示 (過去 30 日間)
sadiqah aldahan
sadiqah aldahan 2022 年 4 月 15 日
コメント済み: DGM 2022 年 4 月 17 日
How do I draw the Museum of Contemporary Art building by Oscar Niemeyer
  2 件のコメント
Image Analyst
Image Analyst 2022 年 4 月 15 日
I don't think MATLAB would be the best program for that. You should try a program like Photoshop instead.
John D'Errico
John D'Errico 2022 年 4 月 16 日
編集済み: John D'Errico 2022 年 4 月 16 日
I generally like to use the workshop analogy for things like this. In my shop, I have many tools that can accomplish the same task. Not all of those tools are best suited for any given task however. As much as a hammer could be used to drive in a screw, or a screwdriver be used to drive a nail into wood, I would know which of those simple tools to use in any given problem. Likewise, I could cut steel on my table saw, but I would not be terribly happy with what it does to my razor shap, carbide tipped blade. And all of these acts would likely cause injury to myself.
In much the same vein, I can use a spreadsheet to solve nonlinear PDEs. I've done it myself in the past, but I doubt I'd want to do it that way again.
So can one use MATLAB as a picture editing and drawing tool? Well, surely the answer is yes. But knowing what a tool is good for (or not good at) is a valuable thing.

サインインしてコメントする。

採用された回答

DGM
DGM 2022 年 4 月 16 日
編集済み: DGM 2022 年 4 月 16 日
Oh that's easy.
sky = [0 0;600 0;600 450;0 450;0 0];
mountains = [0 297;48.9 296;78.9 294;155 283;209 293;239 308;261 307;269 311;286 309;451 273;468 289;487 300;511 308;554 310;600 318;600 389;0 364;0 297];
ground = [0 331;600 331;600 450;0 450;0 331];
main = [57.8 183;61.6 169;83.5 153;116 140;145 131;185 123;229 116;288 111;340 108;372 108;410 109;452 111;484 113;522 118;544 124;576 132;595 141;599 144;600 186;494 274;484 279;471 283;450 286;417 289;409 290;397 295;392 299;388 304;386 311;388 338;335 339;286 337;286 310;279 303;273 297;265 294;260 294;206 290;194 288;183 285;176 281;57.8 183];
windows = [172 192;214 245;229 243;247 241;264 240;284 239;305 238;327 237;348 237;370 237;392 237;413 237;430 238;450 238;465 239;477 240;489 241;500 243;508 244;514 246;517 249;520 250;521 252;565 215;565 213;566 210;565 206;561 202;555 198;546 194;534 191;521 189;505 186;484 183;462 182;439 179;412 179;383 177;356 178;325 178;296 179;268 181;241 183;216 186;194 189;172 192];
port = [114 210;138 201;159 196;169 194;238 277;162 270;108 220;114 210];
wwlower2 = [190 257;223 261;239 278;189 274;190 257];
ped = [120 278;118 361;146 357;146 278;120 278];
wwlower1 = [0 248;190 249;189 276;0 282;0 248];
wwupper1 = [0 173;70.5 185;128 204;186 215;210 244;121 241;60.4 231;20.6 217;0 227;0 173];
wwupper2 = [0 200;34 202;92.4 212;126 223;203 236;187 218;126 205;74.6 189;0 176;0 200];
sun1 = [452 113;392 261;476 269;491 274;598 187;599 145;567 130;496 115;452 113];
sun2 = [301 283;448 285;404 290;387 302;387 339;329 337;329 307;316 294;298 283;301 283];
sun3 = [386 338;386 316;332 330;328 333;329 338;386 338];
sun4 = [119 300;148 293;147 357;118 360;119 300];
skycm = interp1(0:1,[0.3083 0.5279 0.8299; 0.6811 0.8169 0.9466],linspace(0,1,32));
colormap(skycm);
patch(sky(:,1),sky(:,2),[1 1 2 2 1],'edgecolor','none'); hold on
patch(mountains(:,1),mountains(:,2),[0.3575 0.4217 0.4839],'edgecolor','none')
patch(ground(:,1),ground(:,2),[0.5647 0.5373 0.4980],'edgecolor','none')
patch(main(:,1),main(:,2),[0.6296 0.6100 0.5354],'edgecolor','none')
patch(sun1(:,1),sun1(:,2),[0.8308 0.7925 0.7466],'edgecolor','none')
patch(windows(:,1),windows(:,2),[0.0983 0.1059 0.0863],'edgecolor','none')
patch(port(:,1),port(:,2),[0.0983 0.1059 0.0863],'edgecolor','none')
patch(ped(:,1),ped(:,2),[0.8914 0.8854 0.8676],'edgecolor','none')
patch(wwlower2(:,1),wwlower2(:,2),[0.2534 0.3324 0.3822],'edgecolor','none')
patch(wwlower1(:,1),wwlower1(:,2),[0.8308 0.7925 0.7466],'edgecolor','none')
patch(wwupper1(:,1),wwupper1(:,2),[0.6296 0.6100 0.5354],'edgecolor','none')
patch(wwupper2(:,1),wwupper2(:,2),[0.2534 0.3324 0.3822],'edgecolor','none')
patch(sun2(:,1),sun2(:,2),[0.8308 0.7925 0.7466],'edgecolor','none')
patch(sun3(:,1),sun3(:,2),[1 1 1],'edgecolor','none')
patch(sun4(:,1),sun4(:,2),[1 1 1],'edgecolor','none')
wbarsx = [windows(2:23,1) flipud(windows(25:end,1))].';
wbarsy = [windows(2:23,2) flipud(windows(25:end,2))].';
plot(wbarsx,wbarsy,'linewidth',2)
wcm = interp1(0:1,[0.2 0.2 0.2; 0.6 0.6 0.7],linspace(0,1,22));
set(gca,'colororder',wcm);
set(gca,'ydir','reverse')
axis equal
axis off
  5 件のコメント
DGM
DGM 2022 年 4 月 16 日
編集済み: DGM 2022 年 4 月 16 日
Like Star Strider said, patience is a limited resource. ROI tools could be used to create the paths, but the view controls makes that cumbersome. I just slapped down some polygons in Inkscape and then used loadsvg() (FEX) to get the paths. I used MIMT colorpicker() with a large sample radius to get some approximate region colors, though that could be done otherwise.
I don't really consider it a serious answer, more of a demonstration that simple tedium is part of the solution. I kind of suspect that the question is actually about creating a surface of revolution and not really about drawing.
DGM
DGM 2022 年 4 月 17 日
I'm not exactly great with vector illustration, but I'm also not one to stop doing things the for sake of being ridiculous. There's no kill like overkill:
sky = [0 0;600 0;600 450;0 450;0 0];
skyv = [0 0;0 317;600 323;600 0;309 0;0 0];
mountains = [0 297;48.9 296;78.9 294;155 283;209 293;239 308;261 307;269 311;286 309;451 273;468 289;487 300;511 308;554 310;600 318;600 389;0 364;0 297];
mountains2 = [150 331;182 317;200 311;207 313;222 310;228 313;246 306;263 308;274 315;292 316;387 302;417 319;445 330;450 331;248 338;152 335;150 331];
water = [0 331;600 331;600 450;0 450;0 331];
ground = [0 346;155 330;157 340;173 339;174 331;264 332;269 339;494 334;495 326;575 328;600 327;600 450;0 450;0 346];
grsh = [496 325;492 334;574 338;574 327;496 325];
main = [57.8 183;61.6 169;83.5 153;116 140;145 131;185 123;229 116;288 111;340 108;372 108;410 109;452 111;484 113;522 118;544 124;576 132;595 141;599 144;600 186;494 274;484 279;471 283;450 286;417 289;409 290;397 295;392 299;388 304;386 311;388 338;335 339;286 337;286 310;279 303;273 297;265 294;260 294;206 290;194 288;183 285;176 281;57.8 183];
windows = [172 192;214 245;229 243;247 241;264 240;284 239;305 238;327 237;348 237;370 237;392 237;413 237;430 238;450 238;465 239;477 240;489 241;500 243;508 244;514 246;517 249;520 250;521 252;565 215;565 213;566 210;565 206;561 202;555 198;546 194;534 191;521 189;505 186;484 183;462 182;439 179;412 179;383 177;356 178;325 178;296 179;268 181;241 183;216 186;194 189;172 192];
port = [114 210;138 201;159 196;169 194;238 277;162 270;108 220;114 210];
wwlower2 = [190 257;223 261;239 278;189 274;190 257];
ped = [120 279;146 278;146 292;146 294;146 357;118 361;119 300;120 297;120 279];
wwlower1 = [0 248;190 249;189 276;0 282;0 248];
wwupper1 = [0 173;70.5 185;128 204;186 215;210 244;121 241;60.4 231;20.6 217;0 227;0 173];
wwupper2 = [0 200;34 202;92.4 212;126 223;203 236;187 218;126 205;74.6 189;0 176;0 200];
sun1 = [452 113;392 261;476 269;491 274;598 187;599 145;567 130;496 115;452 113];
sun2 = [301 283;448 285;404 290;387 302;387 339;329 337;329 307;316 294;298 283;301 283];
sun3 = [386 338;386 316;332 330;328 333;329 338;386 338];
sun4 = [119 300;148 293;147 357;118 360;119 300];
shad1 = [117 353;30 353;18.9 342;0 346;0 359;117 359;117 353];
shad2 = [147 331;147 341;298 339;322 337;269 338;263 332;174 331;173 338;157 338;154 330;147 330;147 331];
per = [478 316;476 316;477 321;476 328;477 328;475 333;476 334;475 339;475 340;473 340;472 341;475 343;477 341;477 339;479 335;480 333;482 335;483 335;483 341;482 343;483 343;485 341;485 334;486 333;484 328;484 326;485 321;483 316;481 315;481 312;480 311;478 311;478 312;478 314;478 315;478 316];
mainshad = [57.9 182;58.9 174;70 163;88.4 151;117 140;223 276;191 282;195 285;271 290;296 296;307 303;298 310;285 307;279 301;274 298;266 293;258 292;199 288;188 286;177 280;57.9 182];
ejlines = [53 438;114 416;285 440;297 417;532 435;476 410;536 408;489 393;344 414;345 399;155 416;190 400;0 411;52 399;101 399;137 389;245 400;257 389;409 396;396 387;567 390;518 380;442 384;422 376;306 389;309 381;166 389;194 381;236 381;249 373;390 372;379 367;317 368;320 363;349 363;345 358];
% make some color maps
scm1 = makectab([0.6296 0.6100 0.5354],[0.8926 0.8860 0.8606],3);
scm1 = [scm1; makectab([0.8926 0.8860 0.8606],[0.6296 0.6100 0.5354],5)];
scm1 = [0.6296 0.6100 0.5354; scm1];
scm2 = [0.6296 0.6100 0.5354; repmat([0.8926 0.8860 0.8606],[2 1])];
scm2 = [scm2; makectab([0.8926 0.8860 0.8606],[0.6296 0.6100 0.5354],4)];
scm2 = [scm2;repmat([0.6296 0.6100 0.5354],[3 1])];
grcm = [0.7686 0.7336 0.6446; 0.4268 0.4151 0.3882];
grcm = grcm([1 1 1 1 1 1 1 1 1 1 1 2 2 1],:);
wwlcm = [0.8884 0.8223 0.7270; 0.4827 0.4661 0.4211];
wwlcm = wwlcm([1 2 2 1 1],:);
wwucm = repmat([0.7593 0.7840 0.8344],[2 1]);
wwucm = [wwucm; makectab([0.7593 0.7840 0.8344],[0.3593 0.2866 0.2643],3)];
wwucm = [wwucm; repmat([0.3593 0.2866 0.2643],[2 1])];
wwucm = [wwucm; makectab([0.3593 0.2866 0.2643],[0.7593 0.7840 0.8344],3)];
pedcm = [0.8884 0.8223 0.7270; 0.8914 0.8854 0.8676; 1 1 1];
pedcm = pedcm([1 2 2 3 3 3 3 2 1],:);
mscm = makectab([0.4827 0.4661 0.4211],[0.6296 0.6100 0.5354],5);
mscm = [mscm; repmat([0.6296 0.6100 0.5354],[5 1])];
mscm = [mscm; makectab([0.6296 0.6100 0.5354],[0.4827 0.4661 0.4211],6)];
mscm = [mscm; repmat([0.4827 0.4661 0.4211],[5 1])];
skycm = makectab([0.3083 0.5279 0.8299],[0.7355 0.8506 0.9570],32);
colormap(skycm);
% create patch objects
patch(sky(:,1),sky(:,2),[1 1 32 32 1],'edgecolor','none'); hold on
patch(skyv(:,1),skyv(:,2),[0.2582 0.4896 0.7949],'edgecolor','none', ...
'facevertexalpha',0.5*[1 0 0 1 0 1]','facealpha','interp','alphadatamapping','none')
patch(mountains(:,1),mountains(:,2),[0.2519 0.3371 0.4283],'edgecolor','none')
patch(mountains2(:,1),mountains2(:,2),[0.2744 0.3740 0.4367],'edgecolor','none')
patch(water(:,1),water(:,2),[0.4009 0.5523 0.6911],'edgecolor','none')
patch(ground(:,1),ground(:,2),ctflop(grcm),'edgecolor','none')
patch(grsh(:,1),grsh(:,2),[0.4268 0.4151 0.3882],'edgecolor','none')
patch(shad1(:,1),shad1(:,2),[0.2655 0.2688 0.2724],'edgecolor','none')
patch(shad2(:,1),shad2(:,2),[0.2655 0.2688 0.2724],'edgecolor','none')
patch(per(:,1),per(:,2),[0.6296 0.6100 0.5354],'edgecolor','none')
patch(main(:,1),main(:,2),[0.6296 0.6100 0.5354],'edgecolor','none')
patch(mainshad(:,1),mainshad(:,2),ctflop(mscm),'edgecolor','none')
patch(sun1(:,1),sun1(:,2),ctflop(scm1),'edgecolor','none')
patch(windows(:,1),windows(:,2),[0.0983 0.1059 0.0863],'edgecolor','none')
patch(port(:,1),port(:,2),[0.0983 0.1059 0.0863],'edgecolor','none')
patch(ped(:,1),ped(:,2),ctflop(pedcm),'edgecolor','none')
patch(wwlower2(:,1),wwlower2(:,2),[0.2534 0.3324 0.3822],'edgecolor','none')
patch(wwlower1(:,1),wwlower1(:,2),ctflop(wwlcm),'edgecolor','none')
patch(wwupper1(:,1),wwupper1(:,2),ctflop(wwucm),'edgecolor','none')
patch(wwupper2(:,1),wwupper2(:,2),[0.2534 0.3324 0.3822],'edgecolor','none')
patch(sun2(:,1),sun2(:,2),ctflop(scm2),'edgecolor','none')
patch(sun3(:,1),sun3(:,2),[1 1 1],'edgecolor','none')
% add line object details
wbarsx = [windows(2:23,1) flipud(windows(25:end,1))].';
wbarsy = [windows(2:23,2) flipud(windows(25:end,2))].';
plot(wbarsx,wbarsy,'linewidth',2)
wcm = makectab([0.2 0.2 0.2],[0.6 0.6 0.7],22);
set(gca,'colororder',wcm);
for k = 1:2:size(ejlines,1)
plot(ejlines(k:k+1,1),ejlines(k:k+1,2),'color',[0.4 0.4 0.3])
end
set(gca,'ydir','reverse')
axis equal
axis off
function ct = makectab(colorA,colorB,numcolors)
ct = interp1([1/numcolors 1],[colorA; colorB],(1:numcolors)/numcolors,'linear','extrap');
end
function ct = ctflop(ct)
ct = permute(ct,[1 3 2]);
end
That looks a lot better.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by