/* Suggested usage: #include this file (MasterOfPuppetsFont.inc) then modify and use the following code in your scene: #declare Gap = .16; //Set the distance between characters #declare Space = .7; //Set the distance between words CreateTextObject ("Your text here", Gap, Space) object {TextObject texture {TextColor} translate <-TextObjectWidth / 2, 0, 0>} //The macro will set the variable [TextObjectWidth] and the object will extend from x = 0 to x = [TextObjectWidth]. //In the example above the object will be centered horizontally with the base of the characters at y = 0. The characters //will be (1 + [FontRadius] * 2) units tall. //In the event that you need to apply kerning and/or different textures to the individual characters in your string, you //can use the following method instead of the CreateTextObject () macro: #local MyName = object { #local CurrentX = 0; union { object {Character [D_] texture {D_Color} translate CurrentX * x} #local CurrentX = CurrentX + CharacterWidth [D_] + FontRadius * 2 + Gap; object {Character [A_] texture {A_Color} translate CurrentX * x} #local CurrentX = CurrentX + CharacterWidth [A_] + FontRadius * 2 - .28; object {Character [V_] texture {V_Color} translate CurrentX * x} #local CurrentX = CurrentX + CharacterWidth [V_] + FontRadius * 2 + Gap; object {Character [E_] texture {E_Color} translate CurrentX * x} #local CurrentX = CurrentX + CharacterWidth [E_] + FontRadius * 2 + Gap; } //union } //object object {MyName} */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #declare Character = array [26]; #declare CharacterWidth = array [26]; #macro CreateTextObject (TextLine, Gap, Space) #local TextLine = strupr (TextLine); #declare TextObject = object { union { #local CurrentX = 0; #for (I, 1, strlen (TextLine)) #local AddCharacter = yes; #local CurrentCharacter = asc (substr (TextLine, I, 1)) - 65; #if (CurrentCharacter = 32 - 65) #local CurrentX = CurrentX + Space + FontRadius * 2; #local AddCharacter = no; #elseif (CurrentCharacter < 0 | CurrentCharacter > 25) #local CurrentCharacter = 0; #debug "\nOnly letters A - Z and [SPACE] are supported. A non-supported character was skipped.\n" #local AddCharacter = no; #end //#if #if (AddCharacter) object {Character [CurrentCharacter] translate CurrentX * x} #local CurrentX = CurrentX + CharacterWidth [CurrentCharacter] + Gap + FontRadius * 2; #end //#if #end //#for } //union translate } //object #declare TextObjectWidth = CurrentX - Gap; #end //#macro CreateTextObject /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #declare Gap = .16; //Default value; re-declare in your scene as necessary. #declare Space = .7; //Default value; re-declare in your scene as necessary. #declare FontRadius = .06; //This variable is available to use for positioning. #local R = FontRadius; #local CornerRadius = R; #local RoundedCorner = object { union { intersection { torus {CornerRadius, R sturm rotate 90 * x} plane {y, 0} plane {x, 0} } //intersection difference { box {<-CornerRadius, -CornerRadius, -R> <0, 0, R>} cylinder {<0, 0, -R - .1> <0, 0, R + .1>, CornerRadius} } //difference } //union } //object /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #declare A_ = 0; #declare B_ = 1; #declare C_ = 2; #declare D_ = 3; #declare E_ = 4; #declare F_ = 5; #declare G_ = 6; #declare H_ = 7; #declare I_ = 8; #declare J_ = 9; #declare K_ = 10; #declare L_ = 11; #declare M_ = 12; #declare N_ = 13; #declare O_ = 14; #declare P_ = 15; #declare Q_ = 16; #declare R_ = 17; #declare S_ = 18; #declare T_ = 19; #declare U_ = 20; #declare V_ = 21; #declare W_ = 22; #declare X_ = 23; #declare Y_ = 24; #declare Z_ = 25; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #declare Character [A_] = object { #local A1 = .03; #local A2 = .58; //Determines angle of sides #local A3 = .06; #local A4 = .13; //Width of top flat part, must be longer than A3 * 2 #declare CharacterWidth [A_] = A2 + A4 + A2; #local Theta = atan (1 / A2); #local SideLength = sqrt (A2 * A2 + 1); #local A_L1 = SideLength - A3; #local A_L2 = SideLength - A1; #local A_L3 = .28; //Determines height of crossbar #local A_L4 = .12; //Fix, controls length of legs #local A_X1 = A_L1 * cos (Theta); #local A_Y1 = A_L1 * sin (Theta); #local A_X2 = A_L2 * cos (Theta); #local A_Y2 = A_L2 * sin (Theta); #local A_X3 = A_L3 * cos (Theta); #local A_Y3 = A_L3 * sin (Theta); #local A_X4 = A_L4 * cos (Theta); #local A_Y4 = A_L4 * sin (Theta); #local RoundedCorner_A1 = object { #local TCornerRadius = CornerRadius * .75; #local Theta2 = Theta / 2; #local A_L5 = TCornerRadius / sin (Theta2); #local A_X5 = A_L5 * cos (Theta2); #local A_Y5 = A_L5 * sin (Theta2); union { intersection { torus {TCornerRadius, R sturm rotate 90 * x} plane {x, 0} plane {x, 0 rotate (90 - degrees (Theta2)) * z} } //intersection intersection { difference { box {<-1, -1, -R> <0, 1, R>} cylinder {<0, 0, -R - .1> <0, 0, R + .1>, TCornerRadius} } //difference plane {y, -TCornerRadius inverse} plane {x, TCornerRadius rotate (90 + degrees (Theta)) * z} plane {x, 0 rotate (90 - degrees (Theta2)) * z} } //intersection } //union } //object #local RoundedCorner_A2 = object { #local Theta = -radians (180 - degrees (Theta)); #local Theta2 = Theta / 2; #local A_L6 = CornerRadius / sin (Theta2); #local A_X6 = -A_L6 * cos (Theta2); #local A_Y6 = -A_L6 * sin (Theta2); union { intersection { torus {CornerRadius, R sturm rotate 90 * x} plane {x, 0} plane {x, 0 rotate (-degrees (Theta2)) * z inverse} } //intersection intersection { difference { box {<-1, 0, -R> <0, 1, R>} cylinder {<0, 0, -R - .1> <0, 0, R + .1>, CornerRadius} } //difference plane {y, CornerRadius} plane {x, -CornerRadius rotate (90 + degrees (Theta)) * z inverse} } //intersection } //union } //object union { sphere_sweep { b_spline 14 <-A2, -1, 0>, R , R , R , R , R , R , R , R , R , R , R , R , R , R } //sphere_sweep sphere_sweep { linear_spline 2 , R , R } //sphere_sweep object {RoundedCorner_A1 translate + } object {RoundedCorner_A1 rotate 180 * y translate + <-A_X5, A_Y5, 0>} object {RoundedCorner_A2 translate + } object {RoundedCorner_A2 rotate 180 * y translate + <-A_X6, A_Y6, 0>} } //union } //object #declare Character [B_] = object { #local B1 = .12; #local B2 = 1.08; //Top width #local B3 = .2; #local B4 = .52; //Vertical #local B5 = 1.13; //Bottom width #declare CharacterWidth [B_] = B5; union { sphere_sweep { linear_spline 4 <.5, 0, 0>, R <0, 0, 0>, R <0, 1, 0>, R <.5, 1, 0>, R } //sphere_sweep sphere_sweep { linear_spline 2 <0, B4, 0>, R <.5, B4, 0>, R } //sphere_sweep sphere_sweep { //Top b_spline 12 <-1, 1, 0>, R <.5, 1, 0>, R , R , R , R , R , R , R , R , R <.5, B4, 0>, R <-1, B4, 0>, R } //sphere_sweep sphere_sweep { //Bottom b_spline 12 <-1, B4, 0>, R <.5, B4, 0>, R , R , R , R , R , R , R , R , R <.5, 0, 0>, R <-1, 0, 0>, R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, 1, 0> + } object {RoundedCorner translate <0, B4, 0> + } object {RoundedCorner rotate 180 * x translate <0, B4, 0> + } object {RoundedCorner translate } } //union } //object #declare Character [C_] = object { #local C1 = .12; #local C2 = 1.13; #local C3 = .2; #local C4 = C1 + C3 + .01; //C4 must be > C1 + C3 #declare CharacterWidth [C_] = C2; sphere_sweep { b_spline 18 , R , R , R , R , R , R , R <0, C1, 0>, R <0, C1 + C3, 0>, R <0, 1 - C1 - C3, 0>, R <0, 1 - C1, 0>, R , R , R , R , R , R , R , R } //sphere_sweep } //object #declare Character [D_] = object { #local D1 = .12; #local D2 = 1.13; #local D3 = .2; #declare CharacterWidth [D_] = D2; union { sphere_sweep { linear_spline 4 <.5, 0, 0>, R <0, 0, 0>, R <0, 1, 0>, R <.5, 1, 0>, R } //sphere_sweep sphere_sweep { b_spline 12 <-1, 1, 0>, R <.5, 1, 0>, R , R , R , R , R , R , R , R , R <.5, 0, 0>, R <-1, 0, 0>, R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, 1, 0> + } object {RoundedCorner translate } } //union } //object #declare Character [E_] = object { #local E1 = .98; //Top and bottom bars #local E2 = .945; //Middle bar #local E3 = .52; //Vertical #declare CharacterWidth [E_] = E1; union { sphere_sweep { linear_spline 4 , R <0, 0, 0>, R <0, 1, 0>, R , R } //sphere_sweep sphere_sweep { linear_spline 2 <0, E3, 0>, R , R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, 1, 0> + } object {RoundedCorner translate <0, E3, 0> + } object {RoundedCorner rotate 180 * x translate <0, E3, 0> + } object {RoundedCorner translate } } //union } //object #declare Character [F_] = object { #local F1 = .95; //Top bar #local F2 = .915; //Bottom bar #local F3 = .5; //Vertical #declare CharacterWidth [F_] = F1; union { sphere_sweep { linear_spline 3 <0, 0, 0>, R <0, 1, 0>, R , R } //sphere_sweep sphere_sweep { linear_spline 2 <0, F3, 0>, R , R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, 1, 0> + } object {RoundedCorner translate <0, F3, 0> + } object {RoundedCorner rotate 180 * x translate <0, F3, 0> + } } //union } //object #declare Character [G_] = object { #local G1 = .12; #local G2 = 1.13; #local G3 = .2; #local G4 = G1 + G3 + .13; //C4 must be > G1 + C3 #local G5 = G2 / 2; #declare CharacterWidth [G_] = G2; union { sphere_sweep { b_spline 18 , R //, R , R //Fix , R , R , R , R , R , R <0, G1, 0>, R <0, G1 + G3, 0>, R <0, 1 - G1 - G3, 0>, R <0, 1 - G1, 0>, R , R , R , R , R , R , R } //sphere_sweep sphere_sweep { linear_spline 2 , R , R } //sphere_sweep object {RoundedCorner rotate 180 * x rotate 180 * y translate + <-CornerRadius, -CornerRadius, 0>} } //union } //object #declare Character [H_] = object { #local H1 = .95; #local H2 = .5; //Vertical #declare CharacterWidth [H_] = H1; union { sphere_sweep { linear_spline 2 <0, 0, 0>, R <0, 1, 0>, R } //sphere_sweep sphere_sweep { linear_spline 2 , R , R } //sphere_sweep sphere_sweep { linear_spline 2 <0, H2, 0>, R , R } //sphere_sweep object {RoundedCorner translate <0, H2, 0> + } object {RoundedCorner rotate 180 * x translate <0, H2, 0> + } object {RoundedCorner rotate 180 * y translate + <-CornerRadius, CornerRadius, 0>} object {RoundedCorner rotate 180 * y rotate 180 * x translate + <-CornerRadius, -CornerRadius, 0>} } //union } //object #declare Character [I_] = object { #declare CharacterWidth [I_] = 0; sphere_sweep { linear_spline 2 <0, 0, 0>, R <0, 1, 0>, R } //sphere_sweep } //object #declare Character [J_] = object { #local J1 = .15; #local J2 = .98; #local J3 = .2; #declare CharacterWidth [J_] = J2; union { sphere_sweep { b_spline 10 , R //, R , R //Fix , R , R , R , R , R , R <0, J1, 0>, R <0, J1 + J3, 0>, R } //sphere_sweep sphere_sweep { linear_spline 2 <.5, 1, 0>, R , R } //sphere_sweep object {RoundedCorner rotate 180 * x rotate 180 * y translate + <-CornerRadius, -CornerRadius, 0>} } //union } //object #declare Character [K_] = object { #local K1 = .5; //Vertical #local K2 = .2; //Width of horizontal bar #local K3 = .45; //Width1 #local K4 = 1; //Width2 #declare CharacterWidth [K_] = K4; union { sphere_sweep { linear_spline 2 <0, 0, 0>, R <0, 1, 0>, R } //sphere_sweep sphere_sweep { //Bottom b_spline 5 <-1, K1, 0>, R , R , R , R , R } //sphere_sweep sphere_sweep { //Top b_spline 5 <-1, K1, 0>, R , R , R , R , R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, K1, 0> + } object {RoundedCorner translate <0, K1, 0> + } } //union } //object #declare Character [L_] = object { #local L1 = .98; #declare CharacterWidth [L_] = L1; union { sphere_sweep { linear_spline 3 , R <0, 0, 0>, R <0, 1, 0>, R } //sphere_sweep object {RoundedCorner translate } } //union } //object #declare Character [M_] = object { #local M1 = .12; #local M2 = .7; #local M3 = .02; #local M4 = M1 * .14; #declare CharacterWidth [M_] = M1 + M2 + M3 + M2 + M1; sphere_sweep { b_spline 16 <0, -1, 0>, R <0, 0, 0>, R <0, 1 - M4, 0>, R , R , R , R , R , R , R , R , R , R , R , R , R , R } //sphere_sweep } //object #declare Character [N_] = object { #local N1 = .12; #local N2 = 1; #local N3 = N1 * .14; #declare CharacterWidth [N_] = N1 + N2 + N1; sphere_sweep { b_spline 12 <0, -1, 0>, R <0, 0, 0>, R <0, 1 - N3, 0>, R , R , R , R , R , R , R , R , R , R } //sphere_sweep } //object #declare Character [O_] = object { #local O1 = .15; #local O2 = 1.3; #local O3 = .2; #declare CharacterWidth [O_] = O2; sphere_sweep { b_spline 19 , R , R <0, O1, 0>, R <0, O1 + O3, 0>, R <0, 1 - O1 - O3, 0>, R <0, 1 - O1, 0>, R , R , R , R , R , R , R , R , R , R , R , R , R <0, O1, 0>, R } //sphere_sweep } //object #declare Character [P_] = object { #local P1 = .12; #local P2 = 1.13; #local P3 = .2; #local P4 = .42; //Vertical #declare CharacterWidth [P_] = P2; union { sphere_sweep { linear_spline 3 <0, 0, 0>, R <0, 1, 0>, R <.5, 1, 0>, R } //sphere_sweep sphere_sweep { linear_spline 2 <0, P4, 0>, R <.5, P4, 0>, R } //sphere_sweep sphere_sweep { b_spline 12 <-1, 1, 0>, R <.5, 1, 0>, R , R , R , R , R , R , R , R , R <.5, P4, 0>, R <-1, P4, 0>, R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, 1, 0> + } object {RoundedCorner translate <0, P4, 0> + } object {RoundedCorner rotate 180 * x translate <0, P4, 0> + } } //union } //object #declare Character [Q_] = object { #local Q1 = .9; #local Q2 = .15; #declare CharacterWidth [Q_] = CharacterWidth [O_]; union { object {Character [O_]} sphere_sweep { linear_spline 2 , R , R } //sphere_sweep object {RoundedCorner rotate 180 * x rotate 180 * y translate + <-CornerRadius, -CornerRadius, 0>} object {RoundedCorner rotate 180 * x translate + } object {RoundedCorner translate + } object {RoundedCorner rotate 180 * y translate + <-CornerRadius, CornerRadius, 0>} } //union } //object #declare Character [R_] = object { #local R1 = .12; #local R2 = 1.13; //Top width #local R3 = .2; #local R4 = .42; //Vertical #local R5 = R2 + .05; //Bottom width #declare CharacterWidth [R_] = R5; union { sphere_sweep { linear_spline 3 <0, 0, 0>, R <0, 1, 0>, R <.5, 1, 0>, R } //sphere_sweep sphere_sweep { linear_spline 2 <0, R4, 0>, R <.5, R4, 0>, R } //sphere_sweep sphere_sweep { //Top b_spline 12 <-1, 1, 0>, R <.5, 1, 0>, R , R , R , R , R , R , R , R , R <.5, R4, 0>, R <-1, R4, 0>, R } //sphere_sweep sphere_sweep { //Bottom b_spline 8 <-1, R4, 0>, R <.5, R4, 0>, R , R , R , R , R , R , R } //sphere_sweep object {RoundedCorner rotate 180 * x translate <0, 1, 0> + } object {RoundedCorner translate <0, R4, 0> + } object {RoundedCorner rotate 180 * x translate <0, R4, 0> + } } //union } //object #declare Character [S_] = object { #local S1 = .12; #local S2 = 1.14; #local S3 = .2; #local S4 = .5; //Vertical #local S5 = .15; //Must be longer than S1 + S3 #local S6 = .22; //Length of ends #declare CharacterWidth [S_] = S2; union { difference { sphere_sweep { b_spline 28 <0, 1, 0>, R <0, S5, 0>, R <0, S1 + S3, 0>, R <0, S1, 0>, R , R , R , R , R , R , R , R , R , R , R , R , R <0, S4 + S1, 0>, R <0, S4 + S1 + S3, 0>, R <0, 1 - S1 - S3, 0>, R <0, 1 - S1, 0>, R , R , R , R , R , R , R , R , R } //sphere_sweep box {<-1, S6, -1> <.15, S5 + .25, 1>} box { } } //difference intersection { sphere {<0, 0, 0>, R} plane {y, 0 inverse} rotate 0 * z translate <.002, S6, 0> } //intersection intersection { sphere {<0, 0, 0>, R} plane {y, 0} rotate -1 * z translate } //intersection } //union } //object #declare Character [T_] = object { #local T1 = 1.16; //Top bar #declare CharacterWidth [T_] = T1; union { sphere_sweep { linear_spline 2 , R , R } //sphere_sweep sphere_sweep { linear_spline 2 <0, 1, 0>, R , R } //sphere_sweep object {RoundedCorner rotate 180 * x rotate 180 * y translate + <-CornerRadius, -CornerRadius, 0>} object {RoundedCorner rotate 180 * x translate + } } //union } //object #declare Character [U_] = object { #local U1 = .15; #local U2 = 1.19; #local U3 = .2; #declare CharacterWidth [U_] = U2; sphere_sweep { b_spline 12 , R , R , R , R , R , R , R , R <0, U1, 0>, R <0, U1 + U3, 0>, R <0, 1, 0>, R <0, 1.65, 0>, R } //sphere_sweep } //object #declare Character [V_] = object { #local V1 = .565; //Determines angle of sides #local V2 = .983; //Vertical #local V3 = .14; //Width of bottom flat part #local V4 = .9; #declare CharacterWidth [V_] = V1 + V3 + V1; sphere_sweep { b_spline 8 <-V1, V2, 0>, R <0, 0, 0>, R , R , R , R , R , R , R } //sphere_sweep translate V2 * y } //object #declare Character [W_] = object { #local W1 = .12; #local W2 = .7; #local W3 = .02; #local W4 = W1 * .14; #local W5 = .36; #declare CharacterWidth [W_] = W1 + W2 + W3 + W2 + W1; sphere_sweep { b_spline 16 <0, -1, 0>, R <0, 0, 0>, R <0, 1 - W4, 0>, R , R , R , R , R , R , R , R , R , R , R , R , R , R } //sphere_sweep rotate 180 * z translate } //object #declare Character [X_] = object { #local X1 = sqrt (2); #declare CharacterWidth [X_] = 1; union { #local Bar = object { sphere_sweep { linear_spline 2 <0, -X1 / 2, 0>, R <0, X1 / 2, 0>, R } //sphere_sweep } //object object {Bar} object {Bar rotate 90 * z} object {RoundedCorner rotate 180 * x rotate 180 * y translate <-CornerRadius, -CornerRadius, 0>} object {RoundedCorner rotate 180 * x translate } object {RoundedCorner translate } object {RoundedCorner rotate 180 * y translate <-CornerRadius, CornerRadius, 0>} } //union rotate 45 * z translate <.5, .5, 0> } //object #declare Character [Y_] = object { #local Y1 = .45; //Determines angle of sides #local Y2 = .491; //Vertical #local Y3 = .2; //Width of bottom flat part #local Y4 = .9; #local Y5 = .5; //Height of stem #declare CharacterWidth [Y_] = Y1 + Y3 + Y1; union { sphere_sweep { b_spline 8 <-Y1, Y2, 0>, R <0, 0, 0>, R , R , R , R , R , R , R translate (Y2 + Y5) * y } //sphere_sweep sphere_sweep { linear_spline 2 , R , R } //sphere_sweep object {RoundedCorner rotate 180 * x rotate 180 * y translate + <-CornerRadius, -CornerRadius, 0>} object {RoundedCorner rotate 180 * x translate + } } //union } //object #declare Character [Z_] = object { #local N1 = .12; #local N2 = .7; #local N3 = N1 * .14; #local N4 = N1 + N2 + N1; #local Z1 = .12; #local Z2 = .7; #local Z3 = Z1 * .14; #local Z4 = 1.05; //Total width #local Z5 = .94; #declare CharacterWidth [Z_] = Z4; sphere_sweep { b_spline 12 <-1, 1, 0>, R <0, 1, 0>, R , R , R , R , R <.05, Z5 - Z1 - Z2 * .95, 0>, R <0, Z5 - Z1 - Z2 - Z3, 0>, R <0, Z3, 0>, R , R , R , R } //sphere_sweep } //object