KiCad PCB EDA Suite
Loading...
Searching...
No Matches
vector_utils.h File Reference

Supplemental functions for working with vectors and simple objects that interact with vectors. More...

#include <math/vector2d.h>

Go to the source code of this file.

Namespaces

namespace  KIGEOM
 

Functions

template<typename T >
bool KIGEOM::PointIsInDirection (const VECTOR2< T > &aPoint, const VECTOR2< T > &aDirection, const VECTOR2< T > &aFrom)
 
template<typename T >
bool KIGEOM::PointsAreInSameDirection (const VECTOR2< T > &aPointA, const VECTOR2< T > &aPointB, const VECTOR2< T > &aFrom)
 Check that the two given points are in the same direction from some other point.
 
bool KIGEOM::SegIsInDirection (const SEG &aSeg, const VECTOR2I &aDirection)
 Determine if a segment's vector is within 90 degrees of a given direction.
 
bool KIGEOM::PointProjectsOntoSegment (const VECTOR2I &aPoint, const SEG &aSeg)
 Determine if a point projects onto a segment.
 
double KIGEOM::GetLengthRatioFromStart (const VECTOR2I &aPoint, const SEG &aSeg)
 Get the ratio of the vector to a point from the segment's start, compared to the segment's length.
 
double KIGEOM::GetProjectedPointLengthRatio (const VECTOR2I &aPoint, const SEG &aSeg)
 Get the ratio of the vector to a point projected onto a segment from the start, relative to the segment's length.
 
const VECTOR2IKIGEOM::GetNearestEndpoint (const SEG &aSeg, const VECTOR2I &aPoint)
 Get the nearest end of a segment to a point.
 
VECTOR2I KIGEOM::RoundGrid (const VECTOR2I &aVec, int aGridSize)
 Round a vector to the nearest grid point in any direction.
 
VECTOR2I KIGEOM::RoundNW (const VECTOR2I &aVec, int aGridSize)
 Round a vector to the nearest grid point in the NW direction.
 
VECTOR2I KIGEOM::RoundSE (const VECTOR2I &aVec, int aGridSize)
 Round a vector to the nearest grid point in the SE direction.
 

Detailed Description

Supplemental functions for working with vectors and simple objects that interact with vectors.

Definition in file vector_utils.h.