Package com.microblink.blinkid.geometry

# Class Quadrilateral

java.lang.Object
com.microblink.blinkid.geometry.Quadrilateral

All Implemented Interfaces:
  `android.os.Parcelable`

public class Quadrilateral extends Object implements android.os.Parcelable

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface android.os.Parcelable

  `android.os.Parcelable.ClassLoaderCreator<T extends Object>, android.os.Parcelable.Creator<T extends Object>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final android.os.Parcelable.Creator<Quadrilateral>`
  `CREATOR`

  ### Fields inherited from interface android.os.Parcelable

  `CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `Quadrilateral()`
  ``
  `Quadrilateral(float[] points)`
  Constructor from float array.
  ``
  `Quadrilateral(int top, int bottom, int left, int right, int hostActivityOrientation)`
  `protected`
  `Quadrilateral(android.os.Parcel in)`
  ``
  `Quadrilateral(Point uleft, Point uright, Point lleft, Point lright)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Quadrilateral`
  `clone()`
  `int`
  `describeContents()`
  `int`
  `getColor()`
  `Point`
  `getLowerLeft()`
  Returns the point nearest to (0, height) coordinate
  `Point`
  `getLowerRight()`
  Returns the point nearest to (width, height) coordinate
  `Quadrilateral`
  `getSortedQuad()`
  Returns the Quadrilateral which has same corners as original, but it guarantees that upper left point is the point nearest to (0,0) coordinate.
  `Point`
  `getUpperLeft()`
  Returns the point nearest to (0, 0) coordinate.
  `Point`
  `getUpperRight()`
  Returns the point nearest to (width, 0) coordinate
  `boolean`
  `isDefaultQuad()`
  `boolean`
  `isEmpty()`
  Returns true if quadrilateral is empty, i.e.
  `boolean`
  `matchesMargins(int top, int bottom, int left, int right, int hostActivityOrientation)`
  `void`
  `mirror(int canvasWidth, int canvasHeight, int hostActivityOrientation)`
  Mirrors the quadrangle so that it can be properly drawn on mirrored camera preview
  `void`
  `setColor(int color)`
  `void`
  `setIsDefaultQuad(boolean defaultQuad)`
  `void`
  `setMargins(int top, int bottom, int left, int right, int hostActivityOrientation)`
  `void`
  `setPoints(Point uleft, Point uright, Point lleft, Point lright)`
  `void`
  `toFloatArray(float[] arr)`
  Converts this quadrilateral to array of float points.
  `String`
  `toString()`
  `void`
  `writeToParcel(android.os.Parcel dest, int flags)`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### CREATOR

    @NonNull public static final android.os.Parcelable.Creator<Quadrilateral> CREATOR

- ## Constructor Details

  - ### Quadrilateral

    public Quadrilateral(int top, int bottom, int left, int right, int hostActivityOrientation)

  - ### Quadrilateral

    public Quadrilateral()

  - ### Quadrilateral

    public Quadrilateral(@NonNull Point uleft, @NonNull Point uright, @NonNull Point lleft, @NonNull Point lright)

  - ### Quadrilateral

    public Quadrilateral(@Size(8L) @NonNull float[] points)
    Constructor from float array. The points are represented as pairs (x,y) in clockwise order: upper left, upper right, lower right, lower left
    Parameters:
      `points` - float pairs representing quadrilateral points

  - ### Quadrilateral

    protected Quadrilateral(@NonNull android.os.Parcel in)

- ## Method Details

  - ### setMargins

    public void setMargins(int top, int bottom, int left, int right, int hostActivityOrientation)

  - ### matchesMargins

    public boolean matchesMargins(int top, int bottom, int left, int right, int hostActivityOrientation)

  - ### isEmpty

    public boolean isEmpty()
    Returns true if quadrilateral is empty, i.e. all 4 points have coordinates (0,0).
    Returns:
      true if quadrilateral is empty, i.e. all 4 points have coordinates (0,0).

  - ### toFloatArray

    public void toFloatArray(@NonNull @Size(8L) float[] arr)
    Converts this quadrilateral to array of float points. The points are represented as pairs (x,y) in clockwise order: upper left, upper right, lower right, lower left

  - ### setPoints

    public void setPoints(@NonNull Point uleft, @NonNull Point uright, @NonNull Point lleft, @NonNull Point lright)

  - ### toString

    @NonNull public String toString()
    Overrides:
      `toString` in class `Object`

  - ### mirror

    public void mirror(int canvasWidth, int canvasHeight, int hostActivityOrientation)
    Mirrors the quadrangle so that it can be properly drawn on mirrored camera preview
    Parameters:
      `canvasWidth` - width of canvas
      `canvasHeight` - height of canvas

  - ### getSortedQuad

    @NonNull public Quadrilateral getSortedQuad()
    Returns the Quadrilateral which has same corners as original, but it guarantees that upper left point is the point nearest to (0,0) coordinate.
    Returns:
      sorted Quadrilateral

  - ### getUpperLeft

    @NonNull public Point getUpperLeft()
    Returns the point nearest to (0, 0) coordinate.
    Returns:
      the point nearest to (0, 0) coordinate.

  - ### getUpperRight

    @NonNull public Point getUpperRight()
    Returns the point nearest to (width, 0) coordinate
    Returns:
      the point nearest to (width, 0) coordinate

  - ### getLowerLeft

    @NonNull public Point getLowerLeft()
    Returns the point nearest to (0, height) coordinate
    Returns:
      the point nearest to (height, 0) coordinate

  - ### getLowerRight

    @NonNull public Point getLowerRight()
    Returns the point nearest to (width, height) coordinate
    Returns:
      the point nearest to (width, height) coordinate

  - ### getColor

    public int getColor()

  - ### setColor

    public void setColor(int color)

  - ### isDefaultQuad

    public boolean isDefaultQuad()

  - ### setIsDefaultQuad

    public void setIsDefaultQuad(boolean defaultQuad)

  - ### clone

    @NonNull public Quadrilateral clone()
    Overrides:
      `clone` in class `Object`

  - ### describeContents

    public int describeContents()
    Specified by:
      `describeContents` in interface `android.os.Parcelable`

  - ### writeToParcel

    public void writeToParcel(@NonNull android.os.Parcel dest, int flags)
    Specified by:
      `writeToParcel` in interface `android.os.Parcelable`