Yes Don,
My input file is very "rigidly" formatted and it is in ASCII format. The
format is as follows:
        int int double double double double double double
        ... ... ...... ...... ...... ...... ...... ......
        ...
        ...

I have no prior knowledge of how many of these rows are present, but each
one will definitely have this format. One progress that I have made is that
I have used StreamTokenizer to read in the values, but it seems to take the
int as a double (Ofcourse I don't foresee any problems with that right now).

The last three "double" are the [x y z] of a point. The three "double"
numbers before is a normal to the triangle to which [x y z] belongs. I am
working on STL files :-( for Rapid Prototyping application.
One more issue is that, the first 2 integers are "linked" to the normal and
vertex data. I need to process the vertices depending on the value of first
2 integers. So I guess I am looking for a way to hold the two integers, the
normal array and the vertex array inside one object and be able to
manipulate each set depending on the need. What do you think is the best
approach? I have just started reading about Vectors (though I don't know if
I will implement threads in my code), but I would really like to know the
other approaches.


And thanks for the mails folks.
-Sachin


-----Original Message-----
From: Casteel, Don [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2000 9:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Reading values of type double from a file


Reading isn't much of a problem if you can get the data in a DXF or OBJ, or
VRML format beforehand.

Writing is tougher, there are curently no export classes to support standard
formats. I personally had to write my own exporter for the last project I
worked on, and it only produced raw triangle format files (.RAW).

Creating a reader for .RAW files wouldn't be much of a problem either.


Even if your data isn't in a standard format, writing a filereader isn't
hard at all as long as you know exactly what you're reading.

Is your data in ASCII format?
Do you know the structure of the data file?

Here's a set of file reader/writer methods which save to and read from files
(containg non ASCII integers ) to and from a pair of arrays of textboxes.
(the number of textboxes doesn't change, so I don't have to keep track of
where the topOven & botOven int's are in the file)




        public void saveFile()
                {
                fileDialog.setMode(fileDialog.SAVE);
                fileDialog.show();
                if(directory != null){fileDialog.setDirectory(directory); };
                file = new File(fileDialog.getFile());
                try
                        {
                        FileOutputStream outputStream = new
FileOutputStream(file);
                        for(int t=0;
t<java.lang.reflect.Array.getLength(topOven);t++)
                                {
                                outputStream.write(
Integer.parseInt(topOven[t].getText().trim()));
                                };
                        for(int t=0;
t<java.lang.reflect.Array.getLength(botOven);t++)
                                {
                                outputStream.write(
Integer.parseInt(botOven[t].getText().trim()));
                                };
                        outputStream.close();
                        }
                catch (Exception e){};
                };

        public void openFile()
                {
                fileDialog.setMode(fileDialog.LOAD);
                fileDialog.show();
                file = new File(fileDialog.getFile());
                directory = new File(fileDialog.getDirectory());
                try
                        {
                        FileInputStream inputStream = new
FileInputStream(file);
                        for(int t=0;
t<java.lang.reflect.Array.getLength(topOven);t++)
                                {

topOven[t].setText(Integer.toString(inputStream.read()));
[..... more processing here that's not related.....]
                                };
                        for(int t=0;
t<java.lang.reflect.Array.getLength(botOven);t++)
                                {

botOven[t].setText(Integer.toString(inputStream.read()));
[..... more processing here that's not related.....]
                                };
                        inputStream.close();
                        }
                catch (Exception e){};
                };



-----Original Message-----
From: Sachin Myneni [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2000 8:31 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Reading values of type double from a file


        Hi Everyone,
        I have recently joined this mailing list (and infact recently
started using JAVA). I am developing a software which involves a HUGE number
of vertices. These vertices are divided into groups. That is, each set
represents a plane. Each of these planes have to be transformed (rotation
and translation).
*       I have to read this vertices from a file, and I am not able to
figure out which java.io classes and methods, should I use to read these
"double" values from a file into an array (arrayList maybe???).
*       What is the best way to store these points? The total number of
points do not change (till I am ready to write them into a file after some
calculation) and I frequently need to pull out these points sequentially.

        Any suggestion would be a huge help. And could someone point me
towards a book/resource which deals in examples with reading/storing
geometric data?

        Thanks
        -Sachin

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to