Public Member Functions | |
boolean | addNeighbor (Triangle neighbor, Lock lock) |
void | addNeighbor (Triangle neighbor) |
void | addSharpEdge (Edge edge) |
boolean | calculateNormalVector () |
boolean | checkIsSharpTriangle () |
boolean | containsEdge (Edge edge) |
void | draw (PGraphics g, DrawSettings drawSettings) |
float | getArea () |
Point3f | getCentroid () |
Edge | getCommonEdge (final Triangle triangle) |
Vector3f | getCornerarea () |
float[] | getCurvatureValues () |
double | getDihedralAngle (Triangle t) |
Edge[] | getEdges () |
boolean | getIsCurvatureMinMaxValueInit () |
Set< Triangle > | getNeighbors () |
List< Triangle > | getNeighborsOfEdge (final Edge edge) |
Edge[] | getNonSharpEdges () |
Vector3f | getNormalVector () |
Vertex | getOppositeVertexFromEdge (Edge edge) |
int | getRegionLabel () |
Edge[] | getSharpEdges () |
Point2f[] | getTexPosition () |
boolean | intersectsRay (Point3f rayStart, Point3f rayEnd) |
boolean | intersectsRay (Point3f p1, Point3f p2, Point3f intersectionPoint) |
boolean | isAdjacentNeighbor (Triangle tr) |
boolean | isDirectNeighbor (Triangle tr, final boolean fastDetection) |
boolean | isSeedTriangle () |
boolean | isSharpTriangle () |
boolean | isVisited () |
int | numOfSharpVertices () |
void | removeNeighbor (Triangle n) |
void | setCornerarea (Vector3f cornerarea) |
void | setCurvatureLevels (final float minCurvatureLevel, final float maxCurvatureLevel, final float minMaxCurvatureLevel) |
void | setIsVisited (final boolean isVisited) |
void | setNeighbors (Set< Triangle > neighbors) |
void | setNormalVector (Vector3f normalVector) |
void | setRegionLabel (final int newLabel) |
void | setTexPosition (Point2f[] texPosition) |
String | toString () |
Triangle () | |
Triangle (Tuple3f p1, Tuple3f p2, Tuple3f p3) | |
Triangle (Tuple3f p1, Vector3f normP1, Tuple3f p2, Vector3f normP2, Tuple3f p3, Vector3f normP3) | |
Triangle (Vertex p1, Vertex p2, Vertex p3) | |
void | updateCentroid () |
void | updateEdges () |
boolean | updateIsSeedTriangle () |
Protected Attributes | |
Point3f | centroid |
Vector3f | cornerarea = null |
Edge[] | edges = new Edge[3] |
Set< Triangle > | neighbors = new HashSet<Triangle>(3) |
Vector3f | normalVector = null |
Point2f | texPosition [] |
Private Attributes | |
final float[] | curvatureMinMaxValue = { 0.0f, 0.0f, 0.0f } |
boolean | isCurvatureMinMaxValueInit = false |
boolean | isSeedTriangle = false |
boolean | isSharpTriangle = false |
boolean | isVisited = false |
int | regionLabel = -1 |
Static Private Attributes | |
static Logger | logger = Logger.getLogger(Triangle.class) |
static final long | serialVersionUID = -5164768039180386782L |
DrawObject which represents a triangle (object with 3 points). The implementation covers the functionality needed to describe the neighboring relations between faces of a mesh along the information and properties of such a face, such as vertices, edges, appearance, area, normal vector, centroid, curvature values. Additionally the drawing utility of a face is also implemented
Definition at line 39 of file Triangle.java.
edu.tum.cs.vis.model.util.Triangle.Triangle | ( | ) | [inline] |
Initializes a triangle with given number of edges (Triangle: 3)
Definition at line 131 of file Triangle.java.
edu.tum.cs.vis.model.util.Triangle.Triangle | ( | Tuple3f | p1, |
Tuple3f | p2, | ||
Tuple3f | p3 | ||
) | [inline] |
Create new triangle by the given three corner points.
p1 | corner 1 |
p2 | corner 2 |
p3 | corner 3 |
Definition at line 145 of file Triangle.java.
edu.tum.cs.vis.model.util.Triangle.Triangle | ( | Tuple3f | p1, |
Vector3f | normP1, | ||
Tuple3f | p2, | ||
Vector3f | normP2, | ||
Tuple3f | p3, | ||
Vector3f | normP3 | ||
) | [inline] |
Create a new triangle by the given three corner points and their normal vertices.
p1 | corner 1 |
normP1 | normal vertex at corner 1 |
p2 | corner 2 |
normP2 | normal vertex at corner 2 |
p3 | corner 3 |
normP3 | normal vertex at corner 3 |
Definition at line 165 of file Triangle.java.
edu.tum.cs.vis.model.util.Triangle.Triangle | ( | Vertex | p1, |
Vertex | p2, | ||
Vertex | p3 | ||
) | [inline] |
Create new triangle by the given three corner points.
p1 | corner 1 |
p2 | corner 2 |
p3 | corner 3 |
Definition at line 183 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.addNeighbor | ( | Triangle | neighbor, |
Lock | lock | ||
) | [inline] |
Add a neighbor to the neighbors list. If list contains already neighbor this method doesn't add it again. If not, the neighbor will be added and this instance will be added as a neighbor in the given neighbor instance.
neighbor | neighbor to add. |
lock | Mutex lock to avoid multithreading issues. This object should be the same for all calling threads. Used to synchronizes adding a neighbor to the triangle |
neighbor
is really a neighbor of this triangle and it was successfully added. Definition at line 205 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.addNeighbor | ( | Triangle | neighbor | ) | [inline] |
Add an isolated neighbor to the neighbors list. If list contains already neighbor this doesn't add again. If not, the neighbor will be added and this instance will be added as a neighbor in the given neighbor instance.
Use with care to add just created triangles for the sharp detection process!
neighbor | neighbor to add |
Definition at line 236 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.addSharpEdge | ( | Edge | edge | ) | [inline] |
Sets an edge of the triangle as sharp edge if this is a direct neighbor of the edge passed as parameter.
edge | sharp edge to be checked |
Definition at line 574 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.calculateNormalVector | ( | ) | [inline] |
Calculate and set normal vector for triangle
Definition at line 657 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.checkIsSharpTriangle | ( | ) | [inline] |
Checks if the triangle has indeed 3 sharp vertices as described in the paper "A new CAD mesh segmentation method, based on curvature tensor analysis", Guillaume Lavoue, Florent Dupont, Atilla Baskurt, Computer-Aided Design 37 (2005), 975–987, and then sets this property field accordingly.
Definition at line 956 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.containsEdge | ( | Edge | edge | ) | [inline] |
Checks if the triangle contains or not the edge passed as argument
edge | edge to be checked if in triangle |
Definition at line 926 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.draw | ( | PGraphics | g, |
DrawSettings | drawSettings | ||
) | [inline] |
Draw the triangles onto the applet.
g | Graphics to draw on |
drawSettings | override the draw color, texture (and other settings). Draw whole object in the given color if != null |
Definition at line 275 of file Triangle.java.
float edu.tum.cs.vis.model.util.Triangle.getArea | ( | ) | [inline] |
Returns the area of the triangle in 3d space. Unit is the same as you draw the triangle.
Definition at line 353 of file Triangle.java.
Point3f edu.tum.cs.vis.model.util.Triangle.getCentroid | ( | ) | [inline] |
Gets the centroid of the triangle
Definition at line 378 of file Triangle.java.
Edge edu.tum.cs.vis.model.util.Triangle.getCommonEdge | ( | final Triangle | triangle | ) | [inline] |
Gets the common edge (if it exists) of the triangle instance and of the one passed as argument
triangle | to be checked |
Definition at line 426 of file Triangle.java.
Vector3f edu.tum.cs.vis.model.util.Triangle.getCornerarea | ( | ) | [inline] |
Gets the Voronoi area of the triangle
Definition at line 387 of file Triangle.java.
float [] edu.tum.cs.vis.model.util.Triangle.getCurvatureValues | ( | ) | [inline] |
Gets the curvature values for the current triangle.
Definition at line 554 of file Triangle.java.
double edu.tum.cs.vis.model.util.Triangle.getDihedralAngle | ( | Triangle | t | ) | [inline] |
Calculates the angle between surface normal of this triangle and the given one. Angle is between 0 and PI.
t | counterpart triangle |
Definition at line 600 of file Triangle.java.
Edge [] edu.tum.cs.vis.model.util.Triangle.getEdges | ( | ) | [inline] |
Gets an array containing the 3 edges of the triangle
Reimplemented from edu.tum.cs.vis.model.util.DrawObject.
Definition at line 446 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.getIsCurvatureMinMaxValueInit | ( | ) | [inline] |
Returns whether the curvature values have been initialized or not
Definition at line 563 of file Triangle.java.
Set<Triangle> edu.tum.cs.vis.model.util.Triangle.getNeighbors | ( | ) | [inline] |
Gets the list of all the direct neighboring triangles.
Definition at line 396 of file Triangle.java.
List<Triangle> edu.tum.cs.vis.model.util.Triangle.getNeighborsOfEdge | ( | final Edge | edge | ) | [inline] |
Gets neighbor of a certain edge from the CAD model.
Definition at line 405 of file Triangle.java.
Edge [] edu.tum.cs.vis.model.util.Triangle.getNonSharpEdges | ( | ) | [inline] |
Get an array of non-sharp edges. NOTE: This needs to be called after sharp edge detection processing in order to deliver the expected results!
Definition at line 482 of file Triangle.java.
Vector3f edu.tum.cs.vis.model.util.Triangle.getNormalVector | ( | ) | [inline] |
Gets normal vector of triangle
Definition at line 609 of file Triangle.java.
Vertex edu.tum.cs.vis.model.util.Triangle.getOppositeVertexFromEdge | ( | Edge | edge | ) | [inline] |
Determines the opposite vertex from an edge passed as a parameter. The edge needs to be a neighboring edge in order for the method to return a not null vertex.
edge |
Definition at line 513 of file Triangle.java.
int edu.tum.cs.vis.model.util.Triangle.getRegionLabel | ( | ) | [inline] |
Gets the region label of which the triangle currently belongs to.
Definition at line 588 of file Triangle.java.
Edge [] edu.tum.cs.vis.model.util.Triangle.getSharpEdges | ( | ) | [inline] |
Get an array of sharp edges. NOTE: This needs to be called after the sharp edge detection processing in order to deliver the expected results!
Definition at line 456 of file Triangle.java.
Point2f [] edu.tum.cs.vis.model.util.Triangle.getTexPosition | ( | ) | [inline] |
Gets position array for texture
Definition at line 618 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.intersectsRay | ( | Point3f | rayStart, |
Point3f | rayEnd | ||
) | [inline] |
Checks if this triangle intersects with the given ray (rayStart, rayEnd). Not only the segment between rayStart and rayEnd is checked but the whole ray from -infinity to +infinity.
rayStart | start point of the ray |
rayEnd | end point of the ray |
Definition at line 648 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.intersectsRay | ( | Point3f | p1, |
Point3f | p2, | ||
Point3f | intersectionPoint | ||
) | [inline] |
Checks if this triangle intersects with the given ray (rayStart, rayEnd). Not only the segment between rayStart and rayEnd is checked but the whole ray from -infinity to +infinity.
Copyright 2001, softSurfer (www.softsurfer.com) This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application.
p1 | start point of the ray |
p2 | end point of the ray |
intersectionPoint | will be set to the intersection point. Set to null to ignore. |
Definition at line 711 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isAdjacentNeighbor | ( | Triangle | tr | ) | [inline] |
Checks if tr
is an adjacent neighbor which means that at least 2 vertices of both triangles must be not only the same coordinates but also the same object.
tr | triangle to check if it is a neighbor |
tr
is a neighbor Definition at line 853 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isDirectNeighbor | ( | Triangle | tr, |
final boolean | fastDetection | ||
) | [inline] |
Checks if tr
is a direct neighbor. A direct neighbor has a common edge with the triangle. This means that either that two triangles are direct neighbors if they have exactly 2 common vertices or if they share one edge such that at least on vertex of one of the triangles is laying inside the edge of the other one.
tr | triangle to check if it is a neighbor |
tr
is a neighbor Definition at line 798 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isSeedTriangle | ( | ) | [inline] |
Returns if the triangle is a seed triangle. To be called after the updateIsSeedTriangle() has been called.
Definition at line 1072 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isSharpTriangle | ( | ) | [inline] |
Returns whether or not the triangle has 3 sharp vertices as defined by the paper "A new CAD mesh segmentation method, based on curvature tensor analysis", Guillaume Lavoue, Florent Dupont, Atilla Baskurt, Computer-Aided Design 37 (2005), 975–987.
Definition at line 943 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isVisited | ( | ) | [inline] |
Returns if the triangle was marked as visited or not
Definition at line 627 of file Triangle.java.
int edu.tum.cs.vis.model.util.Triangle.numOfSharpVertices | ( | ) | [inline] |
Returns the number of sharp vertices of the current triangle object, as
number | of sharp vertices |
Definition at line 981 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.removeNeighbor | ( | Triangle | n | ) | [inline] |
Removes the given triangle from the neighbor relation of this triangle. This triangle is also removed from n
's neighbor list.
n | neighbor to remove |
Definition at line 253 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setCornerarea | ( | Vector3f | cornerarea | ) | [inline] |
Sets the cornerarea of the triangle
cornerarea | the cornerarea to set |
Definition at line 886 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setCurvatureLevels | ( | final float | minCurvatureLevel, |
final float | maxCurvatureLevel, | ||
final float | minMaxCurvatureLevel | ||
) | [inline] |
Sets the curvature values for the current triangle.
Definition at line 1080 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setIsVisited | ( | final boolean | isVisited | ) | [inline] |
Sets the triangle as visited
Definition at line 634 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setNeighbors | ( | Set< Triangle > | neighbors | ) | [inline] |
Sets the list of direct neighbor triangles.
neighbors | triangles list. |
Definition at line 896 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setNormalVector | ( | Vector3f | normalVector | ) | [inline] |
Sets the normal vector of the triangle
normalVector | the normalVector to set |
Definition at line 906 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setRegionLabel | ( | final int | newLabel | ) | [inline] |
Sets the region label of the triangle
newLabel | of region to set |
Definition at line 971 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setTexPosition | ( | Point2f[] | texPosition | ) | [inline] |
Sets the texture position array for the texture of the triangle
texPosition | to set |
Definition at line 916 of file Triangle.java.
String edu.tum.cs.vis.model.util.Triangle.toString | ( | ) | [inline] |
Definition at line 1107 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.updateCentroid | ( | ) | [inline] |
Recalculates the and centroid. Called automatically when calling setPosition
. If you modify the position array directly, call this afterwards.
Reimplemented from edu.tum.cs.vis.model.util.DrawObject.
Definition at line 1093 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.updateEdges | ( | ) | [inline] |
Updates the edges array content using the Vertices of the Triangle object. Needs to be called in order to set the edges field of the triangle after it has been created
Definition at line 995 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.updateIsSeedTriangle | ( | ) | [inline] |
Checks if the triangle is a "seed triangle" as described in the paper:
Guillaume Lavoue, Florent Dupont, Atilla Baskurt, "A new CAD mesh segmentation method, based on curvature tensor analysis", Computer-Aided Design 37(2005) 975-987.
Definition at line 1008 of file Triangle.java.
Point3f edu.tum.cs.vis.model.util.Triangle.centroid [protected] |
Centroid of triangle
Definition at line 69 of file Triangle.java.
Vector3f edu.tum.cs.vis.model.util.Triangle.cornerarea = null [protected] |
Voronoi area of triangle
Definition at line 64 of file Triangle.java.
final float [] edu.tum.cs.vis.model.util.Triangle.curvatureMinMaxValue = { 0.0f, 0.0f, 0.0f } [private] |
Stores the minimum curvature kMin
, maximum curvature kMax
and min-max curvature kMinkMax
values associated to the triangle in the case the triangle is a "seed triangle" as defined in the paper "A new CAD mesh segmentation method, based on curvature tensor analysis", Guillaume Lavoue, Florent Dupont, Atilla Baskurt, Computer-Aided Design 37 (2005), 975–987.
kMin
is stored on position 0, kMax
is stored on position 1, kMinkMax
is stored on position 2
Definition at line 115 of file Triangle.java.
Edge [] edu.tum.cs.vis.model.util.Triangle.edges = new Edge[3] [protected] |
Array containing the three edges that define the triangle as returned from the getEdges inherited routine from DrawObject
Definition at line 80 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isCurvatureMinMaxValueInit = false [private] |
Flag to mark whether the curvatures kMin
Max values have been modified from default
Definition at line 120 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isSeedTriangle = false [private] |
Stores if a triangle is a "seed triangle" as described in the paper "A new CAD mesh segmentation method, based on curvature tensor analysis", Guillaume Lavoue, Florent Dupont, Atilla Baskurt, Computer-Aided Design 37 (2005), 975–987.
Definition at line 95 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isSharpTriangle = false [private] |
Stores if a triangle contains three "sharp" vertices
Definition at line 85 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isVisited = false [private] |
Caching flag to signal whether a trinangle was visited or not for different algorithms
Definition at line 125 of file Triangle.java.
Logger edu.tum.cs.vis.model.util.Triangle.logger = Logger.getLogger(Triangle.class) [static, private] |
log4j logger
Definition at line 49 of file Triangle.java.
Set<Triangle> edu.tum.cs.vis.model.util.Triangle.neighbors = new HashSet<Triangle>(3) [protected] |
List of all direct neighbor triangles
Definition at line 74 of file Triangle.java.
Vector3f edu.tum.cs.vis.model.util.Triangle.normalVector = null [protected] |
Triangles may have normal vector
Definition at line 59 of file Triangle.java.
int edu.tum.cs.vis.model.util.Triangle.regionLabel = -1 [private] |
Stores the region label which the triangle belongs to
Definition at line 100 of file Triangle.java.
final long edu.tum.cs.vis.model.util.Triangle.serialVersionUID = -5164768039180386782L [static, private] |
auto generated
Reimplemented from edu.tum.cs.vis.model.util.DrawObject.
Definition at line 44 of file Triangle.java.
Point2f edu.tum.cs.vis.model.util.Triangle.texPosition[] [protected] |
Texture-Points
Definition at line 54 of file Triangle.java.