You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.6 KiB

  1. /*
  2. * KiRouter - a push-and-(sometimes-)shove PCB router
  3. *
  4. * Copyright (C) 2013 CERN
  5. * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.or/licenses/>.
  19. */
  20. #include "pns_utils.h"
  21. #include "pns_line.h"
  22. #include "pns_router.h"
  23. const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I& aP0, const VECTOR2I& aSize, int aClearance, int aChamfer)
  24. {
  25. SHAPE_LINE_CHAIN s;
  26. s.SetClosed( true );
  27. s.Append(aP0.x - aClearance , aP0.y - aClearance + aChamfer);
  28. s.Append(aP0.x - aClearance + aChamfer, aP0.y - aClearance);
  29. s.Append(aP0.x + aSize.x + aClearance - aChamfer, aP0.y - aClearance);
  30. s.Append(aP0.x + aSize.x + aClearance, aP0.y - aClearance + aChamfer);
  31. s.Append(aP0.x + aSize.x + aClearance, aP0.y + aSize.y + aClearance - aChamfer);
  32. s.Append(aP0.x + aSize.x + aClearance - aChamfer, aP0.y + aSize.y + aClearance);
  33. s.Append(aP0.x - aClearance + aChamfer, aP0.y + aSize.y + aClearance);
  34. s.Append(aP0.x - aClearance, aP0.y + aSize.y + aClearance - aChamfer);
  35. return s;
  36. }