KiCad PCB EDA Suite
shape_line_chain.cpp File Reference
#include <algorithm>
#include <limits.h>
#include <math.h>
#include <string>
#include <clipper.hpp>
#include <geometry/seg.h>
#include <geometry/shape_line_chain.h>
#include <math/box2.h>
#include <math/util.h>
#include <math/vector2d.h>

Go to the source code of this file.

Classes

struct  compareOriginDistance
 

Functions

static void addIntersection (SHAPE_LINE_CHAIN::INTERSECTIONS &aIps, int aPc, const SHAPE_LINE_CHAIN::INTERSECTION &aP)
 

Function Documentation

◆ addIntersection()

static void addIntersection ( SHAPE_LINE_CHAIN::INTERSECTIONS aIps,
int  aPc,
const SHAPE_LINE_CHAIN::INTERSECTION aP 
)
inlinestatic

Definition at line 490 of file shape_line_chain.cpp.

491 {
492  if( aIps.size() == 0 )
493  {
494  aIps.push_back( aP );
495  return;
496  }
497 
498  const auto& last = aIps.back();
499 
500  if( ( (last.our.Index() + 1) % aPc) == aP.our.Index() && last.p == aP.p )
501  return;
502 
503  if( last.our.Index() == aP.our.Index() && last.p == aP.p )
504  return;
505 
506  aIps.push_back( aP );
507 }
int Index() const
Function Index()
Definition: seg.h:337
VECTOR2I p
point of intersection between our and their.
SEG our
segment belonging from the (this) argument of Intersect()

References SEG::Index(), SHAPE_LINE_CHAIN::INTERSECTION::our, and SHAPE_LINE_CHAIN::INTERSECTION::p.

Referenced by SHAPE_LINE_CHAIN::Intersect().