Public Member Functions | Protected 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)
boolean calculateNormalVector ()
void draw (PGraphics g, DrawSettings drawSettings)
float getArea ()
Point3f getCentroid ()
Vector3f getCornerarea ()
double getDihedralAngle (Triangle t)
Set< TrianglegetNeighbors ()
Vector3f getNormalVector ()
Point2f[] getTexPosition ()
boolean intersectsRay (Point3f rayStart, Point3f rayEnd)
boolean intersectsRay (Point3f p1, Point3f p2, Point3f intersectionPoint)
boolean isAdjacentNeighbor (Triangle tr)
boolean isDirectNeighbor (Triangle tr)
void removeNeighbor (Triangle n)
void setCornerarea (Vector3f cornerarea)
void setNeighbors (Set< Triangle > neighbors)
void setNormalVector (Vector3f normalVector)
void setTexPosition (Point2f[] texPosition)
 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 ()

Protected Attributes

Point3f centroid
Vector3f cornerarea = null
Set< Triangleneighbors = new HashSet<Triangle>(3)
Vector3f normalVector = null
Point2f texPosition []

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).

Author:
Stefan Profanter

Definition at line 31 of file Triangle.java.


Constructor & Destructor Documentation

Initializes a triangle with given number of edges (Triangle: 3)

Definition at line 72 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 86 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 106 of file Triangle.java.

Create new triangle by the given three corner points.

Parameters:
p1corner 1
p2corner 2
p3corner 3

Definition at line 124 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 146 of file Triangle.java.

Calculate and set normal vector for triangle

Returns:
true if vector successfully calculated

Definition at line 377 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 200 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 278 of file Triangle.java.

Get centroid of triangle

Returns:
the centroid

Definition at line 303 of file Triangle.java.

Get voronoi area of triangle

Returns:
the cornerarea

Definition at line 312 of file Triangle.java.

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

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

Definition at line 333 of file Triangle.java.

Get list of all direct neighbor triangles.

Returns:
list of triangles

Definition at line 321 of file Triangle.java.

get normal vector of triangle

Returns:
the normalVector

Definition at line 345 of file Triangle.java.

Get position array for texture

Returns:
the texPosition

Definition at line 354 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 368 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 431 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 550 of file Triangle.java.

Checks if tr is a direct neighbor which means that at least 2 vertices of both triangles must be at the same coordinate.

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

Definition at line 516 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 178 of file Triangle.java.

void edu.tum.cs.vis.model.util.Triangle.setCornerarea ( Vector3f  cornerarea) [inline]
Parameters:
cornerareathe cornerarea to set

Definition at line 581 of file Triangle.java.

Set the list of direct neighbor triangles.

Parameters:
neighborstriangles list.

Definition at line 591 of file Triangle.java.

void edu.tum.cs.vis.model.util.Triangle.setNormalVector ( Vector3f  normalVector) [inline]

Set normal vector of triangle

Parameters:
normalVectorthe normalVector to set

Definition at line 601 of file Triangle.java.

void edu.tum.cs.vis.model.util.Triangle.setTexPosition ( Point2f[]  texPosition) [inline]

set texture position array for texture of triangle

Parameters:
texPosition* the texPosition to set

Definition at line 611 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 616 of file Triangle.java.


Member Data Documentation

Centroid of triangle

Definition at line 61 of file Triangle.java.

Vector3f edu.tum.cs.vis.model.util.Triangle.cornerarea = null [protected]

Voronoi area of triangle

Definition at line 56 of file Triangle.java.

Logger edu.tum.cs.vis.model.util.Triangle.logger = Logger.getLogger(Triangle.class) [static, private]

log4j logger

Definition at line 41 of file Triangle.java.

List of all direct neighbor triangles

Definition at line 66 of file Triangle.java.

Triangles may have normal vector

Definition at line 51 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 36 of file Triangle.java.

Texture-Points

Definition at line 46 of file Triangle.java.


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


knowrob_cad_parser
Author(s): Stefan Profanter
autogenerated on Sat Dec 28 2013 17:09:45