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< Triangle > | getNeighbors () |
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< Triangle > | neighbors = new HashSet<Triangle>(3) |
Vector3f | normalVector = null |
Point2f | texPosition [] |
Static Private Attributes | |
static Logger | logger = Logger.getLogger(Triangle.class) |
static final long | serialVersionUID = -5164768039180386782L |
DrawObject which represents a triangle (object with 3 points).
Definition at line 31 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 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.
p1 | corner 1 |
p2 | corner 2 |
p3 | corner 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.
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 106 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 124 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 146 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.calculateNormalVector | ( | ) | [inline] |
Calculate and set normal vector for triangle
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.
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 200 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 278 of file Triangle.java.
Point3f edu.tum.cs.vis.model.util.Triangle.getCentroid | ( | ) | [inline] |
Vector3f edu.tum.cs.vis.model.util.Triangle.getCornerarea | ( | ) | [inline] |
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 (180°).
t | counterpart triangle |
Definition at line 333 of file Triangle.java.
Set<Triangle> edu.tum.cs.vis.model.util.Triangle.getNeighbors | ( | ) | [inline] |
Get list of all direct neighbor triangles.
Definition at line 321 of file Triangle.java.
Vector3f edu.tum.cs.vis.model.util.Triangle.getNormalVector | ( | ) | [inline] |
get normal vector of triangle
Definition at line 345 of file Triangle.java.
Point2f [] edu.tum.cs.vis.model.util.Triangle.getTexPosition | ( | ) | [inline] |
Get position array for texture
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.
rayStart | start point of the ray |
rayEnd | end point of the 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.
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 431 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 550 of file Triangle.java.
boolean edu.tum.cs.vis.model.util.Triangle.isDirectNeighbor | ( | Triangle | tr | ) | [inline] |
Checks if tr
is a direct neighbor which means that at least 2 vertices of both triangles must be at the same coordinate.
tr | triangle to check if it is a neighbor |
tr
is a neighbor Definition at line 516 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 178 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setCornerarea | ( | Vector3f | cornerarea | ) | [inline] |
cornerarea | the cornerarea to set |
Definition at line 581 of file Triangle.java.
void edu.tum.cs.vis.model.util.Triangle.setNeighbors | ( | Set< Triangle > | neighbors | ) | [inline] |
Set the list of direct neighbor triangles.
neighbors | triangles 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
normalVector | the 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
texPosition | * the texPosition to set |
Definition at line 611 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 616 of file Triangle.java.
Point3f edu.tum.cs.vis.model.util.Triangle.centroid [protected] |
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.
Set<Triangle> edu.tum.cs.vis.model.util.Triangle.neighbors = new HashSet<Triangle>(3) [protected] |
List of all direct neighbor triangles
Definition at line 66 of file Triangle.java.
Vector3f edu.tum.cs.vis.model.util.Triangle.normalVector = null [protected] |
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.
Point2f edu.tum.cs.vis.model.util.Triangle.texPosition[] [protected] |
Texture-Points
Definition at line 46 of file Triangle.java.