## devisor2.foundation.elements
Class Cell2D

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

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  Quad, Tri

public abstract class Cell2D
extends Cell
implements java.io.Serializable

The class Cell2D provides a ground class for 2D cell types which defines a discrete 2D domain. This class is abstract and must be derived.

See Also:
  `Quad`, `Tri`, `Line`, `MacroQuad`, Serialized Form

Field Summary
`protected Edge[]` `edges` Face of the cell
`protected java.awt.Polygon` `poly_world` the cell representation as a Polygon in user coordinates

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
`Cell2D()` Empty Constructor.
`Cell2D(int i)` creates a cell with number i

Method Summary
`abstract java.lang.Object` `clone()`
`abstract void` `draw(java.awt.Graphics g)` in this method, the item paints itself to the given graphics context
`abstract double` `getArea()` calculates and returns the area (size) of the element
`abstract double` `getAspectRatio()` calculates the aspect ratio of the element, that is the quotient of the shortest and the longest edge
`abstract Edge` `getEdge(int i)` gives the ith Edge of the cell
`Edge[]` `getEdges()`
`Node` `getNode(int i)` gives the ith node of the cell
`Node[]` `getNodes()` gives the node array of the cell
`abstract java.awt.Rectangle` `getPerimeter()` This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of.
`abstract double` `getSmallestInnerAngle()` calculates and returns the smallest inner angle of the element.
`abstract 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
`abstract boolean` `isInside(int[] topleft, int[] bottomright)` Is the item inside a given rectangular area? All in WORLD COORDINATES!!!
`abstract void` `performTransformation(GridTransformation trafo)` This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance
`void` `setCell(Edge[] e)` Defines the edges of the cell, and set the number of the cell to 0.
`void` `setCell(int i, Edge[] e)` Defines the edges of the cell, and set the number of the cell to i.
`void` `setEdge(int i, Edge e)` sets the i-th edge of the cell to e
`void` `setNode(Node n, int index)`
`Cell[]` `updateCellNeighbours()` update the neighbours array of this cell
`Node[]` `updateCellNodes()` returns the nodes of this cell with respect to the edge order.
`abstract void` `updateInnerData()`

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

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

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

Field Detail

### poly_world

    protected java.awt.Polygon poly_world

  the cell representation as a Polygon in user coordinates

### edges

    protected Edge[] edges

  Face of the cell

  See Also:
    `Face`

Constructor Detail

### Cell2D

    public Cell2D()

  Empty Constructor. Sets the number to 0.

### Cell2D

    public Cell2D(int i)

  creates a cell with number i

Parameters:
  `i` - - the new number tof the Cell to be created

Method Detail

### setNode

    public void setNode(Node n,
                        int index)

  Parameters:
    `n` - - the new node to be placed at

### setCell

    public void setCell(int i,
                        Edge[] e)

  Defines the edges of the cell, and set the number of the cell to i.

  See Also:
    `Face`, `Cell`

### setCell

    public void setCell(Edge[] e)

  Defines the edges of the cell, and set the number of the cell to 0.

  See Also:
    `Face`, `Cell`

### setEdge

    public void setEdge(int i,
                        Edge e)

  sets the i-th edge of the cell to e

### getEdges

    public Edge[] getEdges()

### updateInnerData

    public abstract void updateInnerData()

### updateCellNodes

    public Node[] updateCellNodes()

  returns the nodes of this cell with respect to the edge order.

  Specified by:
    `updateCellNodes` in class `Cell`
  Returns:
    the nodes of this cell in order of faces/edges

### updateCellNeighbours

    public Cell[] updateCellNeighbours()

  update the neighbours array of this cell

  Specified by:
    `updateCellNeighbours` in class `Cell`

### getNode

    public Node getNode(int i)

  gives the ith node of the cell

### getNodes

    public Node[] getNodes()

  gives the node array of the cell

  Overrides:
    `getNodes` in class `Cell`

### getEdge

    public abstract Edge getEdge(int i)

  gives the ith Edge of the cell

### draw

    public abstract void draw(java.awt.Graphics g)

  in this method, the item paints itself to the given graphics context

  Specified by:
    `draw` in class `Cell`

### isInside

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

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

  Specified by:
    `isInside` in class `Cell`
  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 abstract 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 `Cell`
  Returns:
    true if the item has been hit

### getPerimeter

    public abstract java.awt.Rectangle getPerimeter()

  Description copied from class: `GridItem`
  This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of.

  Specified by:
    `getPerimeter` in class `Cell`

### performTransformation

    public abstract void performTransformation(GridTransformation trafo)

  Description copied from class: `GridItem`
  This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance

  Specified by:
    `performTransformation` in class `Cell`

### clone

    public abstract java.lang.Object clone()

### getSmallestInnerAngle

    public abstract double getSmallestInnerAngle()

  calculates and returns the smallest inner angle of the element.

  Returns:
    a double representing an angle in degrees!

### getAspectRatio

    public abstract double getAspectRatio()

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

### getArea

    public abstract double getArea()

  calculates and returns the area (size) of the element