Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## simogl.geometry
Class Triangle

    java.lang.Object
      simogl.geometry.Triangle

    public class Triangle

extends java.lang.Object

This class represents a triangle (polygon) that can be part of a mesh

Author:
  Frank Bruns

Constructor Summary
`Triangle(Point3D p1, Point3D p2, Point3D p3)` Creates a triangle with the specified points as vertices.

Method Summary
`float` | `getLengthV1V2()` Returns the length of the edge between vertex1 and vertex2
`float` | `getLengthV1V3()` Returns the length of the edge between vertex1 and vertex3
`float` | `getLengthV2V3()` Returns the length of the edge between vertex2 and vertex3
`Point3D` | `getNormal()` Returns a point/vector representing the triangle's normal
`TextureCoordinate` | `getTexCoordVertex1()` Returs the texture coordinate of vertex1
`TextureCoordinate` | `getTexCoordVertex2()` Returs the texture coordinate of vertex2
`TextureCoordinate` | `getTexCoordVertex3()` Returs the texture coordinate of vertex3
`Point3D` | `getVertex1()` Gets the first vertex of the triangle
`Point3D` | `getVertex2()` Gets the second vertex of the triangle
`Point3D` | `getVertex3()` Gets the third vertex of the triangle
`void` | `setNormal(float x, float y, float z)` Sets the normal of this triangle to the specified values
`void` | `setNormal(Point3D normal)` Sets the normal of the triangle to the specified point/vector
`void` | `setTexCoords(float vert1_s, float vert1_t, float vert2_s, float vert2_t, float vert3_s, float vert3_t)` Sets the triangle's texture coordinates
`void` | `setTexCoordsVertex1(float s, float t)` Sets the texture coordinates of vertex1 to the specifies s and t values.
`void` | `setTexCoordsVertex2(float s, float t)` Sets the texture coordinates of verte2 to the specifies s and t values.
`void` | `setTexCoordsVertex3(float s, float t)` Sets the texture coordinates of vertex3 to the specifies s and t values.
`void` | `setVertex1(Point3D point)` Sets the first vertex if the triangle
`void` | `setVertex2(Point3D point)` Sets the second vertex if the triangle
`void` | `setVertex3(Point3D point)` Sets the third vertex if the triangle

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Triangle

    public Triangle(Point3D p1,
                    Point3D p2,
                    Point3D p3)

  Creates a triangle with the specified points as vertices. The triangle can be used as a face of a mesh.
  Note: Please specify point counter-clockwise

  Parameters:
    `p1` - point that will be vertex1
    `p2` - point that will be vertex2
    `p3` - point that will be vertex3

Method Detail

### getNormal

    public Point3D getNormal()

  Returns a point/vector representing the triangle's normal

  Returns:
    normal of the triangle

### setNormal

    public void setNormal(float x,
                          float y,
                          float z)

  Sets the normal of this triangle to the specified values

  Parameters:
    `x` - x-coordinate
    `y` - y-coordinate
    `z` - z-coordinate

### setNormal

    public void setNormal(Point3D normal)

  Sets the normal of the triangle to the specified point/vector

  Parameters:
    `normal` - value to set the normal to

### getLengthV1V2

    public float getLengthV1V2()

  Returns the length of the edge between vertex1 and vertex2

  Returns:
    length of edge between vertex1 and vertex2

### getLengthV1V3

    public float getLengthV1V3()

  Returns the length of the edge between vertex1 and vertex3

  Returns:
    length of edge between vertex1 and vertex3

### getLengthV2V3

    public float getLengthV2V3()

  Returns the length of the edge between vertex2 and vertex3

  Returns:
    length of edge between vertex2 and vertex3

### getVertex1

    public Point3D getVertex1()

  Gets the first vertex of the triangle

  Returns:
    first vertex

### setVertex1

    public void setVertex1(Point3D point)

  Sets the first vertex if the triangle

  Parameters:
    `point` - point that will be the first vertex

### getVertex2

    public Point3D getVertex2()

  Gets the second vertex of the triangle

  Returns:
    second vertex

### setVertex2

    public void setVertex2(Point3D point)

  Sets the second vertex if the triangle

  Parameters:
    `point` - point that will be the second vertex

### getVertex3

    public Point3D getVertex3()

  Gets the third vertex of the triangle

  Returns:
    third vertex

### setVertex3

    public void setVertex3(Point3D point)

  Sets the third vertex if the triangle

  Parameters:
    `point` - that will be the third vertex

### setTexCoords

    public void setTexCoords(float vert1_s,
                             float vert1_t,
                             float vert2_s,
                             float vert2_t,
                             float vert3_s,
                             float vert3_t)

  Sets the triangle's texture coordinates

  Parameters:
    `vert1_s` - vertex1 s-coordinate
    `vert1_t` - vertex1 t-coordinate
    `vert2_s` - vertex2 s-coordinate
    `vert2_t` - vertex2 t-coordinate
    `vert3_s` - vertex3 s-coordinate
    `vert3_t` - vertex3 t-coordinate
    Note: Never set the texture coordinates to the triangle object directly. Alway use a face object and then get the triangle from that face object, because it it neccessary to create the face object before assigning texture coordinates to the triangle.

### getTexCoordVertex1

    public TextureCoordinate getTexCoordVertex1()

  Returs the texture coordinate of vertex1

  Returns:
    texture coordinate of vertex1

### setTexCoordsVertex1

    public void setTexCoordsVertex1(float s,
                                    float t)

  Sets the texture coordinates of vertex1 to the specifies s and t values.

  Parameters:
    `s` - s-coordinate
    `t` - t-coordinate
    Note: Never set the texture coordinates to the triangle object directly. Alway use a face object and then get the triangle from that face object, because it it neccessary to create the face object before assigning texture coordinates to the triangle.

### getTexCoordVertex2

    public TextureCoordinate getTexCoordVertex2()

  Returs the texture coordinate of vertex2

  Returns:
    texture coordinate of vertex2

### setTexCoordsVertex2

    public void setTexCoordsVertex2(float s,
                                    float t)

  Sets the texture coordinates of verte2 to the specifies s and t values.

  Parameters:
    `s` - s-coordinate
    `t` - t-coordinate
    Note: Never set the texture coordinates to the triangle object directly. Alway use a face object and then get the triangle from that face object, because it it neccessary to create the face object before assigning texture coordinates to the triangle.

### getTexCoordVertex3

    public TextureCoordinate getTexCoordVertex3()

  Returs the texture coordinate of vertex3

  Returns:
    texture coordinate of vertex3

### setTexCoordsVertex3

    public void setTexCoordsVertex3(float s,
                                    float t)

  Sets the texture coordinates of vertex3 to the specifies s and t values.

  Parameters:
    `s` - s-coordinate
    `t` - t-coordinate
    Note: Never set the texture coordinates to the triangle object directly. Alway use a face object and then get the triangle from that face object, because it it neccessary to create the face object before assigning texture coordinates to the triangle.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD