KiCad PCB EDA Suite
round_segment_2d.h File Reference
#include "object_2d.h"
#include "../ray.h"
#include <plugins/3dapi/xv3d_types.h>

Go to the source code of this file.

Classes

class  ROUND_SEGMENT_2D
 

Functions

bool Is_segment_a_circle (const SFVEC2F &aStart, const SFVEC2F &aEnd)
 Check if segment start and end is very close to each other. More...
 

Variables

static const float s_min_dot = ( FLT_EPSILON * 4.0f * FLT_EPSILON * 4.0f )
 

Function Documentation

◆ Is_segment_a_circle()

bool Is_segment_a_circle ( const SFVEC2F aStart,
const SFVEC2F aEnd 
)
inline

Check if segment start and end is very close to each other.

This should used to check if the segment should be converted to a circle instead.

Returns
true is it is better to convert the segment to circle

Definition at line 98 of file round_segment_2d.h.

99 {
100  const SFVEC2F vec = aEnd - aStart;
101 
102  // This is the same as calc the length squared (without the sqrt)
103  // and compare with a small value.
104  return (aStart == aEnd) || ( glm::dot( vec, vec ) <= s_min_dot );
105 }
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
static const float s_min_dot

References s_min_dot.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), BOARD_ADAPTER::addSolidAreasShapes(), addTextSegmToContainer(), BOARD_ADAPTER::buildPadOutlineAsSegments(), BOARD_ADAPTER::createPadWithClearance(), BOARD_ADAPTER::createTrack(), and BOARD_ADAPTER::transformArcToSegments().

Variable Documentation

◆ s_min_dot

const float s_min_dot = ( FLT_EPSILON * 4.0f * FLT_EPSILON * 4.0f )
static

Definition at line 89 of file round_segment_2d.h.

Referenced by Is_segment_a_circle().