ModelUtil.js 829 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * 合并
  3. * @param rowPoints
  4. * @param colPoints
  5. */
  6. export function mergePointArray(rowPoints, colPoints){
  7. rowPoints : [cc.Vec2];
  8. colPoints : [cc.Vec2];
  9. let result = rowPoints.concat();
  10. colPoints = colPoints.filter(function (colEle) {
  11. let repeat = false;
  12. result.forEach(function (rowEle) {
  13. if(colEle.equals(rowEle)){
  14. repeat = true
  15. }
  16. }, this);
  17. return !repeat;
  18. }, this);
  19. result.push(...colPoints);
  20. return result;
  21. }
  22. /**
  23. * 减法
  24. * @param points
  25. * @param exclusivePoint
  26. */
  27. export function exclusivePoint(points, exclusivePoint){
  28. points:[cc.Vec2]
  29. let result = new Array();
  30. for(let point of points){
  31. if(!point.equals(exclusivePoint)){
  32. result.push(point);
  33. }
  34. }
  35. return result;
  36. }