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< Line > | getLines () |
float | getLowGaussCurvature () |
float | getLowMeanCurvature () |
List< Region > | getRegions () |
HashMap< Integer, Region > | getRegionsMap () |
float | getScale () |
double | getSizeX () |
double | getSizeY () |
double | getSizeZ () |
String | getTextureBasePath () |
List< Triangle > | getTriangles () |
float | getUnscaled (float scaled) |
Tuple3f[] | getUnscaled (Point3f[] corner) |
Tuple3f | getUnscaled (Tuple3f t) |
Vector3f | getUnscaled (Vector3f t) |
float | getVarGaussCurvature () |
float | getVarMeanCurvature () |
List< Vertex > | getVertices () |
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< Line > | lines = new ArrayList<Line>() |
float | lowGaussCurvature = Float.MAX_VALUE |
float | lowMeanCurvature = Float.MAX_VALUE |
boolean | normalsInitialized = false |
final List< Region > | regions = new ArrayList<Region>() |
float | scale = 1f |
String | textureBasePath = null |
final List< Triangle > | triangles = new ArrayList<Triangle>() |
float | varGaussCurvature = 0f |
float | varMeanCurvature = 0f |
final List< Vertex > | vertices = new ArrayList<Vertex>() |
Static Private Attributes | |
static final Logger | LOGGER = Logger.getLogger(Model.class) |
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.
Definition at line 53 of file Model.java.
void edu.tum.cs.vis.model.Model.calculateBoundingsphere | ( | ) | [inline, private] |
Calculates the bounding sphere for the model. Calculated by Miniball class.
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.
t | Triangle |
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.
g | Graphics context to draw on |
drawSettings | Settings 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.
File edu.tum.cs.vis.model.Model.exportVerticesAsTxt | ( | ) | [inline] |
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.
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.
path | the path to the file where to store the data |
overwrite | overwrite existing file |
Definition at line 916 of file Model.java.
float edu.tum.cs.vis.model.Model.feature_size | ( | ) | [inline] |
A characteristic "feature size" for the mesh. Computed as the median edge length.
Ported (and modified) from trimesh2 library (version: 2.12)
Definition at line 1007 of file Model.java.
float edu.tum.cs.vis.model.Model.getAvgGaussCurvature | ( | ) | [inline] |
Gest the average Gaussian curvature value of the model.
Definition at line 304 of file Model.java.
float edu.tum.cs.vis.model.Model.getAvgMeanCurvature | ( | ) | [inline] |
Gets the average mean curvature value of the model.
Definition at line 295 of file Model.java.
BSphere edu.tum.cs.vis.model.Model.getBoundingSphere | ( | ) | [inline] |
Gets the bounding sphere set by Miniball class.
Definition at line 170 of file Model.java.
Group edu.tum.cs.vis.model.Model.getGroup | ( | ) | [inline] |
float edu.tum.cs.vis.model.Model.getHighGaussCurvature | ( | ) | [inline] |
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).
Definition at line 286 of file Model.java.
float edu.tum.cs.vis.model.Model.getHighMeanCurvature | ( | ) | [inline] |
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).
Definition at line 266 of file Model.java.
List<Line> edu.tum.cs.vis.model.Model.getLines | ( | ) | [inline] |
float edu.tum.cs.vis.model.Model.getLowGaussCurvature | ( | ) | [inline] |
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).
Definition at line 276 of file Model.java.
float edu.tum.cs.vis.model.Model.getLowMeanCurvature | ( | ) | [inline] |
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).
Definition at line 256 of file Model.java.
List<Region> edu.tum.cs.vis.model.Model.getRegions | ( | ) | [inline] |
Gets all regions of the model
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.
float edu.tum.cs.vis.model.Model.getScale | ( | ) | [inline] |
Gets the scale factor of the model. Model is scaled (normalized) for reasoning. This value indicates the scale factor used in doing so.
Definition at line 217 of file Model.java.
double edu.tum.cs.vis.model.Model.getSizeX | ( | ) | [inline] |
Get the model size on x axis.
Definition at line 954 of file Model.java.
double edu.tum.cs.vis.model.Model.getSizeY | ( | ) | [inline] |
Get the model size on y axis.
Definition at line 963 of file Model.java.
double edu.tum.cs.vis.model.Model.getSizeZ | ( | ) | [inline] |
Get the model size on z axis.
Definition at line 972 of file Model.java.
String edu.tum.cs.vis.model.Model.getTextureBasePath | ( | ) | [inline] |
Gets texture base path which is the base for all relative texture paths for this model.
Definition at line 226 of file Model.java.
List<Triangle> edu.tum.cs.vis.model.Model.getTriangles | ( | ) | [inline] |
Gets all the triangles of the model
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
scaled | scaled 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
corner | scaled 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
t | scaled 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
t | scaled value |
Definition at line 362 of file Model.java.
float edu.tum.cs.vis.model.Model.getVarGaussCurvature | ( | ) | [inline] |
Get the variance of the Gaussian curvature values of the model vertices
Definition at line 322 of file Model.java.
float edu.tum.cs.vis.model.Model.getVarMeanCurvature | ( | ) | [inline] |
Get the variance of the mean curvature values of the model vertices
Definition at line 313 of file Model.java.
List<Vertex> edu.tum.cs.vis.model.Model.getVertices | ( | ) | [inline] |
void edu.tum.cs.vis.model.Model.mirrorX | ( | ) | [inline] |
Mirrors model on x axis my multiplying each x value of all vertices with -1
Definition at line 380 of file Model.java.
void edu.tum.cs.vis.model.Model.normalize | ( | ) | [inline] |
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.
void edu.tum.cs.vis.model.Model.reloadVertexList | ( | ) | [inline] |
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.
int edu.tum.cs.vis.model.Model.removeDoubleSidedTriangles | ( | ) | [inline] |
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.
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.
factor | Factor 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
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
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.
group | the 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
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
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
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
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.
regions | the 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.
textureBasePath | the 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
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
varMeanCurvature |
Definition at line 518 of file Model.java.
void edu.tum.cs.vis.model.Model.updateVertexNormals | ( | ) | [inline] |
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.
Definition at line 748 of file Model.java.
void edu.tum.cs.vis.model.Model.updateVertexSharing | ( | ) | [inline] |
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.
t | the main triangle |
n | one of the neighboring triangles of t |
checkedTriangles | Set of already checked triangles. If one is already checked, it is ignored in this call. |
toRemove | Set 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.
t | Triangle to check |
checkedTriangles | already checked triangles |
toRemove | Set 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.
float edu.tum.cs.vis.model.Model.avgGaussCurvature = 0f [private] |
Average Gaussian curvature values of the vertices of the CAD model
Definition at line 141 of file Model.java.
float edu.tum.cs.vis.model.Model.avgMeanCurvature = 0f [private] |
Average mean curvature values of the vertices of CAD model
Definition at line 131 of file Model.java.
BSphere edu.tum.cs.vis.model.Model.boundingSphere = null [private] |
Minimum bounding sphere of this model. Only set if previously calculated (by Miniball class).
Definition at line 95 of file Model.java.
Group edu.tum.cs.vis.model.Model.group [private] |
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.
boolean edu.tum.cs.vis.model.Model.normalsInitialized = false [private] |
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.
String edu.tum.cs.vis.model.Model.textureBasePath = null [private] |
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.
float edu.tum.cs.vis.model.Model.varGaussCurvature = 0f [private] |
Variance of the Gaussian curvature values of the vertices of the CAD model
Definition at line 146 of file Model.java.
float edu.tum.cs.vis.model.Model.varMeanCurvature = 0f [private] |
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.