Public Member Functions | Protected Attributes | Private Attributes | Static Private Attributes
edu.tum.cs.vis.model.util.Triangle Class Reference
Inheritance diagram for edu.tum.cs.vis.model.util.Triangle:
Inheritance graph
[legend]

List of all members.

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< TrianglegetNeighbors ()
List< TrianglegetNeighborsOfEdge (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< Triangleneighbors = 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

Detailed Description

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

Author:
Stefan Profanter
Andrei Stoica - refactored original implementation and added complementary functionality

Definition at line 39 of file Triangle.java.


Constructor & Destructor Documentation

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.

Parameters:
p1corner 1
p2corner 2
p3corner 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.

Parameters:
p1corner 1
normP1normal vertex at corner 1
p2corner 2
normP2normal vertex at corner 2
p3corner 3
normP3normal vertex at corner 3

Definition at line 165 of file Triangle.java.

Create new triangle by the given three corner points.

Parameters:
p1corner 1
p2corner 2
p3corner 3

Definition at line 183 of file Triangle.java.


Member Function Documentation

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.

Parameters:
neighborneighbor to add.
lockMutex lock to avoid multithreading issues. This object should be the same for all calling threads. Used to synchronizes adding a neighbor to the triangle
Returns:
true if neighbor is really a neighbor of this triangle and it was successfully added.

Definition at line 205 of file Triangle.java.

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!

Parameters:
neighborneighbor to add

Definition at line 236 of file Triangle.java.

Sets an edge of the triangle as sharp edge if this is a direct neighbor of the edge passed as parameter.

Parameters:
edgesharp edge to be checked

Definition at line 574 of file Triangle.java.

Calculate and set normal vector for triangle

Returns:
true if vector successfully calculated

Definition at line 657 of file Triangle.java.

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.

See also:
"A new CAD mesh segmentation method, based on curvature tensor analysis"

Definition at line 956 of file Triangle.java.

Checks if the triangle contains or not the edge passed as argument

Parameters:
edgeedge 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.

Parameters:
gGraphics to draw on
drawSettingsoverride the draw color, texture (and other settings). Draw whole object in the given color if != null

Definition at line 275 of file Triangle.java.

Returns the area of the triangle in 3d space. Unit is the same as you draw the triangle.

Returns:
the area in drawing unit.

Definition at line 353 of file Triangle.java.

Gets the centroid of the triangle

Returns:
the centroid

Definition at line 378 of file Triangle.java.

Gets the common edge (if it exists) of the triangle instance and of the one passed as argument

Parameters:
triangleto be checked
Returns:
edge shared with triangle

Definition at line 426 of file Triangle.java.

Gets the Voronoi area of the triangle

Returns:
the cornerarea

Definition at line 387 of file Triangle.java.

Gets the curvature values for the current triangle.

Returns:
curvature properties' values

Definition at line 554 of file Triangle.java.

Calculates the angle between surface normal of this triangle and the given one. Angle is between 0 and PI.

Parameters:
tcounterpart triangle
Returns:
angle in radiant between 0 and PI

Definition at line 600 of file Triangle.java.

Gets an array containing the 3 edges of the triangle

Returns:
edges

Reimplemented from edu.tum.cs.vis.model.util.DrawObject.

Definition at line 446 of file Triangle.java.

Returns whether the curvature values have been initialized or not

Returns:
true or false

Definition at line 563 of file Triangle.java.

Gets the list of all the direct neighboring triangles.

Returns:
list of neighboring triangles

Definition at line 396 of file Triangle.java.

Gets neighbor of a certain edge from the CAD model.

Returns:
triangle

Definition at line 405 of file Triangle.java.

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!

Returns:
array of non-sharp edges

Definition at line 482 of file Triangle.java.

Gets normal vector of triangle

Returns:
the normalVector

Definition at line 609 of file Triangle.java.

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.

Parameters:
edge
Returns:
opposite vertex of the edge

Definition at line 513 of file Triangle.java.

Gets the region label of which the triangle currently belongs to.

Returns:
region label id

Definition at line 588 of file Triangle.java.

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!

Returns:
array of sharp edges

Definition at line 456 of file Triangle.java.

Gets position array for texture

Returns:
the texPosition

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.

Parameters:
rayStartstart point of the ray
rayEndend point of the ray
Returns:
true if triangle intersects 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.

Parameters:
p1start point of the ray
p2end point of the ray
intersectionPointwill be set to the intersection point. Set to null to ignore.
Returns:
true if triangle intersects ray

Definition at line 711 of file Triangle.java.

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.

Parameters:
trtriangle to check if it is a neighbor
Returns:
true if 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.

Parameters:
trtriangle to check if it is a neighbor
Returns:
true if tr is a neighbor

Definition at line 798 of file Triangle.java.

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.

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.

See also:
"A new CAD mesh segmentation method, based on curvature tensor analysis"

Definition at line 943 of file Triangle.java.

Returns if the triangle was marked as visited or not

Returns:
isVisited true or false boolean value

Definition at line 627 of file Triangle.java.

Returns the number of sharp vertices of the current triangle object, as

Parameters:
numberof sharp vertices

Definition at line 981 of file Triangle.java.

Removes the given triangle from the neighbor relation of this triangle. This triangle is also removed from n's neighbor list.

Parameters:
nneighbor 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

Parameters:
cornerareathe 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.

Parameters:
neighborstriangles 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

Parameters:
normalVectorthe 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

Parameters:
newLabelof 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

Parameters:
texPositionto set

Definition at line 916 of file Triangle.java.

Definition at line 1107 of file Triangle.java.

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.

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.

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.


Member Data Documentation

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

See also:
"A new CAD mesh segmentation method, based on curvature tensor analysis"

Definition at line 115 of file Triangle.java.

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.

Flag to mark whether the curvatures kMin Max values have been modified from default

Definition at line 120 of file Triangle.java.

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.

See also:
"A new CAD mesh segmentation method, based on curvature tensor analysis"

Definition at line 95 of file Triangle.java.

Stores if a triangle contains three "sharp" vertices

Definition at line 85 of file Triangle.java.

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.

List of all direct neighbor triangles

Definition at line 74 of file Triangle.java.

Triangles may have normal vector

Definition at line 59 of file Triangle.java.

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.

Texture-Points

Definition at line 54 of file Triangle.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