new MetaShapeUtils()
Help methods to manipulate bound info base on simple shape.
- Source:
Methods
-
(static) createShapeInfo(shapeType, coords, additionalInfos) → {Object}
-
Create a new ShapeInfo object.
Parameters:
Name Type Description shapeType
Int coords
Array additionalInfos
Hash - Source:
Returns:
- Type
- Object
-
(static) getContainerBox(shapeInfo, Inflation)
-
Returns the minimum rect that contains this shape.
Parameters:
Name Type Description shapeInfo
Object Inflation
Float returns {Object} - Source:
-
(static) getDistance(coord, shapeInfo, inflate) → {Float}
-
Returns distance of coord to a bound shape. A negative value means coord insude shape.
Parameters:
Name Type Description coord
Hash shapeInfo
Hash Provides the shape box information of this object on context. It has the following fields: { shapeType: value from Kekule.Render.MetaShapeType. coords: [Array of coords] otherInfo: ... } Note that shapeInfo may be an array, in that case, nearest distance will be returned. inflate
Float - Source:
Returns:
- Type
- Float
-
(static) inflateShape(originalShape, delta) → {Object}
-
Inflate shape with delta on each direction.
Parameters:
Name Type Description originalShape
Object delta
Float - Source:
Returns:
A new boundInfo.- Type
- Object
-
(static) isAngleInArcRange(testAngle, startAngle, endAngle, anticlockwise) → {Bool}
-
Check if testAngle is in the arc sector.
Parameters:
Name Type Description testAngle
Float startAngle
Float endAngle
Float anticlockwise
Bool - Source:
Returns:
- Type
- Bool
-
(static) isCompositeShape(shape) → {Bool}
-
Check if shape is a composite one (usually is an array of simple shapes).
Parameters:
Name Type Description shape
Variant - Source:
Returns:
- Type
- Bool
-
(static) isCoordInside(coord, shapeInfo, inflate) → {Bool}
-
Check if a point is inside a bound.
Parameters:
Name Type Description coord
Hash shapeInfo
Hash Provides the shape box information of this object on context. It has the following fields: { shapeType: value from Kekule.Render.MetaShapeType. coords: [Array of coords] otherInfo: ... } Note that shapeInfo may be an array to check if coord in either of items of array. inflate
Float - Source:
Returns:
- Type
- Bool
-
(static) isInsideBox(shapeInfo, box) → {Bool}
-
Check if a shape is inside a rect box.
Parameters:
Name Type Description shapeInfo
Object box
Hash - Source:
Returns:
- Type
- Bool
-
(static) isInsidePolygon(shapeInfo, polygonCoords) → {Bool}
-
Check if a shape is inside a polygon defined by polygonCoords.
Parameters:
Name Type Description shapeInfo
Object polygonCoords
Array - Source:
Returns:
- Type
- Bool
-
(static) isIntersectingBox(shapeInfo, box) → {Bool}
-
Check if a shape is intersecting with box.
Parameters:
Name Type Description shapeInfo
Object box
Hash - Source:
Returns:
- Type
- Bool
-
(static) isIntersectingLine(shapeInfo, lineCoords, lineWidth) → {Bool}
-
Check if a shape is intersecting with a line with a certain stroke width.
Parameters:
Name Type Description shapeInfo
Object lineCoords
Array lineWidth
Number - Source:
Returns:
- Type
- Bool
-
(static) isIntersectingPolygon(shapeInfo, polygonCoords) → {Bool}
-
Check if a shape is intersecting with a polygon defined by polygonCoords.
Parameters:
Name Type Description shapeInfo
Object polygonCoords
Array - Source:
Returns:
- Type
- Bool
-
(static) isIntersectingPolyline(shapeInfo, lineCoords, lineWidth) → {Bool}
-
Check if a shape is intersecting with a polyline with a certain stroke width.
Parameters:
Name Type Description shapeInfo
Object lineCoords
Array lineWidth
Number - Source:
Returns:
- Type
- Bool
-
(static) isPointInsidePolygon(pointCoord, polygonCoords)
-
Check if a 2D point inside a polygon. The algorithm is from https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html
Parameters:
Name Type Description pointCoord
Hash polygonCoords
Array - Source: