motris.model
Class GenericVolumeRepresentation

java.lang.Object
  extended bymotris.data.Description
      extended byparameter.ParameterizedObjectAdaptor
          extended bymotris.model.VolumeRepresentation
              extended bymotris.model.GenericVolumeRepresentation
All Implemented Interfaces:
ParameterizedObject

public class GenericVolumeRepresentation
extends VolumeRepresentation

Represents a generic model consisting of

This model is saved in a ParameterSet having the following format: Besides the ParamterSet / XML format, the class also supports XTrack .gfpar file format reading

Author:
Hendrik Dahlkamp

Nested Class Summary
 
Nested classes inherited from class parameter.ParameterizedObject
ParameterizedObject.ParameterChangedListener, ParameterizedObject.ParameterizedObjectManager
 
Field Summary
private  boolean cacheValid
           
private  int[][] edgeCache
           
private  int[] paramCount
           
static java.lang.String[][] PARAMETER_NAMES
           
private  ParameterSet params
           
private  int[][] polygonCache
           
private  double[][] polygonNormalCache
           
private  Double4Vector[] polygonNormalCache2
           
private  boolean referencePointInMiddle
           
private  int[][] shadowConnectionsCache
           
private  double[][] vertexCache
           
private  Double4Vector[] vertexCache2
           
private  int[] verticeMap
           
 
Fields inherited from class motris.model.VolumeRepresentation
parent
 
Fields inherited from class parameter.ParameterizedObjectAdaptor
parameterChangedNotifyList
 
Fields inherited from class motris.data.Description
 
Constructor Summary
GenericVolumeRepresentation(RigidModel _parent, ParameterSet _params, State _state, java.lang.String inputFileName)
           
 
Method Summary
private  void computeCache()
           
private  void computeEdgeCache()
           
private  void computePolygonCache()
           
private  void computeVertexCache(double[] paramCache)
          Compute cache of Vertex cartesian coordinates
private  void computeVertexMap()
          Merge Vertices that share the same 3D coordinates
private  java.lang.String getParameterLongName(java.lang.String parameterShortName)
           
 ParameterSet getParameters()
          Get a Vector of Strings with a description of each Parameter
 boolean hasStructureChanged()
          Check whether the Structure (ie the set of edges and polygons, not just the position of the vertices) has changed
private  void readEdges(java.lang.String line, java.io.BufferedReader r, int[] polygonCount, int[] lineNo)
           
private  java.lang.String readFormParameters(java.lang.String fileName, java.io.BufferedReader r, int[] lineNo, State _state)
           
 boolean readFromXTrackFile(java.lang.String fileName, State _state)
           
private  java.lang.String readLineMatchingFormat(java.lang.String expectedFormat, java.lang.String fileName, java.io.BufferedReader r, int[] lineNo)
           
private  java.lang.String readLineStrippingComments(java.io.BufferedReader r, int[] lineNo)
           
private  java.lang.String readPolygons(java.lang.String line, java.io.BufferedReader r, int[] polygonCount, int[] lineNo)
           
private  java.lang.String readVertexMatrix(java.lang.String line, java.io.BufferedReader r, int[] lineNo)
           
 boolean setParameters(ParameterSet _params)
          Set Parameters of this class
 void updateSceneGeometry(SceneGeometry geometry, Camera cam, DoubleVector CameraOriginLocal, JSci.maths.DoubleSquareMatrix toGlobalTransform, DoubleMatrix[] firstDerivative)
          update the Scene geometry
 
Methods inherited from class parameter.ParameterizedObjectAdaptor
addParameterChangedListener, finalize, fireParameterChanged, parameterEdited, removeParameterChangedListener
 
Methods inherited from class motris.data.Description
getDescription, getIdentifier, getName, setDescription, setIdentifier, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_NAMES

public static java.lang.String[][] PARAMETER_NAMES

params

private ParameterSet params

paramCount

private int[] paramCount

vertexCache

private double[][] vertexCache

vertexCache2

private Double4Vector[] vertexCache2

polygonCache

private int[][] polygonCache

polygonNormalCache

private double[][] polygonNormalCache

polygonNormalCache2

private Double4Vector[] polygonNormalCache2

edgeCache

private int[][] edgeCache

shadowConnectionsCache

private int[][] shadowConnectionsCache

verticeMap

private int[] verticeMap

cacheValid

private boolean cacheValid

referencePointInMiddle

private boolean referencePointInMiddle
Constructor Detail

GenericVolumeRepresentation

public GenericVolumeRepresentation(RigidModel _parent,
                                   ParameterSet _params,
                                   State _state,
                                   java.lang.String inputFileName)
Method Detail

readLineStrippingComments

private java.lang.String readLineStrippingComments(java.io.BufferedReader r,
                                                   int[] lineNo)
                                            throws java.io.IOException
Throws:
java.io.IOException

readLineMatchingFormat

private java.lang.String readLineMatchingFormat(java.lang.String expectedFormat,
                                                java.lang.String fileName,
                                                java.io.BufferedReader r,
                                                int[] lineNo)
                                         throws java.io.IOException
Throws:
java.io.IOException

readFormParameters

private java.lang.String readFormParameters(java.lang.String fileName,
                                            java.io.BufferedReader r,
                                            int[] lineNo,
                                            State _state)
                                     throws java.io.IOException
Throws:
java.io.IOException

readVertexMatrix

private java.lang.String readVertexMatrix(java.lang.String line,
                                          java.io.BufferedReader r,
                                          int[] lineNo)
                                   throws java.io.IOException
Throws:
java.io.IOException

readPolygons

private java.lang.String readPolygons(java.lang.String line,
                                      java.io.BufferedReader r,
                                      int[] polygonCount,
                                      int[] lineNo)
                               throws java.io.IOException
Throws:
java.io.IOException

readEdges

private void readEdges(java.lang.String line,
                       java.io.BufferedReader r,
                       int[] polygonCount,
                       int[] lineNo)
                throws java.io.IOException
Throws:
java.io.IOException

readFromXTrackFile

public boolean readFromXTrackFile(java.lang.String fileName,
                                  State _state)

getParameterLongName

private java.lang.String getParameterLongName(java.lang.String parameterShortName)

computeVertexCache

private void computeVertexCache(double[] paramCache)
Compute cache of Vertex cartesian coordinates

Parameters:
paramCache -

computeVertexMap

private void computeVertexMap()
Merge Vertices that share the same 3D coordinates


computePolygonCache

private void computePolygonCache()

computeEdgeCache

private void computeEdgeCache()

computeCache

private void computeCache()
                   throws java.security.InvalidParameterException
Throws:
java.security.InvalidParameterException

getParameters

public ParameterSet getParameters()
Description copied from interface: ParameterizedObject
Get a Vector of Strings with a description of each Parameter

Specified by:
getParameters in interface ParameterizedObject
Overrides:
getParameters in class ParameterizedObjectAdaptor

setParameters

public boolean setParameters(ParameterSet _params)
Description copied from interface: ParameterizedObject
Set Parameters of this class

Specified by:
setParameters in interface ParameterizedObject
Overrides:
setParameters in class ParameterizedObjectAdaptor

updateSceneGeometry

public void updateSceneGeometry(SceneGeometry geometry,
                                Camera cam,
                                DoubleVector CameraOriginLocal,
                                JSci.maths.DoubleSquareMatrix toGlobalTransform,
                                DoubleMatrix[] firstDerivative)
Description copied from class: VolumeRepresentation
update the Scene geometry

Specified by:
updateSceneGeometry in class VolumeRepresentation
Parameters:
geometry - to be updated
CameraOriginLocal - camera origin in local (i.e. volume object) coordinates

hasStructureChanged

public boolean hasStructureChanged()
Description copied from class: VolumeRepresentation
Check whether the Structure (ie the set of edges and polygons, not just the position of the vertices) has changed

Specified by:
hasStructureChanged in class VolumeRepresentation
Returns:
structure changed