Guest User

Untitled

a guest
Jan 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. figure(1);
  2. % first polygon (triangle)
  3. x1 = [0 0 1]';
  4. y1 = [0 1 0]';
  5. c1 = [1 3 9]';
  6. fill(x1, y1, c1);
  7. % second polygon
  8. x2 = [1 0 1]';
  9. y2 = [0 1 1]';
  10. c2 = [9 3 20]';
  11. hold on;
  12. fill(x2, y2, c2);
  13. grid on;
  14. colorbar;
  15. colormap(jet(12));
  16.  
  17. # X Y Color
  18. 0 0 1
  19. 0 1 3
  20. 1 0 9
  21.  
  22. 1 0 9
  23. 0 1 3
  24. 1 1 20
  25.  
  26. figure(2);
  27. x1 = [0 1 0]';
  28. y1 = [0 0 1]';
  29. z1 = [0 0 0]';
  30. c1 = [5 2 6]';
  31. fill3(x1, y1, z1, c1);
  32. x2 = [0 0 0]';
  33. y2 = [0 1 0]';
  34. z2 = [0 0 1]';
  35. c2 = [5 6 9]';
  36. hold on;
  37. fill3(x2, y2, z2, c2);
  38. x3 = [0 1 0]';
  39. y3 = [0 0 0]';
  40. z3 = [0 0 1]';
  41. c3 = [5 2 9]';
  42. hold on;
  43. fill3(x3, y3, z3, c3);
  44. x4 = [1 0 0]';
  45. y4 = [0 0 1]';
  46. z4 = [0 1 0]';
  47. c4 = [2 9 6]';
  48. hold on;
  49. fill3(x4, y4, z4, c4);
  50. grid on;
  51. colorbar;
  52. colormap(jet(12));
  53.  
  54. # X Y Z Color
  55. 0 0 0 5
  56. 1 0 0 2
  57. 0 1 0 6
  58.  
  59. 0 0 0 5
  60. 0 1 0 6
  61. 0 0 1 9
  62.  
  63. 0 0 0 5
  64. 1 0 0 2
  65. 0 0 1 9
  66.  
  67. 1 0 0 2
  68. 0 0 1 9
  69. 0 1 0 6
Add Comment
Please, Sign In to add comment