## devisor2.foundation.elements
Class Quad

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

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  Macro

public class Quad
extends Cell2D
implements java.io.Serializable

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

See Also:
  `Cell`, `Tri`, `Line`, `Macro`, Serialized Form

Field Summary
`double` `middlez`

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
`Quad()` Empty constructor.
`Quad(int i)`
`Quad(int i, Edge e1, Edge e2, Edge e3, Edge e4)` Calls one constructor of Cell, and defines the array of nodes of the cell.

Method Summary
`java.lang.Object` `clone()` clones this Quad element shallowly, which means no nodes are recursivly cloned as well.
`void` `draw(java.awt.Graphics g)` Draws the perimeter of the Quad.
`void` `fill(java.awt.Graphics g)` Draws the Quad 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 Quad element, that is the smallest bounding box completely containing the Quad
`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 SCREEN COORDINATES to avoid the snap mechanism
`boolean` `isInside(int[] topleft, int[] bottomright)` Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
`void` `performMirror(double nx, double ny, double px, double py)` mirrors the Quad element by changing all nodes
`void` `performTransformation(GridTransformation trafo)` transforms the Quad element by changing all nodes
`void` `setCell(Edge e1, Edge e2, Edge e3, Edge e4)` Defines the array of edges 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`

Field Detail

### middlez

    public double middlez

Constructor Detail

### Quad

    public Quad()

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

See Also:
  `Cell`

### Quad

    public Quad(int i)

### Quad

    public Quad(int i,
                Edge e1,
                Edge e2,
                Edge e3,
                Edge e4)

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

See Also:
  `Cell`, `Edge`

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,
                        Edge e4)

  Defines the array of edges of the cell.

  See Also:
    `Edge`

### getEdge

    public Edge getEdge(int i)

  Returns the ith edge of the cell modulo NPT, i.e. for a Quad modulo 4.

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

### draw

    public void draw(java.awt.Graphics g)

  Draws the perimeter of the Quad.

  Specified by:
    `draw` in class `Cell2D`

### fill

    public void fill(java.awt.Graphics g)

  Draws the Quad filled with its color.

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

### 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`

### isInside

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

  Is the item 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 SCREEN COORDINATES to avoid the snap mechanism

  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 Quad element, that is the smallest bounding box completely containing the Quad

  Specified by:
    `getPerimeter` in class `Cell2D`

### performTransformation

    public void performTransformation(GridTransformation trafo)

  transforms the Quad 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 Quad element by changing all nodes

  Specified by:
    `performMirror` in class `GridItem`

### clone

    public java.lang.Object clone()

  clones this Quad 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`