mr3d.io
Interface FileReader

All Known Implementing Classes:
TriangleBasedModelReader

public interface FileReader

The interface FileReader will be implemented by all object classes that read and interpret 3d-object files.

Since:
MR3Dv1.0
Version:
12-2004
Author:
Manuel Ruelke

Method Summary
 void dispose()
          Deletes all data aquired from the file.
 int getNrOfPoints()
          Returns the number of points in the object.
 int getNrOfTriangles()
          Returns the number of triangles in the object.
 int[] getPoint(int index)
          Returns the point with the specified index as an array.
 int[][] getTriangle(int nr)
          Returns data to construct a 3D triangle from.
 boolean hasErrors()
          Determines if an error occured in processing the object.
 

Method Detail

dispose

public void dispose()
Deletes all data aquired from the file.


getNrOfPoints

public int getNrOfPoints()
Returns the number of points in the object.


getNrOfTriangles

public int getNrOfTriangles()
Returns the number of triangles in the object.


getPoint

public int[] getPoint(int index)
Returns the point with the specified index as an array. Element 0 is x, 1 is y, 2 is z and 4 is either 0 if it's a normal point or 1 if it's a reference point.

Parameters:
index - index of the point

getTriangle

public int[][] getTriangle(int nr)
Returns data to construct a 3D triangle from. Indexing starts with 0, which is the triangle closest to the beginning of the file.

The array is constructed as follows:

[0][0] = id of start point of edge 1
[0][1] = id of end point of edge 1
[1][0] = id of start point of edge 2
[1][1] = id of end point of edge 2
[2][0] = id of start point of edge 3
[2][1] = id of end point of edge 3
[3][0] = triangle color

Parameters:
nr - number of the triangle in the file
Returns:
array of int containg the point array indices of the start and end points of the three edges of a triangle.

hasErrors

public boolean hasErrors()
Determines if an error occured in processing the object.

Returns:
true if an error has occured, false if everything is ok