Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
edu.tum.cs.vis.model.Model Class Reference

List of all members.

Public Member Functions

void draw (PGraphics g, DrawSettings drawSettings)
File exportVerticesAsTxt ()
boolean exportVerticesAsTxt (File path, boolean overwrite)
float feature_size ()
float getAvgGaussCurvature ()
float getAvgMeanCurvature ()
BSphere getBoundingSphere ()
Group getGroup ()
float getHighGaussCurvature ()
float getHighMeanCurvature ()
List< LinegetLines ()
float getLowGaussCurvature ()
float getLowMeanCurvature ()
List< RegiongetRegions ()
HashMap< Integer, RegiongetRegionsMap ()
float getScale ()
double getSizeX ()
double getSizeY ()
double getSizeZ ()
String getTextureBasePath ()
List< TrianglegetTriangles ()
float getUnscaled (float scaled)
Tuple3f[] getUnscaled (Point3f[] corner)
Tuple3f getUnscaled (Tuple3f t)
Vector3f getUnscaled (Vector3f t)
float getVarGaussCurvature ()
float getVarMeanCurvature ()
List< VertexgetVertices ()
void mirrorX ()
void normalize ()
void reloadVertexList ()
int removeDoubleSidedTriangles ()
void scale (float factor)
void setAvgGaussCurvature (final float avgGaussCurvature)
void setAvgMeanCurvature (final float avgMeanCurvature)
void setGroup (Group group)
void setHighGaussCurvature (final float highGaussCurvature)
void setHighMeanCurvature (final float highMeanCurvature)
void setLowGaussCurvature (final float lowGaussCurvature)
void setLowMeanCurvature (final float lowMeanCurvature)
void setRegions (List< Region > regions)
void setTextureBasePath (String textureBasePath)
void setVarGaussCurvature (final float varGaussCurvature)
void setVarMeanCurvature (final float varMeanCurvature)
void updateVertexNormals ()
void updateVertexSharing ()

Private Member Functions

void calculateBoundingsphere ()
void updateVertexSharingForNeighbors (final Triangle t, final Triangle n, final Set< Triangle > checkedTriangles, Set< Vertex > toRemove)
void updateVertexSharingForTriangle (final Triangle t, final Set< Triangle > checkedTriangles, final Set< Vertex > toRemove)

Static Private Member Functions

static void calculateVertexNormalsForTriangle (final Triangle t)

Private Attributes

float avgGaussCurvature = 0f
float avgMeanCurvature = 0f
BSphere boundingSphere = null
Group group
float highGaussCurvature = Float.MIN_VALUE
float highMeanCurvature = Float.MIN_VALUE
final List< Linelines = new ArrayList<Line>()
float lowGaussCurvature = Float.MAX_VALUE
float lowMeanCurvature = Float.MAX_VALUE
boolean normalsInitialized = false
final List< Regionregions = new ArrayList<Region>()
float scale = 1f
String textureBasePath = null
final List< Triangletriangles = new ArrayList<Triangle>()
float varGaussCurvature = 0f
float varMeanCurvature = 0f
final List< Vertexvertices = new ArrayList<Vertex>()

Static Private Attributes

static final Logger LOGGER = Logger.getLogger(Model.class)

Detailed Description

Class which implements the architecture and functionality of a CAD model loaded from file. A CAD model consists of triangles, edges and vertices. These can be grouped hierarchically into subgroups based on the parsing of the model. Additionally information about the surface of the model's mesh is stored by the average, variance, minimum and maximum curvature properties.

Author:
Stefan Profanter
Andrei Stoica

Definition at line 53 of file Model.java.


Member Function Documentation

Calculates the bounding sphere for the model. Calculated by Miniball class.

See also:
edu.tum.cs.vis.model.util.algorithm.Miniball

Definition at line 982 of file Model.java.

static void edu.tum.cs.vis.model.Model.calculateVertexNormalsForTriangle ( final Triangle  t) [inline, static, private]

Calculate vertex normals for each vertex of a triangle.

Parameters:
tTriangle

Definition at line 825 of file Model.java.

void edu.tum.cs.vis.model.Model.draw ( PGraphics  g,
DrawSettings  drawSettings 
) [inline]

Draws the model starting from its main group of triangles. The rendering is performed in breadth by going into all children of the parent group.

Parameters:
gGraphics context to draw on
drawSettingsSettings for drawing the model, e.g. to override face color of model. Useful if you want to ignore color of model and draw whole model in a specific color.

Definition at line 158 of file Model.java.

Export the vertices of the model into a temporary txt file with the format:

 NUMBER_OF_POINTS
 x1	y1	z1	nx1	nx2	nx3
 x2	y2	z2	nx2	nx2	nx2
 

where the first 3 values are the coordinates of the point, the next 3 values represent the normal vector.

The file name is generated in the temporary directory and will be unique.

Returns:
the file containing the exported model or null on error

Definition at line 885 of file Model.java.

boolean edu.tum.cs.vis.model.Model.exportVerticesAsTxt ( File  path,
boolean  overwrite 
) [inline]

Export the vertices of the model into a txt file with the format:

 NUMBER_OF_POINTS
 x1	y1	z1	nx1	nx2	nx3
 x2	y2	z2	nx2	nx2	nx2
 

where the first 3 values are the coordinates of the point, the next 3 values represent the normal vector.

Parameters:
paththe path to the file where to store the data
overwriteoverwrite existing file
Returns:
true on success

Definition at line 916 of file Model.java.

A characteristic "feature size" for the mesh. Computed as the median edge length.

Ported (and modified) from trimesh2 library (version: 2.12)

Returns:
median edge length

Definition at line 1007 of file Model.java.

Gest the average Gaussian curvature value of the model.

Returns:
avgGaussCurvature value of the CAD model

Definition at line 304 of file Model.java.

Gets the average mean curvature value of the model.

Returns:
avgMeanCurvature value of the CAD model

Definition at line 295 of file Model.java.

Gets the bounding sphere set by Miniball class.

See also:
edu.tum.cs.vis.model.util.algorithm.Miniball
Returns:
the boundingSphere

Definition at line 170 of file Model.java.

Gets main group of the model

Returns:
the group

Definition at line 181 of file Model.java.

Gets the highest Gaussian curvature value of the object. If this is equal to FLoat.MIN_VALUE, then it has not been set (default valued).

Returns:
highGaussCurvature value of the CAD model

Definition at line 286 of file Model.java.

Gets the highest mean curvature value of the object. If this is equal to Float.MIN_VALUE, then it has not been set (default valued).

Returns:
highMeanCurvature value of the CAD model

Definition at line 266 of file Model.java.

Gets all lines of the model

Returns:
the lines

Definition at line 190 of file Model.java.

Gets the lowest Gaussian curvature value of the object. If this is equal to Float.MAX_VALUE, then it has not been set (default valued).

Returns:
lowGaussCurvature value of the CAD model

Definition at line 276 of file Model.java.

Gets the lowest mean curvature value of the object. If this is equal to Float.MAX_VALUE, then it has not been set (default valued).

Returns:
lowMeanCurvature value of the CAD model

Definition at line 256 of file Model.java.

Gets all regions of the model

Returns:
the regions (can be empty list)

Definition at line 199 of file Model.java.

HashMap<Integer, Region> edu.tum.cs.vis.model.Model.getRegionsMap ( ) [inline]

Definition at line 203 of file Model.java.

Gets the scale factor of the model. Model is scaled (normalized) for reasoning. This value indicates the scale factor used in doing so.

Returns:
model scale

Definition at line 217 of file Model.java.

Get the model size on x axis.

Returns:
model size on x axis calculated by the maximum x value minus minimum x value

Definition at line 954 of file Model.java.

Get the model size on y axis.

Returns:
model size on y axis calculated by the maximum y value minus minimum y value

Definition at line 963 of file Model.java.

Get the model size on z axis.

Returns:
model size on z axis calculated by the maximum z value minus minimum z value

Definition at line 972 of file Model.java.

Gets texture base path which is the base for all relative texture paths for this model.

Returns:
the textureBasePath

Definition at line 226 of file Model.java.

Gets all the triangles of the model

Returns:
the triangles

Definition at line 235 of file Model.java.

float edu.tum.cs.vis.model.Model.getUnscaled ( float  scaled) [inline]

Unscales the specified float value by dividing scaled by getScale

Parameters:
scaledscaled value
Returns:
unscaled value

Definition at line 246 of file Model.java.

Tuple3f [] edu.tum.cs.vis.model.Model.getUnscaled ( Point3f[]  corner) [inline]

Unscales the specified point coordinates by dividing each coordinate of corner by getScale

Parameters:
cornerscaled value
Returns:
unscaled value

Definition at line 334 of file Model.java.

Tuple3f edu.tum.cs.vis.model.Model.getUnscaled ( Tuple3f  t) [inline]

Unscales the specified float value by dividing t by getScale

Parameters:
tscaled value
Returns:
unscaled value

Definition at line 349 of file Model.java.

Vector3f edu.tum.cs.vis.model.Model.getUnscaled ( Vector3f  t) [inline]

Unscales the specified float value by dividing t by getScale

Parameters:
tscaled value
Returns:
unscaled value

Definition at line 362 of file Model.java.

Get the variance of the Gaussian curvature values of the model vertices

Returns:
variance of the Gaussian curvature points in the CAD model

Definition at line 322 of file Model.java.

Get the variance of the mean curvature values of the model vertices

Returns:
variance of mean curvature points in the CAD model

Definition at line 313 of file Model.java.

Gets all vertices of model

Returns:
the vertices

Definition at line 373 of file Model.java.

Mirrors model on x axis my multiplying each x value of all vertices with -1

Definition at line 380 of file Model.java.

Normalizes the model. Makes sure that the model fits into a cube with side length of 1. So each vertex is scaled.

Definition at line 391 of file Model.java.

Rebuilds the main triangles and vertices list by iterating over all child groups and collecting all triangles and vertices found.

Definition at line 599 of file Model.java.

Searches for triangles which have exactly the same coordinate points and removes one of them to avoid two triangles drawn on exactly the same position. Used for mesh reasoning.

Returns:
Number of removed triangles

Definition at line 537 of file Model.java.

void edu.tum.cs.vis.model.Model.scale ( float  factor) [inline]

Scales model by given factor by multiplying all vertices with factor. Call setScale afterwards if you want to set scale factor also for parameters.

Parameters:
factorFactor to scale

Definition at line 412 of file Model.java.

void edu.tum.cs.vis.model.Model.setAvgGaussCurvature ( final float  avgGaussCurvature) [inline]

Sets the average Gaussian curvature value of the CAD model

Parameters:
avgGaussCurvature

Definition at line 509 of file Model.java.

void edu.tum.cs.vis.model.Model.setAvgMeanCurvature ( final float  avgMeanCurvature) [inline]

Sets the average mean curvature value of the CAD model

Parameters:
avgMeanCurvature

Definition at line 500 of file Model.java.

void edu.tum.cs.vis.model.Model.setGroup ( Group  group) [inline]

Sets main group of model.

Parameters:
groupthe group to set

Definition at line 432 of file Model.java.

void edu.tum.cs.vis.model.Model.setHighGaussCurvature ( final float  highGaussCurvature) [inline]

Sets the lowest Gaussian curvature value of the CAD model

Parameters:
highGaussCurvature

Definition at line 491 of file Model.java.

void edu.tum.cs.vis.model.Model.setHighMeanCurvature ( final float  highMeanCurvature) [inline]

Sets the highest mean curvature of the CAD model

Parameters:
highMeanCurvature

Definition at line 473 of file Model.java.

void edu.tum.cs.vis.model.Model.setLowGaussCurvature ( final float  lowGaussCurvature) [inline]

Sets the lowest Gaussian curvature value of the CAD model

Parameters:
lowGaussCurvature

Definition at line 482 of file Model.java.

void edu.tum.cs.vis.model.Model.setLowMeanCurvature ( final float  lowMeanCurvature) [inline]

Sets the lowest mean curvature of the CAD model

Parameters:
lowMeanCurvature

Definition at line 464 of file Model.java.

void edu.tum.cs.vis.model.Model.setRegions ( List< Region regions) [inline]

Sets the regions of model by resetting them if existent.

Parameters:
regionsthe analyzed list of regions

Definition at line 442 of file Model.java.

void edu.tum.cs.vis.model.Model.setTextureBasePath ( String  textureBasePath) [inline]

Sets the texture base path for all texture elements of this model.

Parameters:
textureBasePaththe textureBasePath to set

Definition at line 455 of file Model.java.

void edu.tum.cs.vis.model.Model.setVarGaussCurvature ( final float  varGaussCurvature) [inline]

Sets the variance of the Gaussian curvatures of the points in the CAD model

Parameters:
varGaussCurvature

Definition at line 527 of file Model.java.

void edu.tum.cs.vis.model.Model.setVarMeanCurvature ( final float  varMeanCurvature) [inline]

Sets the variance of the mean curvatures of the points in the CAD model

Parameters:
varMeanCurvature

Definition at line 518 of file Model.java.

Ported from trimesh2 (2.12) (Szymon Rusinkiewicz Princeton University). Uses average of per-face normals, weighted according to: Max, N. "Weights for Computing Vertex Normals from Facet Normals", Journal of Graphics Tools, Vol. 4, No. 2, 1999.

See also:
"Weights for Computing Vertex Normals from Facet Normals", N. Max
"Estimating Curvatures and Their Derivatives on Triangle Meshes", S. Rusinkiewicz

Definition at line 748 of file Model.java.

Checks for each vertex if it should be shared with neighbor triangles or not. This decision is made according to the dihedral angle between the two triangles

Definition at line 620 of file Model.java.

void edu.tum.cs.vis.model.Model.updateVertexSharingForNeighbors ( final Triangle  t,
final Triangle  n,
final Set< Triangle checkedTriangles,
Set< Vertex toRemove 
) [inline, private]

Checks for the given two triangles if their vertices should be shared or not. The decision is made according to the dihedral angle between the two triangles.

Parameters:
tthe main triangle
none of the neighboring triangles of t
checkedTrianglesSet of already checked triangles. If one is already checked, it is ignored in this call.
toRemoveSet of vertices which should be removed from the main vertices list. Combined vertices which aren't anymore in the model will be added to this set.

Definition at line 649 of file Model.java.

void edu.tum.cs.vis.model.Model.updateVertexSharingForTriangle ( final Triangle  t,
final Set< Triangle checkedTriangles,
final Set< Vertex toRemove 
) [inline, private]

Check for all vertices between given triangle and its neighbors if the vertex should be shared or not according to the dihedral angle.

Parameters:
tTriangle to check
checkedTrianglesalready checked triangles
toRemoveSet of vertices which should be removed from the main vertices list. Combined vertices which aren't anymore in the model will be added to this set.

Definition at line 719 of file Model.java.


Member Data Documentation

Average Gaussian curvature values of the vertices of the CAD model

Definition at line 141 of file Model.java.

Average mean curvature values of the vertices of CAD model

Definition at line 131 of file Model.java.

Minimum bounding sphere of this model. Only set if previously calculated (by Miniball class).

See also:
edu.tum.cs.vis.model.util.algorithm.Miniball

Definition at line 95 of file Model.java.

Main group of the model. Each model should have at least one group.

Definition at line 68 of file Model.java.

float edu.tum.cs.vis.model.Model.highGaussCurvature = Float.MIN_VALUE [private]

Highest Gaussian curvature value of the CAD model

Definition at line 126 of file Model.java.

float edu.tum.cs.vis.model.Model.highMeanCurvature = Float.MIN_VALUE [private]

Highest mean curvature value of the CAD model

Definition at line 116 of file Model.java.

final List<Line> edu.tum.cs.vis.model.Model.lines = new ArrayList<Line>() [private]

List of all lines in this model

Definition at line 83 of file Model.java.

final Logger edu.tum.cs.vis.model.Model.LOGGER = Logger.getLogger(Model.class) [static, private]

Log4J Logger

Definition at line 58 of file Model.java.

float edu.tum.cs.vis.model.Model.lowGaussCurvature = Float.MAX_VALUE [private]

Lowest Gaussian curvature value of the CAD model

Definition at line 121 of file Model.java.

float edu.tum.cs.vis.model.Model.lowMeanCurvature = Float.MAX_VALUE [private]

Lowest mean curvature value of the CAD model

Definition at line 111 of file Model.java.

Indicates if the vertex normals of each vertex have already been initialized.

Definition at line 106 of file Model.java.

final List<Region> edu.tum.cs.vis.model.Model.regions = new ArrayList<Region>() [private]

List of all regions in this model

Definition at line 88 of file Model.java.

float edu.tum.cs.vis.model.Model.scale = 1f [private]

Current model scale. Is used to normalize model for further reasoning. getUnscaled methods use this value to undo scaling for parameters such as height, width, radius, ...

Definition at line 101 of file Model.java.

Absolute file path where the relative paths within the model are based.

Definition at line 63 of file Model.java.

final List<Triangle> edu.tum.cs.vis.model.Model.triangles = new ArrayList<Triangle>() [private]

List of all triangles in this model

Definition at line 78 of file Model.java.

Variance of the Gaussian curvature values of the vertices of the CAD model

Definition at line 146 of file Model.java.

Variance of the mean curvature values of the vertices of the CAD model

Definition at line 136 of file Model.java.

final List<Vertex> edu.tum.cs.vis.model.Model.vertices = new ArrayList<Vertex>() [private]

List of all vertices in this model

Definition at line 73 of file Model.java.


The documentation for this class was generated from the following file:


knowrob_cad_parser
Author(s): Stefan Profanter
autogenerated on Mon Oct 6 2014 01:29:56