Package com.microblink.blinkid.geometry
Class Quadrilateral
java.lang.Object
com.microblink.blinkid.geometry.Quadrilateral
- All Implemented Interfaces:
android.os.Parcelable
-
Nested Class Summary
-
Field Summary
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ModifierConstructorDescriptionQuadrilateral
(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 TypeMethodDescriptionclone()
int
int
getColor()
Returns the point nearest to (0, height) coordinateReturns the point nearest to (width, height) coordinateReturns the Quadrilateral which has same corners as original, but it guarantees that upper left point is the point nearest to (0,0) coordinate.Returns the point nearest to (0, 0) coordinate.Returns the point nearest to (width, 0) coordinateboolean
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 previewvoid
setColor
(int color) void
setIsDefaultQuad
(boolean defaultQuad) void
setMargins
(int top, int bottom, int left, int right, int hostActivityOrientation) void
void
toFloatArray
(float[] arr) Converts this quadrilateral to array of float points.toString()
void
writeToParcel
(android.os.Parcel dest, int flags)
-
Field Details
-
CREATOR
-
-
Constructor Details
-
Quadrilateral
public Quadrilateral(int top, int bottom, int left, int right, int hostActivityOrientation) -
Quadrilateral
public Quadrilateral() -
Quadrilateral
-
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
-
toString
-
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 canvascanvasHeight
- height of canvas
-
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
Returns the point nearest to (0, 0) coordinate.- Returns:
- the point nearest to (0, 0) coordinate.
-
getUpperRight
Returns the point nearest to (width, 0) coordinate- Returns:
- the point nearest to (width, 0) coordinate
-
getLowerLeft
Returns the point nearest to (0, height) coordinate- Returns:
- the point nearest to (height, 0) coordinate
-
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
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) - Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-