Intersection 类型

模块: cc父模块: cc

辅助类,用于测试形状与形状是否相交

索引

方法

Details

方法

lineLine

测试线段与线段是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:37
参数列表
  • 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
lineRect

测试线段与矩形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:68
参数列表
  • a1 Vec2 The start point of the line
  • a2 Vec2 The end point of the line
  • b Rect The rect
linePolygon

测试线段与多边形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:100
参数列表
  • a1 Vec2 The start point of the line
  • a2 Vec2 The end point of the line
  • b Vec2[] The polygon, a set of points
rectRect

测试矩形与矩形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:125
参数列表
  • a Rect The first rect
  • b Rect The second rect
rectPolygon

测试矩形与多边形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:155
参数列表
  • a Rect The rect
  • b Vec2[] The polygon, a set of points
polygonPolygon

测试多边形与多边形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:207
参数列表
  • a Vec2[] The first polygon, a set of points
  • b Vec2[] The second polygon, a set of points
circleCircle

测试圆形与圆形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:246
参数列表
  • a Object Object contains position and radius
  • b Object Object contains position and radius
polygonCircle

测试矩形与圆形是否相交

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:263
参数列表
  • polygon Vec2[] The Polygon, a set of points
  • circle Object Object contains position and radius
pointInPolygon

测试一个点是否在一个多边形中

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:292
参数列表
  • point Vec2 The point
  • polygon Vec2[] The polygon, a set of points
pointLineDistance

计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。

metadescription
返回boolean
定义于cocos2d/core/collider/CCIntersection.js:322
参数列表
  • 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