## devisor2.foundation.elements
Class Tri

    java.lang.Object
      devisor2.foundation.GridItem
          devisor2.foundation.elements.Cell
              devisor2.foundation.elements.Cell2D
                  devisor2.foundation.elements.Tri

All Implemented Interfaces:
  java.io.Serializable

public class Tri
extends Cell2D
implements java.io.Serializable

The class Tri represents the cells of the discrete domain which have 3 nodes. This class is derived from Cell2D.

See Also:
  `Cell`, `Quad`, `Macro`, Serialized Form

Field Summary

Fields inherited from class devisor2.foundation.elements.Cell2D
`edges, poly_world`

Fields inherited from class devisor2.foundation.elements.Cell
`children, level, marker, material_number, matrixblock, neighbours, nodes, number, parallelblock, parameters, parent, values`

Fields inherited from class devisor2.foundation.GridItem
`cc, marked, transformed, xmax, xmin, ymax, ymin`

Constructor Summary
`Tri()` Empty constructor.
`Tri(Edge e1, Edge e2, Edge e3)`
`Tri(int i, Edge e1, Edge e2, Edge e3)` Calls one constructor of Cell, and defines the array of nodes of the cell.

Method Summary
`java.lang.Object` `clone()` clones this Tri element shallowly, which means no nodes are recursivly cloned as well.
`void` `draw(java.awt.Graphics g)` Draws the perimeter of the Tri.
`void` `fill(java.awt.Graphics g)` Draws the Tri filled with its color.
`double` `getArea()` calculates and returns the area (size) of the element
`double` `getAspectRatio()` calculates the aspect ratio of the element, that is the quotient of the shortest and the longest edge
`Edge` `getEdge(int i)` Returns the ith edge of the cell modulo NPT, i.e.
`int` `getNPT()`
`double[]` `getParameters()` returns all parameters of the griditem in an int array
`java.awt.Rectangle` `getPerimeter()` returns the perimeter of the Tri element, that is the smallest bounding box completely containing the Tri
`double` `getSmallestInnerAngle()` calculates and returns the smallest inner angle of the element.
`boolean` `isHit(int x, int y)` Determines if the item has been hit by a click on the grid ALL IN WORLD COORDINATES
`boolean` `isInside(int[] topleft, int[] bottomright)` Is the tri completely inside a given rectangular area? All in WORLD COORDINATES!!!
`void` `performMirror(double nx, double ny, double px, double py)` mirrors the Tri element by changing all nodes
`void` `performTransformation(GridTransformation trafo)` transforms the Tri element by changing all nodes
`void` `setCell(Edge e1, Edge e2, Edge e3)` Defines the array of nodes of the cell.
`void` `setParameters(double[] params)` sets all parameters of the GridItem according to the given int array
`java.lang.String` `toString()`
`void` `updateInnerData()` updates the inner variables xmin, xmax, ymin, ymax and the polygonal representation of the tri object

Methods inherited from class devisor2.foundation.elements.Cell2D
`getEdges, getNode, getNodes, setCell, setCell, setEdge, setNode, updateCellNeighbours, updateCellNodes`

Methods inherited from class devisor2.foundation.elements.Cell
`defValue, getChildren, getLevel, getMarker, getMatrixBlock, getNeighbours, getNodeAverageValue, getNumber, getParallelBlock, getParent, getValue, isRect, setLevel, setMarker, setMatrixBlock, setNumber, setParallelBlock, setValue`

Methods inherited from class devisor2.foundation.GridItem
`clearTransformedFlag, isMarked, setMarker, setMarker, unsetMarker`

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

Constructor Detail

### Tri

    public Tri()

  Empty constructor. Calls the empty constructor of Cell, and defines the array of nodes of the cell.

See Also:
  `Cell`

### Tri

    public Tri(Edge e1,
               Edge e2,
               Edge e3)

### Tri

    public Tri(int i,
               Edge e1,
               Edge e2,
               Edge e3)

  Calls one constructor of Cell, and defines the array of nodes of the cell.

See Also:
  `Cell`

Method Detail

### getParameters

    public double[] getParameters()

  Description copied from class: `GridItem`
  returns all parameters of the griditem in an int array

  Specified by:
    `getParameters` in class `GridItem`

### setParameters

    public void setParameters(double[] params)

  Description copied from class: `GridItem`
  sets all parameters of the GridItem according to the given int array

  Specified by:
    `setParameters` in class `GridItem`

### getNPT

    public int getNPT()

  Specified by:
    `getNPT` in class `Cell`

### setCell

    public void setCell(Edge e1,
                        Edge e2,
                        Edge e3)

  Defines the array of nodes of the cell.

  See Also:
    `Node`

### getEdge

    public Edge getEdge(int i)

  Returns the ith edge of the cell modulo NPT, i.e. for a Tri modulo 3.

  Specified by:
    `getEdge` in class `Cell2D`
  See Also:
    `Edge`

### updateInnerData

    public void updateInnerData()

  updates the inner variables xmin, xmax, ymin, ymax and the polygonal representation of the tri object

  Specified by:
    `updateInnerData` in class `Cell2D`

### draw

    public void draw(java.awt.Graphics g)

  Draws the perimeter of the Tri.

  Specified by:
    `draw` in class `Cell2D`

### fill

    public void fill(java.awt.Graphics g)

  Draws the Tri filled with its color.

  Specified by:
    `fill` in class `Cell`
  See Also:
    `Cell`

### isInside

    public boolean isInside(int[] topleft,
                            int[] bottomright)

  Is the tri completely inside a given rectangular area? All in WORLD COORDINATES!!!

  Specified by:
    `isInside` in class `Cell2D`
  Parameters:
    `topleft` - - the topleft corner of the rectangle
    `bottomright` - - the bottom right corner of the rectangle
  Returns:
    true if the item is completely inside the rectangle

### isHit

    public boolean isHit(int x,
                         int y)

  Determines if the item has been hit by a click on the grid ALL IN WORLD COORDINATES

  Specified by:
    `isHit` in class `Cell2D`
  Returns:
    true if the item has been hit

### getPerimeter

    public java.awt.Rectangle getPerimeter()

  returns the perimeter of the Tri element, that is the smallest bounding box completely containing the Tri

  Specified by:
    `getPerimeter` in class `Cell2D`

### performTransformation

    public void performTransformation(GridTransformation trafo)

  transforms the Tri element by changing all nodes

  Specified by:
    `performTransformation` in class `Cell2D`

### performMirror

    public void performMirror(double nx,
                              double ny,
                              double px,
                              double py)

  mirrors the Tri element by changing all nodes

  Specified by:
    `performMirror` in class `GridItem`

### clone

    public java.lang.Object clone()

  clones this Tri element shallowly, which means no nodes are recursivly cloned as well. See the GridCloner class in the backend package for more information on how cloning of entire collections is performed.

  Specified by:
    `clone` in class `Cell2D`

### toString

    public java.lang.String toString()

### getSmallestInnerAngle

    public double getSmallestInnerAngle()

  calculates and returns the smallest inner angle of the element.

  Specified by:
    `getSmallestInnerAngle` in class `Cell2D`
  Returns:
    a double representing an angle in degrees!

### getAspectRatio

    public double getAspectRatio()

  calculates the aspect ratio of the element, that is the quotient of the shortest and the longest edge

  Specified by:
    `getAspectRatio` in class `Cell2D`

### getArea

    public double getArea()

  calculates and returns the area (size) of the element

  Specified by:
    `getArea` in class `Cell2D`