#version 3.8; global_settings { assumed_gamma 1.0 } // low: +am3 +a0.100 +ac0.80 +r2 // mid: +am3 +a0.010 +ac0.90 +r3 // high: +am3 +a0.001 +ac0.99 +r4 #include "transforms.inc" #declare E = 0.0001; #declare Camera_Orthographic = true; // <----################################################################################ #declare Camera_Position = <0, 0, -50>; // front view #declare Camera_Look_At = <0, 0, 0> ; #declare Fraction = 45; // functions as a zoom for the orthographic view: 4 zooms in 4x, 8 zooms in 8x, etc. #declare Aspect = image_width/image_height; // ########################################### camera { #if (Camera_Orthographic = true) orthographic right x*image_width/(Fraction) up y*image_height/(Fraction) #else right x*image_width/image_height up y #end location Camera_Position look_at Camera_Look_At} // ########################################### sky_sphere {pigment {rgb 1}} light_source {<50, 36, -100> color rgb 1} // Edges 120 deg and 45 deg #declare EdgeLengthB = (1/sqrt(2))-(1/sqrt(6)); #declare EdgeLengthA = sqrt (2/3); // hexagons all meet at 3x120 deg vertices // Edge B is at 45 deg to the x-axis // triangle angles sum to 180 deg // (120 + 45) = 165 180 - 165 = 15 #declare EdgeA_Angle = 15; #declare EdgeB_Angle = 45; #declare EndpointA1 = <-EdgeLengthA/2, 0, 0>; #declare EndpointA2 = < EdgeLengthA/2, 0, 0>; #macro Rotate (Vector, Axis, Angle) #local RotatePoint = transform {Axis_Rotate_Trans (Axis, Angle)} #local Result = vtransform (Vector, RotatePoint); Result #end #macro Translate (Vector, Axis, Distance) #local TranslatePoint = transform {translate Axis * Distance} #local Result = vtransform (Vector, TranslatePoint); Result #end #macro Vec2 (Vec3) #end #declare Point1 = Translate (Rotate (EndpointA1, z, -15) y, -0.5); #declare Point2 = Translate (Rotate (EndpointA2, z, -15) y, -0.5); #declare Point3 = Rotate (Point2, y-x, 180); #declare Point4 = -Point1; // mirror symmetry across origin #declare Point5 = -Point2; #declare Point6 = -Point3; #declare ZScale = vlength (Point5 - Point1)/ (sqrt(3)/2); #declare XScale = vlength (Point6 - Point3)/ 2; #debug concat ("Z scale = ", str (ZScale, 0, 5), "\n") #debug concat ("X scale = ", str (XScale, 0, 5), "\n") #declare Line = 0.01; #declare EdgeA = cylinder {Point1, Point2 Line} #declare EdgeB = object {EdgeA Axis_Rotate_Trans (y-x, 180)} #declare EdgeC = cylinder {Point2, Point3 Line} #declare ChoeHexagonOutline = union { object {EdgeA} object {EdgeB} object {EdgeC} object {EdgeA translate y} object {EdgeB translate -x} object {EdgeC rotate z*180} sphere {Point1 Line} sphere {Point2 Line} sphere {Point3 Line} sphere {Point4 Line} sphere {Point5 Line} sphere {Point6 Line} } #declare ChoeHexagon = prism {-Line, 0, 7 Vec2 (Point1), Vec2 (Point2), Vec2 (Point3), Vec2 (Point4), Vec2 (Point5), Vec2 (Point6), Vec2 (Point1) rotate <-90, 0, 0> scale <1, 1, -1> //pigment {rgb z} } //object {ChoeHexagon} #local Seed = seed (1369); union { #for (Y, -10, 10) #for (X, -10, 10) #local Color = ; //<(X/20)+(Y/20), 1-((X/20)+(Y/20)), 1-(X/20)+(Y/10)>; object {ChoeHexagon pigment {rgb Color} translate } #end #end rotate -z*45 } // it's not simply a scaled regular hexagon // as evidenced by: #declare CH = pigment {hexagon scale scale <0.6, 1, 0.7125> //rotate -y*45 } box { <0, 0, -300>, <400, 0, 00> pigment {CH} //pigment {hexagon} rotate -x*90 translate -z*0.1 }