Resource Base
Table of contents

DSQuadrilateral

The DSQuadrilateral class represents a quadrilateral defined by four points.

Definition

Assembly: DynamsoftCore.framework

  • 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

    • Latest version
    • Version 2.x
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
    • Version 1.x
      • Version 1.2.1
      • Version 1.2.0
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
      • Version 1.1.13
      • Version 1.1.12
      • Version 1.1.11
      • Version 1.1.9
      • Version 1.1.8
      • Version 1.1.7
      • Version 1.1.6
      • Version 1.1.5
      • Version 1.1.4
      • Version 1.1.3
      • Version 1.1.2
      • Version 1.1.1
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
    Change +