DSQuadrilateral
The DSQuadrilateral
class represents a quadrilateral defined by four points.
Definition
Assembly: DynamsoftCore.framework
- Objective-C
- Swift
@interface DSQuadrilateral : NSObject
class Quadrilateral : NSObject
Methods & Attributes
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. |
points
An array of four Point
objects defining the vertices of the quadrilateral.
- Objective-C
- Swift
@property (nonatomic, copy) NSArray *points;
var points: [CGPoint] { get set }
contains
Check whether the input point is contained by the quadrilateral.
- Objective-C
- Swift
- (BOOL)contains:(CGPoint)point;
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
BOOL result = [quadrilateral contains:point];
let result = quadrilateral.contains(point)
boundingRect
Get the bounding rectangle of the quadrilateral.
- Objective-C
- Swift
@property (nonatomic, readonly) CGRect *boundingRect;
var boundingRect: CGRect { get }
Return Value
The bounding rectangle of the quadrilateral.
Code Snippet
- Objective-C
- Swift
CGRect rect = [quadrilateral getBoundingRect];
let rect = quadrilateral.getBoundingRect()
centrePoint
Get the centre point of the quadrilateral.
- Objective-C
- Swift
@property (nonatomic, readonly) CGPoint *centrePoint;
var centrePoint: CGPoint { get }
Return Value
The centre point of the quadrilateral.
Code Snippet
- Objective-C
- Swift
CGPoint center = [quadrilateral getCentrePoint];
let center = quadrilateral.getCentrePoint()
area
Get the area of the quadrilateral.
- Objective-C
- Swift
@property (nonatomic, readonly) NSInteger *area;
var area: Int { get }
Return Value
The area of the quadrilateral.
Code Snippet
- Objective-C
- Swift
NSInteger area = [quadrilateral getArea];
let area = quadrilateral.getArea()