platonic_solid

버전 1.0.0.0 (2.06 KB) 작성자: Kevin Moerman
Creates the PATCH data, the vertices (V) and faces (F) for a desired platonic solid
다운로드 수: 1.3K
업데이트 날짜: 2010/7/15

라이선스 보기

function [V,F]=platonic_solid(n,r)

Creates the PATCH data, the vertices (V) and faces (F) for
a given platonic solid (according to "n" see below) with radius (r)

n=1 -> Tetrahedron
n=2 -> Cube
n=3 -> Octahedron
n=4 -> Icosahedron
n=5 -> Dodecahedron

%% Example

clear all; close all; clc;

r=1;
figure;fig=gcf; clf(fig); colordef (fig, 'white'); units=get(fig,'units'); set(fig,'units','normalized','outerposition',[0 0 1 1]); set(fig,'units',units); set(fig,'Color',[1 1 1]);
hold on;

[V,F]=platonic_solid(1,r);
subplot(2,3,1);
patch('Faces',F,'Vertices',V,'FaceColor','b','FaceAlpha',0.6,'EdgeColor','k','LineWidth',2); axis equal; grid on; hold on; view(3); axis off;

[V,F]=platonic_solid(2,r);
subplot(2,3,2);
patch('Faces',F,'Vertices',V,'FaceColor','b','FaceAlpha',0.6,'EdgeColor','k','LineWidth',2); axis equal; grid on; hold on; view(3); axis off;

[V,F]=platonic_solid(3,r);
subplot(2,3,3);
patch('Faces',F,'Vertices',V,'FaceColor','b','FaceAlpha',0.6,'EdgeColor','k','LineWidth',2); axis equal; grid on; hold on; view(3); axis off;

[V,F]=platonic_solid(4,r);
subplot(2,3,4);
patch('Faces',F,'Vertices',V,'FaceColor','b','FaceAlpha',0.6,'EdgeColor','k','LineWidth',2); axis equal; grid on; hold on; view(3); axis off;

[V,F]=platonic_solid(5,r);
subplot(2,3,5);
patch('Faces',F,'Vertices',V,'FaceColor','b','FaceAlpha',0.6,'EdgeColor','k','LineWidth',2); axis equal; grid on; hold on; view(3); axis off;

인용 양식

Kevin Moerman (2024). platonic_solid (https://www.mathworks.com/matlabcentral/fileexchange/28213-platonic_solid), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2007a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0