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 517 of file shape_line_chain.cpp.

518 {
519  if( aIps.size() == 0 )
520  {
521  aIps.push_back( aP );
522  return;
523  }
524 
525  const auto& last = aIps.back();
526 
527  if( ( (last.our.Index() + 1) % aPc) == aP.our.Index() && last.p == aP.p )
528  return;
529 
530  if( last.our.Index() == aP.our.Index() && last.p == aP.p )
531  return;
532 
533  aIps.push_back( aP );
534 }
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().