MonotoneChainOverlapAction.js 714 B

1234567891011121314151617181920
  1. import LineSegment from '../../geom/LineSegment'
  2. export default class MonotoneChainOverlapAction {
  3. constructor() {
  4. MonotoneChainOverlapAction.constructor_.apply(this, arguments)
  5. }
  6. static constructor_() {
  7. this._overlapSeg1 = new LineSegment()
  8. this._overlapSeg2 = new LineSegment()
  9. }
  10. overlap() {
  11. if (arguments.length === 2) {
  12. const seg1 = arguments[0], seg2 = arguments[1]
  13. } else if (arguments.length === 4) {
  14. const mc1 = arguments[0], start1 = arguments[1], mc2 = arguments[2], start2 = arguments[3]
  15. mc1.getLineSegment(start1, this._overlapSeg1)
  16. mc2.getLineSegment(start2, this._overlapSeg2)
  17. this.overlap(this._overlapSeg1, this._overlapSeg2)
  18. }
  19. }
  20. }