Resource Base
Table of contents

DSQuadrilateral

The DSQuadrilateral class represents a quadrilateral defined by four points.

Definition

Assembly: DynamsoftCore.xcframework

  • Objective-C
  • Swift
  1. @interface DSQuadrilateral : NSObject
    
  2. 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
  1. @property (nonatomic, copy) NSArray *points;
    
  2. var points: [CGPoint] { get set }
    

contains

Check whether the input point is contained by the quadrilateral.

  • Objective-C
  • Swift
  1. - (BOOL)contains:(CGPoint)point;
    
  2. 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. BOOL result = [quadrilateral contains:point];
    
  2. let result = quadrilateral.contains(point)
    

boundingRect

Get the bounding rectangle of the quadrilateral.

  • Objective-C
  • Swift
  1. @property (nonatomic, readonly) CGRect *boundingRect;
    
  2. var boundingRect: CGRect { get }
    

Return Value

The bounding rectangle of the quadrilateral.

Code Snippet

  • Objective-C
  • Swift
  1. CGRect rect = [quadrilateral getBoundingRect];
    
  2. let rect = quadrilateral.getBoundingRect()
    

centrePoint

Get the centre point of the quadrilateral.

  • Objective-C
  • Swift
  1. @property (nonatomic, readonly) CGPoint *centrePoint;
    
  2. var centrePoint: CGPoint { get }
    

Return Value

The centre point of the quadrilateral.

Code Snippet

  • Objective-C
  • Swift
  1. CGPoint center = [quadrilateral getCentrePoint];
    
  2. let center = quadrilateral.getCentrePoint()
    

area

Get the area of the quadrilateral.

  • Objective-C
  • Swift
  1. @property (nonatomic, readonly) NSInteger *area;
    
  2. var area: Int { get }
    

Return Value

The area of the quadrilateral.

Code Snippet

  • Objective-C
  • Swift
  1. NSInteger area = [quadrilateral getArea];
    
  2. let area = quadrilateral.getArea()
    

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article:

latest version

    Change +