// Persistence Of Vision raytracer version 3.1/3.5 // Includedatei Brett.inc // Copyright (C) Frank 'Sputnik' Rothfuß, 2003, Kiel, Germany // Zweck: Aus einer 'Scheibe' (Bereich zwischen der XZ-Ebene und einer da zu parallelen Ebene) // mit geraden und Kreisbogen-Schnitten ein Teil ausschneiden, dessen Kan ten durch 'Aufkleben' // eines rundum laufenden Streifens abgerundet/abgeschrägt werden. // NUR FÜR DIE TEST- UND DEMO-SZENEN: // """""""""""""""""""""""""""""""""" // Show: =MHz-Wert des Computers: Automatische Dia-Show // <=0 oder undefiniert : keine Automatik // // Nr: 1 ... 13 : Nummer der Demo-Szene (wird bei automatischer Show ignoriert) // anderer Wert oder // undefiniert : keine Szene (bei Verwendung als .inc) // // Typ: 0: abgerundet // 1: abgeschrägt // // BrettDebug: 0: normal // 1: Markierpfeile und #debug-Protokoll // 2: Pfeile, #debug und 'Explosion' // === POV-Ray-Version 3.5 === // // eine der untenstehenden Optionen-Zeilen mit geeigneten Werten für di e // 'Declare='-Variablen als command line option verwenden, wie eine .po v-Datei rendern // // Show: // +SP8 +EP8 +W512 +H384 -A -F +D Declare=BrettDebug=0 Declare=Typ= 0 +KFF13 Declare=Show=233 // // Minibild: // +SP8 +EP8 +W320 +H240 -A -F +D Declare=BrettDebug=0 Declare=Typ= 0 Declare=Nr=1 // // Vollbild: // +SP8 +EP8 +W1024 +H768 +A0.1 -F +D Declare=BrettDebug=0 Declare= Typ=0 Declare=Nr=1 // === POV-Ray-Version 3.1 === // // Die folgenden 3 #declare-Zeilen un-kommentieren und geeignete Werte ei ntragen, // dann eine der darunter stehenden Optionen-Zeilen verwenden und wie ein e .pov-Datei rendern // // #declare Nr=11; // #declare Typ=0; // #declare BrettDebug=0; // // Minibild: // +SP8 +EP8 +W320 +H240 -A -F +D // // Vollbild: // +SP8 +EP8 +W1024 +H768 +A0.1 -F +D // Show: die #declare-Zeile un-kommentieren, die '233' durch den MHz-Wert des // Computers ersetzen und oben ggf. für Typ und BrettDebug andere Werte einsetzen // (Nr wird ignoriert), dann die darunter stehende Optionen-Zeile verwend en und // wie eine .pov-Datei rendern // #declare Show=1; // +SP8 +EP8 +W512 +H384 -A -F +D +KFF13 /* Inhalt: BrettAnfang ( Dicke, Typ, Abrundungsradius, Anfangsposition, Anfang srichtung ) BrettKante ( Kantenlänge_bzw_Kurvenradius, Winkeländerung_in_Gr ad ) BrettMulti ( Kantenlänge_bzw_Kurvenradius, Gesamtwinkeländerung _in_Grad, Segmentanzahl ) BrettEnde ( Schließbogenradius ) Brett () Segment ( Großer_Radius, Kleiner_Radius, Winkel_in_Grad ) XZ_Senkrechte ( Vektor ) XZ_Winkel ( Vektor1, Vektor2 ) XZ_Schnitt ( Position1, Richtung1, Position2, Richtung2 ) BrettkanteErzeugen ( Index ) Saeule ( ... ) Demoszenen // Auswahl durch Nr=1 ... 13; 0: keine Szene Globale Variablen: BrettDebug: 0: normal; 1: Pfeile und #debug; 2: Pfeile, #debug und Explosion Nr : Nummer der Demoszene (0 (Default): leere Szene) Typ : Typ für die Demoszenen (0: abgerundet; 1: abgeschrä gt) BrettR : Abrundungsradius BrettT : Typ (0 (runde Ziffer): abgerundet; 1 (gerade Ziffer): a bgeschrägt) BrettD : Dicke BrettI : Punktindex BrettS : Schließ-Radius ( negativ: nicht schließen) BrettK[] : Kantenlänge bzw. Kurvenradius BrettP[] : Stützpunkt BrettV[] : Richtungsvektor BrettW[] : Winkel zwischen X-Achse und BrettV noch zu erledigen: Mittelpunkte, Anfangs- und Endwinkel zur Verfügung stellen declare Arrays; undef Arrays Radius < Abrundungsradius Schluss-Sonderfälle: gerader Schluss, S-förmiger Schluss Anschluss an beliebigen vorhergehenden Bogen (um nach Ansetzen von Teilen an einen Bogen wieder zu diesem zurückzufinden) Anschluss an Punkt mit Richtung Fehlerbehandlung (Länge <0; abs(Winkel)>360 Grad) bei Fehlern Teilfigur liefern statt Abbruch prism-Optimierung (kollineare Punkte, ...) Angabe der Außenkontur statt Erweiterung um Abrundung gerade Kontur mit zu rundenden Ecken/Außenkonturbögen; auch gem ischt bei gerader Kontur mit zu rundenden Ecken: Radius<0 => max. Radiu s; bei Konflikten: abs(Radius)=Priorität weitere Typen: nichts/Kehle/Wulst/runde Brüstung/eckige Brüstun g/Lathe/SOR Innenraum ohne Lücken, union/merge, transparenzfähig, differenc e-fähig Kontur speichern, schrumpfen/expandieren/"verzieren" Löcher oben und unten verschiedene Abrundungstypen Typenmix wahlweise nur Rand ("Kreis-/Geraden-Spline") englische Bezeichnungen und Dokumentation ACHTUNG! Bei Problemen mit diesen Makros bin ich gerne behilflich (Reaktions zeit allerdings einige Tage), die nächste Version mit hoffentlich viel en der obigen Verbesserungen wird allerdings INKOMPATIBEL zu dieser Versio n sein; insbesondere weil dann die AUSSENKONTUR anzugeben sein wird - im Gegensatz zu dieser Version, die die Kontur um eine Schicht mit Abrundungsradius-Dicke ERWEITERT. */ // DEKLARATIONEN //////////////////////////////////////////////////////// //// #ifndef (BrettDebug) #local BrettDebug = 0; #end #ifndef (Eps) #local Eps = 0.0001; #end #ifndef (BrettSegmente) #local BrettSegmente = 50; #end #declare BrettK = array [BrettSegmente] #declare BrettW = array [BrettSegmente] #declare BrettV = array [BrettSegmente] #declare BrettP = array [BrettSegmente] // SEGMENT-MAKRO //////////////////////////////////////////////////////// //// #macro Segment (T, R1, R0, W) intersection { #if (T=0) // abgerundetes Segment torus { R1, R0 } #else // abgeschrägtes Segment #if (W>0) difference { cone { 0, R1+R0, R0*y, R1 } cylinder { -Eps*y, (R0+Eps)*y, R1 } } #else difference { cylinder { 0, R0*y, R1 } cone { -Eps*y, R1-R0-Eps, (R0+Eps)*y, R1+Eps } } #end//if #end//if #if (abs(W)>180) union { plane { -z, 0 } plane { z, 0 rotate abs(W)*y } } #else plane { -z, 0 } #if (abs(W)!=180) plane { z, 0 rotate abs(W)*y } #end #end translate R1*x #if (BrettDebug=2) translate 2*y #end #if (W<0) scale <-1, 1, 1> #end } #end//macro Segment /// SENKRECHTE-MAKRO //////////////////////////////////////////////////// //// #macro XZ_Senkrechte (V) #local V1 = vnormalize(V*<1,0,1>); <-V1.z, 0, V1.x> #end//macro XZ_Senkrechte /// WINKEL-MAKRO //////////////////////////////////////////////////////// //// #macro XZ_Winkel (V_1, V_2) #local V1 = vnormalize(V_1*<1,0,1>); #local V2 = vnormalize(V_2*<1,0,1>); degrees(atan2( -vcross(V1, V2).y , V1.x*V2.x + V1.y*V2.y + V1.z*V2.z )) #end//macro XZ_Winkel /// SCHNITTPUNKT-MAKRO ////////////////////////////////////////////////// //// #macro XZ_Schnitt (P1, V_1, P2, V_2) #local V1 = vnormalize(V_1*<1,0,1>); #local V2 = vnormalize(V_2*<1,0,1>); #declare L1 = ( (P2.x-P1.x)*V2.z+(P1.z-P2.z)*V2.x ) / ( V1.x*V2.z-V2. x*V1.z ); #declare L2 = ( (P1.x-P2.x)*V1.z+(P2.z-P1.z)*V1.x ) / ( V2.x*V1.z-V1. x*V2.z ); #declare W = XZ_Winkel(V2,V1); #end//macro XZ_Schnitt /// ANFANG-MAKRO //////////////////////////////////////////////////////// ///// #macro BrettAnfang ( D, T, R, P, V ) #if (BrettDebug>0) #debug concat ( "!!!\n!!! BrettAnfang(", str(D,8,3), ",", str(T,2,0 ), ", ", str(R,0,3), ", < ", str((<1,1,1>*P).x,0,3), ", ", str((<1,1,1 >*P).y,0,3), ", ", str((<1,1,1>*P).z,0,3), " >, < ", str(V.x,0,3), ", ", str(V.y ,0,3), ", ", str(V.z,0,3), " > )\n" ) #end #if (2*R>D) #debug concat ( "!!! Fehler: Abschrägung/Rundung > 0.5*Dicke!\ n" ) #end #declare BrettD = D; #declare BrettT = T; #declare BrettR = R; #declare BrettV[0] = vnormalize(V*<1, 0, 1>); #declare BrettP[0] = <1, 1, 1>*P; #declare BrettI = 0; #end//macro BrettAnfang // KANTEN-MAKRO ///////////////////////////////////////////////////////// //// #macro BrettKante ( K, W ) #declare BrettK[BrettI] = K; #declare BrettW[BrettI] = W; #local V = BrettV[BrettI]; #declare BrettV[BrettI+1] = vrotate (V, W*y); #if (BrettDebug>0) #debug concat ( "!!! BrettKante (", str(K,8,3), ",", str(W,8,3), " ) ", str(BrettI,4,0), " Richtung = <", str(V.x,7,3), ",", str(V.y,6,3), ",", str(V.z, 7,3), " >\n" ) #end #if (K<0) #debug concat ( "!!! Fehler: 1. Parameter muss >=0 sei n!\n" ) #end #if (K!=0) #if (W!=0) // Bogen #declare BrettP[BrettI+1] = BrettP[BrettI] + (W<0?-K:K) * ( - XZ_Senkrechte(V) + vrotate(XZ_Senkrechte(V),W*y) ); #else // W=0: // Gerade #declare BrettP[BrettI+1] = BrettP[BrettI]+K*V; #end//if W #else // K=0 #if (W!=0) // Knick #declare BrettP[BrettI+1] = BrettP[BrettI]; #end//if W #end//if K #declare BrettI = BrettI+1; #end//macro BrettKante // KANTEN-MAKRO ///////////////////////////////////////////////////////// //// #macro BrettMulti ( K, W, N ) #if (BrettDebug>0) #debug concat("!!! BrettMulti (", str(K,8,3), ",", str(W,8,3), ",", str(N,2,0), " )\n") #end #local I = 0; #while (I0) #debug concat("!!! BrettEnde (", str(BrettS,8,3), " )\n!!!\n") #end #end//macro BrettEnde // BRETTKANTEERZEUGEN-MAKRO ///////////////////////////////////////////// //// #macro BrettkanteErzeugen (I) #local K = BrettK[I]; #local W = BrettW[I]; #local V = BrettV[I]; #local P = BrettP[I]; #if (BrettDebug>0) cone { 0, 0.04, 0.4*z, 0 rotate WW*y translate P+(BrettD+0.6)*y textu re { pigment { color red 2 } } } cylinder { 0, 0.64*y, 0.01 translate P+BrettD*y texture { pigment { c olor red 2 } } } #end #if (K=0) // Knick mit Winkel W #declare BrettP[I+1] = P; #if (BrettT=0) sphere { P+BrettR*y , BrettR } sphere { P+(BrettD-BrettR)*y, BrettR } #else cone { P, 0, P+BrettR*y, BrettR } cone { P+(BrettD-BrettR)*y, BrettR, P+BrettD*y, 0 } #end//if cylinder { P+BrettR*y, P+(BrettD-BrettR)*y, BrettR } #else #if (W=0) // Gerade der Länge K #declare BrettP[I+1] = P+K*V; #if (BrettT=0) cylinder { P, BrettP[I+1], BrettR translate BrettR*y } cylinder { P, BrettP[I+1], BrettR translate (BrettD-BrettR) *y} box { <-BrettR, BrettR, 0>, rota te WW*y translate P } #else difference { box { <-BrettR, 0, 0>, <0, BrettD, K> } plane { x+y, 0 } plane { x-y, 0 translate BrettD*y } rotate WW*y translate P } #end//if #else // Bogen mit Radius K #local KN = (W>=0?K:-K)*XZ_Senkrechte(V); #local M = P-KN; #if (BrettDebug>0) #local N = M + (W<0?-K:K) * vrotate(XZ_Senkrechte(V),W*y); cone { M+BrettD*y, 0.03, P+BrettD*y, 0.01 texture { pigment { color blue 2 } } } cone { M+BrettD*y, 0.03, N+BrettD*y, 0.01 texture { pigment { color green 2 } } } #end #local S = Segment ( BrettT, K, BrettR, W ) object { S scale <1, -1, 1> rotate WW*y translate P+BrettR*y } object { S rotate WW*y translate P+(BrettD-BrettR)*y } #if (W>0) // Füllung für konvexen Bogen intersection { union { cylinder { M, M+BrettD*y, K } cylinder { M+BrettR*y, M+(BrettD-BrettR)*y, K+BrettR } } #if (W>180) union { plane { -V, 0 rotate (W/2-90)*y translate P } plane { -V, 0 translate P } plane { BrettV[I+1], 0 translate BrettP[I+1] } } #else plane { -V, 0 rotate (W/2-90)*y translate P } plane { -V, 0 translate P } #if (W<180) plane { BrettV[I+1], 0 translate BrettP[I +1] } #end #end } #else // Füllung für konkaven Bogen difference { cylinder { BrettR*y, (BrettD-BrettR)*y, K } cylinder { 0, BrettD*y, K-BrettR } #if (W<-180) intersection { plane { z, 0 } plane { -z, 0 rotate W*y } } #else plane { z, 0 } plane { -z, 0 rotate W*y } #end rotate WW*y translate P-KN } #end//if W>0 #end//if W=0 #end//if K #declare WW = WW+W; #end//macro BrettkanteErzeugen // BRETT-MAKRO ////////////////////////////////////////////////////////// //// #macro Brett () #if (BrettDebug>0) #debug concat("!!! Brett ( )\n!!!\n") #end union { // Knicke, Kanten, konvexe Bögen #local WW = XZ_Winkel (BrettV[0], z); #local Index = 0; #while (Index=0) #local P = BrettP[BrettI]; #local V = BrettV[BrettI]; #local P0 = BrettP[0]; #local V0 = BrettV[0]; XZ_Schnitt ( P, V, P0, V0 ) #local RA = BrettS*tan(radians(abs(W)/2)); // 1. Schluss-Gerade #if (L1-RA!=0) BrettKante ( L1-RA, 0 ) BrettkanteErzeugen (BrettI-1) #end//if // Schluss-Bogen #if (W!=0) BrettKante ( BrettS, W ) BrettkanteErzeugen (BrettI-1) #end//if // 2. Schluss-Gerade #if (-L2+RA!=0) BrettKante ( -L2-RA, 0 ) #declare BrettP[BrettI+1] = BrettP[0]; BrettkanteErzeugen (BrettI-1) #end//if #end//if // eckiges Innenprisma abzüglich konkaver Bögen difference { // eckiges Innenprisma: Anzahl der von ihrem Nachfolgerpunkt versch iedenen Punkte #local BI = 0; #local I = 0; #while (I, #end//if #local I = I+1; #end//while I #if (BrettDebug=2) scale <1, 0.1, 1> translate -1.3*y pigment { color rgb 1 } finish { ambient .6 } #end }//prism // konkave Bögen ausschneiden #local I = 0; #while (I0) ) cylinder { -Eps*y, (BrettD+Eps+.1)*y, BrettK[I] translate Brett P[I]+BrettK[I]*XZ_Senkrechte(BrettV[I]) } #end//if #local I = I+1; #end//while I }//difference }//union #if (BrettDebug>0) #debug concat ( "!!!\n" ) #end #end//macro Brett // SÄULE-MAKRO //////////////////////////////////////////////////////// ////// #macro Saeule ( N, W, R1, R2, H, T, R, A, V ) BrettAnfang ( H, T, R, A, V ) #local I = 0; #while (I color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } } #end//macro Saeule // DEMO-SZENEN ////////////////////////////////////////////////////////// //// #local HolzTex = texture { pigment { wood ramp_wave color_map { [.5 rgb <.95, .85, .55> ] [.6 rgb <.80, .65, .35> ] } turbulence <0.06, 0.01, 0.06> octaves 1 scale 0.3 } finish { ambient 0.3 diffuse 0.7 specular .2 roughness .02 } } #ifdef (Show) #if (Show>0) #local Nr=floor(clock*12+1.5); #local Typ = 0; #local BrettDebug = 0; #end #end #ifndef (Nr) #local Nr=0; #end #switch (Nr) #case (0) // keine Szene, nur Include-File ---------------------------- ---- #break//0 #case (1) // einfaches Brett ------------------------------------------ ---- #local Neigung = 1; BrettAnfang ( 2/Neigung, Typ, 0.3, <0, 0, -2>, <-1, 0, 3> ) BrettKante ( 2 , 0 ) BrettKante ( 0 ,120 ) BrettKante ( 1 , 0 ) BrettKante ( 4 ,-35 ) BrettKante ( 2.5,140 ) BrettKante ( 2 , 90 ) BrettKante ( 2 ,-40 ) BrettEnde ( 1 ) object { Brett () scale <1, Neigung, 1> texture { pigment { checker color rgb <1, .8, 0> color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } } #break//case 1 #case (2) // Brett mit Knubbel ---------------------------------------- ---- BrettAnfang ( 0.5, Typ, 0.1, <0,0,0>, <-1, 0, 3> ) BrettKante ( 2 , 0 ) BrettKante ( 0 , 90 ) BrettKante ( 1 , 0 ) BrettKante ( 1.5, -90 ) BrettKante ( 0.5, 270 ) BrettKante ( 0.5, -180 ) BrettKante ( 3 , 90 ) BrettKante ( 1 , 130 ) BrettKante ( 2 , -60 ) BrettKante ( 2 , 30 ) BrettEnde ( 1 ) object { Brett () texture { pigment { checker color rgb <1, .8, 0> color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } translate -3*z } #break//case 2 #case (3) // Oval ----------------------------------------------------- ---- #local Alpha = 50; #local Skal = 1.3; #local R1 = 1.5*Skal; #local R2=2.5*Skal; BrettAnfang ( 0.9, Typ, 0.2, <0,0,-1>, z ) BrettKante ( R1, Alpha ) BrettKante ( R2, 2*(90-Alpha) ) BrettKante ( R1, 2*Alpha ) BrettKante ( R2, 2*(90-Alpha) ) BrettEnde ( R1 ) object { Brett () texture { pigment { checker color rgb <1, .8, 0> color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } } #break//case 3 #case (4) // Einfaches Testbrett, nur n*90-Grad-Winkel ---------------- ------ BrettAnfang ( 1, Typ, 0.3, <1,0,3>, x/2+z ) BrettKante ( 1 , 0 ) BrettKante ( 1 , 90 ) BrettKante ( 1 , 0 ) BrettKante ( 1 ,-90 ) BrettKante ( 1 ,180 ) BrettKante ( 5 , 0 ) BrettKante ( 1.5, 90 ) BrettEnde ( 0.5 ) object { Brett () texture { pigment { checker color rgb <1, .8, 0> color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } translate -3*z } #break//case 4 #case (5) // "Banane" mit Artefakt ------------------------------------ ---- BrettAnfang ( 1, Typ, 0.3, -2*z, z) BrettKante ( 3 , 180 ) // => Artefakt BrettKante ( 0.5, 180 ) BrettKante ( 2 ,-180 ) BrettKante ( 0.2, 90 ) BrettKante ( 0.6, 0 ) BrettKante ( 0.2, 90 ) BrettEnde ( -1 ) object { Brett () texture { pigment { checker color rgb <1, .8, 0> color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } } #break//case 5 #case (6) // "Banane" ohne Artefakt, sanftere Rundungsübergänge --- -------- BrettAnfang ( 1, Typ, 0.3, -2*z, z) BrettMulti ( 3, 180, 3 ) // => kein Artefakt BrettKante ( 1.2, 5 ) BrettKante ( 0.5, 170 ) BrettKante ( 1.2, 5 ) BrettKante ( 2 ,-180 ) BrettKante ( 0.6, 5 ) BrettKante ( 0.2, 80 ) BrettKante ( 0.6, 5 ) BrettKante ( 0.522, 0 ) BrettKante ( 0.6, 5 ) BrettKante ( 0.2, 80 ) BrettKante ( 0.6, 5 ) BrettEnde ( -1 ) object { Brett () texture { pigment { checker color rgb <1, .8, 0> color rgb .8 } finish { ambient .4 diffuse .6 specular .4 } } } #break//case 6 #case (7) // Schickard-Seitenteil ------------------------------------- ---- BrettAnfang ( 1.4, Typ, 0.3, <0, 0, 57.5>, z ) // Start hinten fast g anz oben BrettKante ( 0.6, 90 ) BrettKante ( 13 , 0 ) // Oberkante BrettKante ( 0.6, 84 ) BrettKante ( 4.4, 0 ) BrettKante ( 0.6, -75 ) BrettKante ( 2.7, 150 ) // 1. Knubbel BrettKante ( 0.6, -75 ) BrettKante ( 1.5, 0 ) BrettKante ( 0.6, -75 ) BrettKante ( 3.6, 150 ) // 2. Knubbel BrettKante ( 0.6, -75 ) BrettKante ( 1.2, 0 ) BrettKante ( 0.6, -75 ) BrettKante ( 5.2, 150 ) // 3. Knubbel BrettKante ( 0.6,-149 ) BrettKante ( 8 , 0 ) // Schräge beim Rechenwerk BrettKante ( 0.6, 80 ) BrettKante ( 9.5, 0 ) // neben Einstellrädern BrettKante ( 0.6, -70 ) BrettKante ( 15 , 0 ) // Schräge neben Merkern BrettKante ( 0.6, 70 ) BrettKante ( 7 , 0 ) // Vorderkante BrettKante ( 0.6, 90 ) BrettEnde ( 0.6 ) #local B = object { Brett () texture { HolzTex scale 2 translate <8, -4, 0> rotate 3*x } scale 0.1 } object { B rotate <-90, 60, 0> translate <0.5, -2 , 0.2> } object { B rotate <180, 150, 0> translate <7 , -2.17, -1 > } light_source { <5, 5, -5>, color rgb 1 } #break//case 7 #case (8) // 7 Ausstülpungen ---------------------------------------- ------ Saeule ( 7, 290, 0.5, 0.6, 3, Typ, 0.3, <1, 0, -1>, -x ) #break//case 8 #case (9) // Säule -------------------------------------------------- ------ Saeule ( 15, 120, 0, 0.5, 4, Typ, 0.1, <1, 0, -4>, -x ) #break//case 9 #case (10) // Koch-Kurve ---------------------------------------------- ---- #local K = 3; // 2 ... 4 ( ... 5: slooooow! ) #local R = 0.4; // >0; <1 #undef BrettK #undef BrettW #undef BrettV #undef BrettP #declare BrettK = array [1880] #declare BrettW = array [1880] #declare BrettV = array [1880] #declare BrettP = array [1880] #local L = 2*pow(3,K); #macro KochBogen ( KBR, KBW ) #if (LetzterW=KBW) // letzten Bogen verlängern #local LetzterW = LetzterW+KBW; #else // neuer Bogen BrettKante (LetzterR, LetzterW) #local LetzterR = KBR; #local LetzterW = KBW; #end #end//macro KochBogen #macro Koch (I, W) #if (I>0) Koch ( I-1, W ) KochBogen ( (W>0?1-R:1+R), W ) Koch ( I-1, -W ) KochBogen ((-W>0?1-R:1+R), -W ) Koch ( I-1, W ) KochBogen ((-W>0?1-R:1+R), -W ) Koch ( I-1, -W ) KochBogen ( (W>0?1-R:1+R), W ) Koch ( I-1, W ) #end #end BrettAnfang ( 3, Typ, R, <1, 0, R-2>, -x ) #local LetzterR = 1-R; #local LetzterW = 180; Koch ( K, -90 ) BrettKante ( LetzterR, LetzterW ) BrettKante ( 1-R, 180 ) BrettKante ( L-2, 0 ) BrettEnde ( -1 ) #local B = Brett () object { B texture { pigment { rgb <.6, .6, 1> } finish { ambient .4 diffuse .5 specular .3 roughness 0.01 metalli c } } translate L/10*y scale 6/L translate <-1.25, 0, -3.5> } object { B texture { pigment { rgb <1, .6, .6> } finish { ambient .4 diffuse .5 specular .3 roughness 0.01 metalli c } } rotate -90*y translate scale 6/L translate <-1.25, 0, -3.5> } object { B texture { pigment { rgb <.6, 1, .6> } finish { ambient .4 diffuse .5 specular .3 roughness 0.01 metalli c } } scale <-1, 1, -1> translate <4/3*L, L/10, 2/3*L> scale 6/L translate <-1.25, 0, -3.5> } #break//case 10 #case (11) // Schiff -------------------------------------------------- ---- BrettAnfang( 1, Typ, 0.3, <9, 0, -9>, x) BrettKante ( 0 , -90 ) BrettKante ( 1.5, 0 ) BrettKante ( 0 , -90 ) BrettKante ( 8.7, 0 ) BrettKante ( 0 , 120 ) BrettKante ( 18 , 0 ) BrettKante ( 0 , 150 ) BrettKante (sqrt(243)+1.5, 0 ) BrettKante ( 0 , -90 ) BrettKante ( 6 , 0 ) BrettKante ( 0 , 150 ) BrettKante (20 , 50 ) BrettKante ( 0 , 50 ) BrettEnde ( 0 ) object { Brett () texture { HolzTex rotate 90*y } scale 0.4 } #break//case 11 #case (12) // Fass ---------------------------------------------------- ---- #local Radius = 1.5; #local Hoehe = 5; #local Rundung = Radius*.3; // >0; 0; <0.5*Hoehe #local Q = R_Hoehe/Rundung; BrettAnfang( Hoehe/Q, Typ, Rundung, 0, z) BrettMulti ( Radius-Rundung, 360, 2 ) BrettEnde ( -1 ) object { Brett () texture { HolzTex rotate 90*x scale 0.3 translate (Radius-Rundung)* x } scale <1, Q, 1> translate <2.5-Radius+Rundung, 0, -3.5> } #break//case 12 #case (13) // END ----------------------------------------------------- ---- #local Radius = 0.3; #local Hoehe = 1.5; #local Rundung = 0.1; // >0; , z ) BrettKante ( R , 90 ) BrettKante ( 2 , 0 ) BrettKante ( R , 180 ) BrettKante ( 2-R , 0 ) BrettKante ( 0 , -90 ) BrettKante ( 2-2*R, 0 ) BrettKante ( 0 , -90 ) BrettKante ( 1.5-R, 0 ) BrettKante ( R , 180 ) BrettKante ( 1.5-R, 0 ) BrettKante ( 0 , -90 ) BrettKante ( 2-2*R, 0 ) BrettKante ( 0 , -90 ) BrettKante ( 2-R , 0 ) BrettKante ( R , 180 ) BrettEnde ( R ) #end//macro E #macro N1 ( R, H ) #local W = degrees(atan2(1,2)); BrettAnfang( H, Typ, Rundung, <-1+R, 0, -2>, -z ) BrettKante ( R, 180 ) BrettKante ( 4, 0 ) BrettKante ( R, 180-W ) XZ_Schnitt ( BrettP[BrettI], BrettV[BrettI], <1-R, 0, 2>, -z ) BrettKante ( L1, 0 ) BrettKante ( 0,-180+W ) BrettKante ( L2, 0 ) BrettKante ( R, 180 ) BrettKante ( 4, 0 ) BrettKante ( R, 180-W ) BrettEnde ( 0 ) #end//macro N #macro D1 ( R, H ) BrettAnfang( H, Typ, Rundung, <-1-R, 0, 2>, z ) BrettKante ( R, 180 ) BrettKante ( 4, 0 ) BrettKante ( R, 180 ) BrettKante ( 4, 0 ) BrettEnde ( -1 ) #end//macro D1 #macro D2 ( R, H ) BrettAnfang( H, Typ, Rundung, <-1, 0, 2-R>, -x ) BrettKante ( 0, 90 ) BrettKante ( 2*R, 0 ) BrettKante ( 0, 90 ) BrettKante ( 1, 0 ) BrettKante ( 1+R, 90 ) BrettKante ( 2, 0 ) BrettKante ( 1+R, 90 ) BrettKante ( 1, 0 ) BrettKante ( 0, 90 ) BrettKante ( 2*R, 0 ) BrettKante ( 0, 90 ) BrettKante ( 1, 0 ) BrettKante ( 1-R, -90 ) BrettEnde ( 1-R ) #end//macro D2 union { E1 ( Radius, Hoehe ) object { Brett () translate -4*x } N1 ( Radius, Hoehe ) Brett () D1 ( Radius, Hoehe ) object { Brett () translate 4*x } D2 ( Radius, Hoehe ) object { Brett () translate 4*x } E1 ( 0.5+0.5*Radius, 2*Rundung+0.01 ) object { Brett () translate < -4, -2-2*Rundung, 0> } N1 ( 0.5+0.5*Radius, 2*Rundung+0.01 ) object { Brett () translate < 0, -2-2*Rundung, 0> } D1 ( 0.5+0.5*Radius, 2*Rundung+0.01 ) object { Brett () translate < 4, -2-2*Rundung, 0> } D2 ( 0.5+0.5*Radius, 2*Rundung+0.01 ) object { Brett () translate < 4, -2-2*Rundung, 0> } texture { HolzTex rotate 90*x scale 0.3 } scale 0.6 translate <3, 0, -1> }//union #break//case 13 // ---------------------------------------------------------------------- ---- #end//switch #ifdef (Show) #if (Nr>1&Nr!=10) #while (Show>0) #declare Show = Show- 0.01; #end #end #end // BELEUCHTUNG, KAMERA, HINTERGRUND ------------------------------------- ---- light_source { <-10, 10, -10>, color rgb 1 } camera { location <-5, 30, -30> look_at <3, 0, -1> angle 12 } #macro F(R)cone{y.04<-4,2>.02 rotate 90*R*x+9}#end union{F(0)F(1)F(2)F(3)sphere{0 1} finish{reflection 1phong 1}pigment{rgb 1} scale.3 translate<1,0,4>} sphere{-99*y 72pigment{blue 3}} // ENDE von Brett.inc /////////////////////////////////////////////////// ////