layout | title | description | keywords | needGenerateH3Content | needAutoGenerateSidebar | noTitleIndex |
---|---|---|---|---|---|---|
default-layout |
DSQuadrilateral - Dynamsoft Core Module iOS Edition API Reference |
The class DSQuadrilateral of Dynamsoft Core Module represents a quadrilateral shape in 2D space, which contains an array of four CGPoint, representing the vertices of the quadrilateral. |
quadrilateral, shape, 2D space, objective-c, swift |
true |
true |
true |
The DSQuadrilateral
class represents a quadrilateral defined by four points.
Assembly: DynamsoftCore.framework
>- Objective-C >- Swift > >1. ```objc @interface DSQuadrilateral : NSObject ``` 2. ```swift class Quadrilateral : NSObject ```Attributes | Type | Description |
---|---|---|
points |
NSArray | An array of four Point objects defining the vertices of the quadrilateral. |
Method | Description |
---|---|
contains |
Check whether the input point is contained by the quadrilateral. |
boundingRect |
Get the bounding rectangle of the quadrilateral. |
centrePoint |
Get the centre point of the quadrilateral. |
area |
Get the area of the quadrilateral. |
An array of four Point
objects defining the vertices of the quadrilateral.
Check whether the input point is contained by the quadrilateral.
>- Objective-C >- Swift > >1. ```objc - (BOOL)contains:(CGPoint)point; ``` 2. ```swift func contains(_ point: CGPoint) -> Bool ```Parameters
point
: Input a point.
Return Value
A BOOL
value that indicates whether the point is contained by the quadrilateral.
Code Snippet
>- Objective-C >- Swift > >1. ```objc BOOL result = [quadrilateral contains:point]; ``` 2. ```swift let result = quadrilateral.contains(point) ```Get the bounding rectangle of the quadrilateral.
>- Objective-C >- Swift > >1. ```objc @property (nonatomic, readonly) CGRect *boundingRect; ``` 2. ```swift var boundingRect: CGRect { get } ```Return Value
The bounding rectangle of the quadrilateral.
Code Snippet
>- Objective-C >- Swift > >1. ```objc CGRect rect = [quadrilateral getBoundingRect]; ``` 2. ```swift let rect = quadrilateral.getBoundingRect() ```Get the centre point of the quadrilateral.
>- Objective-C >- Swift > >1. ```objc @property (nonatomic, readonly) CGPoint *centrePoint; ``` 2. ```swift var centrePoint: CGPoint { get } ```Return Value
The centre point of the quadrilateral.
Code Snippet
>- Objective-C >- Swift > >1. ```objc CGPoint center = [quadrilateral getCentrePoint]; ``` 2. ```swift let center = quadrilateral.getCentrePoint() ```Get the area of the quadrilateral.
>- Objective-C >- Swift > >1. ```objc @property (nonatomic, readonly) NSInteger *area; ``` 2. ```swift var area: Int { get } ```Return Value
The area of the quadrilateral.
Code Snippet
>- Objective-C >- Swift > >1. ```objc NSInteger area = [quadrilateral getArea]; ``` 2. ```swift let area = quadrilateral.getArea() ```