Intersection 类型

模块: cc

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

索引

方法
  • lineLine 测试线段与线段是否相交
  • lineRect 测试线段与矩形是否相交
  • linePolygon 测试线段与多边形是否相交
  • rectRect 测试矩形与矩形是否相交
  • rectPolygon 测试矩形与多边形是否相交
  • polygonPolygon 测试多边形与多边形是否相交
  • circleCircle 测试圆形与圆形是否相交
  • polygonCircle 测试矩形与圆形是否相交
  • pointInPolygon 测试一个点是否在一个多边形中
  • pointLineDistance 计算点到直线的距离。如果这是一条线段并且垂足不在线段内,则会计算点到线段端点的距离。

Details

方法

lineLine

测试线段与线段是否相交

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:12
参数列表
  • 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

测试线段与矩形是否相交

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:43
参数列表
  • a1 Vec2 The start point of the line
  • a2 Vec2 The end point of the line
  • b Rect The rect
linePolygon

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

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:75
参数列表
  • 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

测试矩形与矩形是否相交

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:100
参数列表
  • a Rect The first rect
  • b Rect The second rect
rectPolygon

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

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:130
参数列表
  • a Rect The rect
  • b Vec2[] The polygon, a set of points
polygonPolygon

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

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:182
参数列表
  • a Vec2[] The first polygon, a set of points
  • b Vec2[] The second polygon, a set of points
circleCircle

测试圆形与圆形是否相交

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:221
参数列表
  • a Object Object contains position and radius
  • b Object Object contains position and radius
polygonCircle

测试矩形与圆形是否相交

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:238
参数列表
  • polygon Vec2[] The Polygon, a set of points
  • circle Object Object contains position and radius
pointInPolygon

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

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:267
参数列表
  • point Vec2 The point
  • polygon Vec2[] The polygon, a set of points
pointLineDistance

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

meta description
返回 boolean
定义于 https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCIntersection.js:297
参数列表
  • 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

条与 "" 相匹配的结果

    没有与 "" 匹配的结果