#include "colors.inc" //284 by 213 for big (140 x 140) icon //320 by 240 for tutorial image //142 by 106 for small (70 x 70) icon camera { location <0,0.5,-2> look_at <0,0.5,0> } light_source { <20,90,-50> color White } background { color White } #declare tri_thickness = 0.025; #declare tri_top = .9; #declare tri_bottom = 0; #declare tri_left = 0; #declare tri_right = 1.15; #declare text_scale = .2; #declare text_trans = tri_thickness*1.4; #declare acolor = color Red; #declare bcolor = color Green; #declare ccolor = color Blue; #declare tri_finish = finish { ambient .4 } #declare tri_Font = "timrom.ttf" #declare text_thickness = tri_thickness/2; #declare text_width = .5*text_scale; #declare text_height = text_scale; union { //draw side b union { //side cylinder { ,,tri_thickness } //angle marker text { ttf tri_Font, "B", text_thickness,0 scale translate //at what side a for angle B is side b equal to text_width? //get angle B #declare sideb = tri_right; #declare sidea = tri_top; #declare angleB = degrees(atan2(sideb,sidea)); //now, get the smaller side a #declare sideb = text_width; #declare sidea = sideb/tan(radians(angleB)); translate <0,-sidea,0> } //the side marker text { ttf tri_Font, "b", text_thickness,0 scale translate } texture { pigment { color bcolor } finish { tri_finish } } } //draw side a union { //the side cylinder { ,,tri_thickness } //the angle marker for A text { ttf tri_Font, "A", text_thickness,0 scale translate //at what side b for angle A is side a equal to text_height? //get angle A #declare sideb = tri_right; #declare sidea = tri_top; #declare angleA = degrees(atan2(sidea,sideb)); //now, get the smaller side b #declare sidea = text_height; #declare sideb = sidea/tan(radians(angleA)); translate <-sideb,0,0> } //the side marker for a text { ttf tri_Font, "a", text_thickness,0 scale translate <-text_trans-text_width,tri_top/2-text_height/2,0> } texture { pigment { color acolor } finish { tri_finish } } } //draw side c union { //the side cylinder { ,,tri_thickness } //angle marker for C text { ttf tri_Font, "C", text_thickness,0 scale translate } //the side marker for c text { ttf tri_Font, "c", text_thickness,0 scale //at what angle A does the letter have to be rotated? //get the angle A #declare sideb = tri_right; #declare sidea = tri_top; #declare angleA = degrees(atan2(sidea,sideb)); //get the side c #declare sidec = sqrt(sidea*sidea + sideb*sideb)/2; //get the smaller side b #declare sideb = sidec * cos(radians(angleA)); translate <-sidec,text_trans,0> rotate <0,0,-angleA> translate } texture { pigment { color ccolor } finish { tri_finish } } } }