import java.io.*; import java.util.Random; import java.lang.Math; public class MessageToSpheres { public static void main(String[] args) { new MessageToSpheres(args[0]); } public MessageToSpheres(String name) { String aLine = ""; String bLine = ""; double value=0; double value0=0; double max=value; double min=value; double slope=0; int intvalue=(int)value; int n_of_notes=0; double nextvalue=value; String tot_message=""; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// //Reading from file String filename="message.txt"; if (name!=""){ filename=name; } try{ //calculate scale factor and normalization int cnt=0; FileInputStream fin = new FileInputStream(filename); BufferedReader myInput = new BufferedReader (new InputStreamReader(fin)); while ((aLine = myInput.readLine()) != null){ tot_message=tot_message+removeSpaces(aLine); } }catch( Exception e ) { e.printStackTrace(); }//end catch ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// int max_number_of_notes=tot_message.length(); n_of_notes=tot_message.length(); int[] pitches = new int[n_of_notes]; int[] values = new int[n_of_notes]; //convert the message lowecase //tot_message=tot_message.toLowerCase(); try{ int cnt=0; System.out.println("String length = "+ tot_message.length()); while (cnt,"+String.valueOf(r); if (Math.random()>0.6){ line+= " pigment {"+String.valueOf(color)+" filter "+String.valueOf(filter)+"}"; } else { line+= " pigment {"+String.valueOf(color)+"}"; } line +=" finish {reflection {"+String.valueOf(reflection)+"} ior "+String.valueOf(ior)+"}} \n"; } else { line+="sphere {<"+String.valueOf((int)x)+","+String.valueOf((int)y)+","+String.valueOf((int)z)+">,"+String.valueOf((int)r)+ " texture {Texture_1}} \n"; } } System.out.print(line); povraydata.write(ConvertStringToByte(line)); povraydata.close(); /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// FileInputStream MioInFilStr = null; FileOutputStream MioOutFilStr = null; int LungFile = 0; try { MioInFilStr = new FileInputStream("template1.pov"); } catch (IOException e) { System.out.println("Error: " + e + " "); System.exit(0); } try { MioOutFilStr = new FileOutputStream("MessageToSpheres1.pov"); } catch (IOException e) { System.out.println("Error: " + e + " during file creation"); System.exit(0); } try { LungFile = MioInFilStr.available(); // Mi informo sul num. bytes. } catch (IOException e) { System.out.println("Errore: " + e + " determinando la lungh. di un file"); System.exit(0); } try { for(int i=0; i