# geometry2d.h - [Overview](#section1261063187165627) - [Summary](#section616742317165627) - [Data Structures](#nested-classes) - [Functions](#func-members) ## **Overview** **Related Modules:** [Graphic](Graphic.md) **Description:** Defines attributes of 2D geometries \(including points, lines, rectangles, and polygons\) of the lightweight graphics system and provides functions for performing operations on the geometries. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Data Structures

Data Structure Name

Description

OHOS::Line

Defines a line, which consists of the start and end points.

OHOS::Polygon

Defines a polygon, including vertex coordinates and the maximum number of vertices (defined by MAX_VERTEX_NUM).

## Functions

Function

Description

OHOS::Intersect (const Line &a, const Line &b, Vector2< int16_t > &out)

bool

Checks whether line segment a and line segment b intersect, and returns the intersection point (if available).

OHOS::IsIntersect (const Line &a, const Line &b)

bool

Chekcs whether line segment a and line segment b intersect.

OHOS::Clip (Polygon &poly, const Line &line)

void

Clips a polygon by using a line segment.

OHOS::SuthHodgClip (const Rect &clipRect, const Polygon &polygon)

Polygon

Implements Sutherland-Hodgman, an algorithm used for clipping polygons.

OHOS::Clip (const Line &line, const Polygon &poly, Vector2< int16_t > *pOut, uint8_t *pNum)

void

Clips a polygon by using a line segment and obtains the intersections.