I can help you with that "what java.io classes and methods?"  stuff.

You will need a group of objects:
- A FileReader object
- A BufferedReader object
- A StringTokenizer objetc
- The Java's Float wrapper class


I) Open a FileReader with the file you want to read from:
java.io.FileReader fileReader = new java.io.FileReader("myFile.txt");

II) Couple a BufferedReader with your file reader. It will be necessary
because you will need BufferedReader's readLine() method.
java.io.BufferedReader buffReader = new
java.io.BufferedReader(fileReader);

III)Have a string receiving the contents of the readLine() method of your
BufferedReader. This is oversimplified, you'll have to check if the file
isn't over, etc.
String s;
s = buffReader.readLine();

IV)Create a StringTokenizer to parse that String:
StringTokenizer stok = new StringTokenizer(s);

IV)Keep reading the tokens and converting them to float (supposing you
want them to be float, they could be double, if you wanted):

float value;
while (stok.hasMoreElements()){
   value = java.lang.Float.parseFloat(stok.nextToken());
}


This steps I tought you will only help you to read floating point values
from a file. If you want to read vertex values you'll need at least three
of these values, anyway, you're the one who knows best your problem. Just
be sure before you start your particular need wouldn't be satisfied by
creating content in some 3D content authoring program and reading it
through content loaders.
A nice place to look for ideas about storing and representing geometry
would be the Java 3D Tutorial, that can be found following the
"collateral"  link at Java 3D home, I apologize for this suggestion if you
already read it. I guess you might como to ideas about storing vertex data
in a file reading the VRML97 spec, I guess from www.vrml.org.


                                        Hope I was useful

                                                        Fabio







On Wed, 22 Mar 2000, Sachin Myneni wrote:

>         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".

Reply via email to