zoukankan      html  css  js  c++  java
  • 空间几何体的直观图matlab

     1 function B = transformation(A)
     2 sqrt2=1.414;
     3 n=size(A,1);
     4 B=zeros(n,2);
     5 B(:,1)=A*[-sqrt2/4,1,0]';
     6 B(:,2)=A*[-sqrt2/4,0,1]';
     7 
     8 bmin=min(min(B(:,1),B(:,2)));
     9 
    10 if bmin < 0
    11     B = B - bmin;
    12 end
    13 
    14 
    15 p=max(max(B)-min(B));
    16 k=300/p;
    17 B=k*B;
    18 B(:,2)=300-B(:,2);
    19 
    20 
    21 B=B+10;
    22 
    23 sprintf('%.0f ',B')
    24 
    25 zimu = ["a","b","c","d", "e" , "f" "g" "h"];
    26 calptal = ["A","B","C","D", "E" , "F" "G" "H"];
    27 
    28 for m =1:n
    29 fprintf('circle.move( name="%s"', zimu(m));
    30 fprintf(' cx=%3.0f',B(m,1));
    31 fprintf(' cy=%3.0f',B(m,2));
    32 fprintf(' label="%s")
    ', calptal(m))
    33 end
    34 
    35 end
    36 %A=[0,0,0; 0,4,0;-4,4,0;-4,0,0; 0,0,4; 0,4,4;-4,4,4;-4,0,4]
    37 %
    38 % 2020-2-29 A=[A;A';B;B';C;Cp;D;Dp];
    39 % A=[18,0,0;18,23,0;0,23,0;0,0,0;18,0,23;18,23,23;0,23,23;0,0,23];
    40 % B = transformation(A);

      320*320的画布;10边框宽度

     1 >> A=[18,0,0;18,23,0;0,23,0;0,0,0;18,0,23;18,23,23;0,23,23;0,0,23];
     2 >> B = transformation(A);
     3 
     4 ans =
     5 
     6     '10 310 245 310 310 245 75 245 10 75 245 75 310 10 75 10 '
     7 
     8 circle.move( name="a" cx= 10 cy=310 label="A")
     9 circle.move( name="b" cx=245 cy=310 label="B")
    10 circle.move( name="c" cx=310 cy=245 label="C")
    11 circle.move( name="d" cx= 75 cy=245 label="D")
    12 circle.move( name="e" cx= 10 cy= 75 label="E")
    13 circle.move( name="f" cx=245 cy= 75 label="F")
    14 circle.move( name="g" cx=310 cy= 10 label="G")
    15 circle.move( name="h" cx= 75 cy= 10 label="H")
  • 相关阅读:
    C#设计模式(6)——原型模式(Prototype Pattern)
    C#设计模式(4)——抽象工厂模式
    C#设计模式(3)——工厂方法模式
    C#设计模式(2)——简单工厂模式
    cmd 打 jar 包
    java eclipse 中给args 传递参数
    java 中值传递和引用传递(转)
    java unreachable code不可达代码
    java语言中if语句的用法
    java中 构造器与void
  • 原文地址:https://www.cnblogs.com/wangshixi12/p/12390878.html
Copyright © 2011-2022 走看看