Table of contents

Quadrilateral

The Quadrilateral class represents a quadrilateral shape in 2D space, which contains an array of four points, representing the vertices of the quadrilateral.

Definition

Namespace: com.dynamsoft.core.basic_structures

Assembly: DynamsoftCaptureVisionBundle.aar

class Quadrilateral

Attributes & Methods

Attributes Type Description
points android.graphics.Point[] Four vertexes in a clockwise direction of a quadrilateral. Index 0 represents the left-most vertex.
id int The ID of the quadrilateral.
Method Description
Quadrilateral The constructor.
Quadrilateral(quad) Constructs a quadrilateral from another quadrilateral.
Quadrilateral(point1,point2,point3,point4) Constructs a quadrilateral from four points.
Quadrilateral(point1,point2,point3,point4,id) Constructs a quadrilateral from four points and an ID.
fromJson Constructs a quadrilateral from a JSON string.
transformByMatrix Transforms the coordinates of the quadrilateral by a transformation matrix.
getBoundingRect Get the bounding rectangle of the quadrilateral.
getArea Get the area of the quadrilateral.

points

Four vertexes in a clockwise direction of a quadrilateral. Index 0 represents the left-most vertex.

Point[] points;

id

The ID of the quadrilateral.

int id;

Quadrilateral

The constructor.

Quadrilateral();

Quadrilateral(quad)

Constructs a quadrilateral from another quadrilateral.

Quadrilateral(Quadrilateral quad);

Quadrilateral(point1,point2,point3,point4)

Constructs a quadrilateral from four points.

Quadrilateral(Point point1,Point point2,Point point3,Point point4);

Quadrilateral(point1,point2,point3,point4,id)

Constructs a quadrilateral from four points and an ID.

Quadrilateral(Point point1,Point point2,Point point3,Point point4,int id);

fromJson

Constructs a quadrilateral from a JSON string.


Quadrilateral fromJson(String jsonString);

Return Value

The constructed quadrilateral.

transformByMatrix

Transforms the coordinates of the quadrilateral by a transformation matrix.

Quadrilateral transformByMatrix(Matrix matrix);

Parameters

matrix: The transformation matrix.

Return Value

The transformed quadrilateral.

contains

Check whether the input point is contained by the quadrilateral.

boolean contains(Point point);

Parameters

[in] point: Input a point.

Return Value

A boolean value that indicates whether the point is contained by the quadrilateral.

getBoundingRect

Get the bounding rectangle of the quadrilateral.

Rect getBoundingRect();

Return Value

The bounding rectangle of the quadrilateral.

getArea

Get the area of the quadrilateral.

int getArea();

Return Value

The area of the quadrilateral.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: