Cocos Creator API

1.1.1

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Intersection

Module: cc

Intersection helper class

Methods

lineLine
(
  • a1
  • a2
  • b1
  • b2
)
boolean

Test line and line

name type description
a1 Vec2

The start point of the first line

a2 Vec2

The end point of the first line

b1 Vec2

The start point of the second line

b2 Vec2

The end point of the second line

returns:

type: boolean

lineRect
(
  • a1
  • a2
  • b
)
boolean

Test line and rect

name type description
a1 Vec2

The start point of the line

a2 Vec2

The end point of the line

b Rect

The rect

returns:

type: boolean

linePolygon
(
  • a1
  • a2
  • b
)
boolean

Test line and polygon

name type description
a1 Vec2

The start point of the line

a2 Vec2

The end point of the line

b [Vec2]

The polygon, a set of points

returns:

type: boolean

rectRect
(
  • a
  • b
)
boolean

Test rect and rect

name type description
a Rect

The first rect

b Rect

The second rect

returns:

type: boolean

rectPolygon
(
  • a
  • b
)
boolean

Test rect and polygon

name type description
a Rect

The rect

b [Vec2]

The polygon, a set of points

returns:

type: boolean

polygonPolygon
(
  • a
  • b
)
boolean

Test polygon and polygon

name type description
a [Vec2]

The first polygon, a set of points

b [Vec2]

The second polygon, a set of points

returns:

type: boolean

circleCircle
(
  • a
  • b
)
boolean

Test circle and circle

name type description
a Object

Object contains position and radius

b Object

Object contains position and radius

returns:

type: boolean

polygonCircle
(
  • polygon
  • circle
)
boolean

Test polygon and circle

name type description
polygon [Vec2]

The Polygon, a set of points

circle Object

Object contains position and radius

returns:

type: boolean

pointInPolygon
(
  • point
  • polygon
)
boolean

Test whether the point is in the polygon

name type description
point Vec2

The point

polygon [Vec2]

The polygon, a set of points

returns:

type: boolean

pointLineDistance
(
  • point
  • start
  • end
  • isSegment
)
boolean

Calculate the distance of point to line.

name type description
point Vec2

The point

start Vec2

The start point of line

end Vec2

The end point of line

isSegment boolean

whether this line is a segment

returns:

type: boolean

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index