lezed1

4-triangular-bifrustum.pov

Jun 26th, 2015
812
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "colors.inc"
  2. #include "PolyhedronKit.inc"
  3. #declare light=<1, 0, 0> * 3.75;
  4. #declare light=<1, 1, 1> * 2.5;
  5.  
  6. background {color White}
  7. camera {location light look_at <0, 0, 0>}
  8. //camera {location <-5, 0, 0> look_at <0, 0, 0>}
  9.  
  10. light_source {light color White}
  11. light_source {<0, 0, 0> color White}
  12.  
  13. #macro triBifrusta(xrot, yrot, zrot, ocolor)
  14.   #declare height = 1.34;
  15.   #declare bwidth = 2.325;
  16.   #declare swidth = 1.315;
  17.  
  18.   // Main axis points
  19.   #declare p1 = <0, 0, .577 * bwidth>;
  20.   #declare p2 = <0, -.5 * bwidth, -.289 * bwidth>;
  21.   #declare p3 = <0, .5 * bwidth, -.289 * bwidth>;
  22.  
  23.   // Positive axis points
  24.   #declare p4 = <height, 0, .577 * swidth>;
  25.   #declare p5 = <height, -.5 * swidth, -.289 * swidth>;
  26.   #declare p6 = <height, .5 * swidth, -.289 * swidth>;
  27.  
  28.   // Negative axis points
  29.   #declare p7 = <-height, 0, .577 * swidth>;
  30.   #declare p8 = <-height, -.5 * swidth, -.289 * swidth>;
  31.   #declare p9 = <-height, .5 * swidth, -.289 * swidth>;
  32.  
  33.   // Trying to keep a constant width for ease of folding
  34.   //#declare pwidth=0.25;
  35.   #declare pwidth=0.1;
  36.  
  37.   // Upper then lower triangular faces
  38.   #declare triAngle=0;
  39.   otriangle(p4, p5, p6, triAngle, pwidth, <xrot, yrot, zrot>, ocolor, true)
  40.   otriangle(p7, p8, p9, triAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  41.  
  42.   // Upper then lower trapezoidal faces
  43.   #declare trapAngle=0;
  44.   oquad(p1, p2, p5, p4, trapAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  45.   oquad(p2, p3, p6, p5, trapAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  46.   oquad(p3, p1, p4, p6, trapAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  47.  
  48.   oquad(p1, p2, p8, p7, trapAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  49.   oquad(p2, p3, p9, p8, trapAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  50.   oquad(p3, p1, p7, p9, trapAngle, pwidth, <xrot, yrot, zrot>, ocolor, false)
  51.  
  52.   #debug "\n\n###################################"
  53.   #debug "\nUSEFUL INFO HERE!!!!\n"
  54.  
  55.   #debug concat("Piece Width: : ", str(pwidth, 2, 4), "\n")
  56.   #debug concat("End Triangular Piece length: ", str(swidth, 2, 4), "\n")
  57.   #debug concat("Center Triangular Piece length: ", str(bwidth, 2, 4), "\n")
  58.   #debug concat("Remaining Piece length: ", str(vlength(p4 - p1), 2, 4), "\n")
  59.   #debug concat("End Triangular Angle: ", str(degrees(anglemeasure(p4, p5, p6) / 2), 2, 4), "\n")
  60.   #debug concat("Trapazoid Acute Angle: ", str(degrees(anglemeasure(p4, p1, p2) / 2), 2, 4), "\n")
  61.   #debug concat("Trapazoid Obtuse Angle: ", str(degrees(anglemeasure(p4, p5, p2) / 2), 2, 4), "\n")
  62.  
  63.  
  64. #end
  65.  
  66. //triBifrusta(0, 0, 0, 1, Orange)
  67.  
  68. triBifrusta(30, 35.2644, 45, Orange)
  69. //triBifrusta(-30, -35.2644, 45, Magenta)
  70. triBifrusta(30, 35.2644, -45, Green)
  71. //triBifrusta(-30, -35.2644, -45, Yellow)
RAW Paste Data