KiCad PCB EDA Suite
EC_LINE Class Reference

Class EC_LINE. More...

#include <edit_constraints.h>

Inheritance diagram for EC_LINE:
EDIT_CONSTRAINT< EDIT_POINT >

Public Member Functions

 EC_LINE (EDIT_POINT &aConstrained, const EDIT_POINT &aConstrainer)
 
virtual void Apply (EDIT_POINT &aHandle) override
 > More...
 
void Apply ()
 Function Apply() More...
 

Protected Attributes

EDIT_POINTm_constrained
 Point that is constrained by rules implemented by Apply() More...
 

Private Attributes

const EDIT_POINTm_constrainer
 Point that imposes the constraint. More...
 
VECTOR2I m_line
 Vector representing the constraining line. More...
 

Detailed Description

Class EC_LINE.

EDIT_CONSTRAINT that imposes a constraint that a point has to lie on a line (determined by 2 points).

Definition at line 161 of file edit_constraints.h.

Constructor & Destructor Documentation

EC_LINE::EC_LINE ( EDIT_POINT aConstrained,
const EDIT_POINT aConstrainer 
)

Definition at line 62 of file edit_constraints.cpp.

References EDIT_POINT::GetPosition(), EDIT_CONSTRAINT< EDIT_POINT >::m_constrained, m_constrainer, and m_line.

62  :
63  EDIT_CONSTRAINT<EDIT_POINT>( aConstrained ), m_constrainer( aConstrainer )
64 {
66 }
VECTOR2I m_line
Vector representing the constraining line.
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:65
EDIT_POINT & m_constrained
Point that is constrained by rules implemented by Apply()
const EDIT_POINT & m_constrainer
Point that imposes the constraint.

Member Function Documentation

void EDIT_CONSTRAINT< EDIT_POINT >::Apply ( )
inlineinherited

Function Apply()

Corrects coordinates of the constrained edit handle.

Definition at line 66 of file edit_constraints.h.

67  {
69  }
void Apply()
Function Apply()
EDIT_POINT & m_constrained
Point that is constrained by rules implemented by Apply()
void EC_LINE::Apply ( EDIT_POINT aHandle)
overridevirtual

>

Function Apply() Corrects coordinates of the constrained edit handle.

Implements EDIT_CONSTRAINT< EDIT_POINT >.

Definition at line 69 of file edit_constraints.cpp.

References EDIT_POINT::GetPosition(), intersect(), m_constrainer, m_line, main(), VECTOR2< T >::Perpendicular(), and EDIT_POINT::SetPosition().

70 {
72  SEG projection( aHandle.GetPosition(), aHandle.GetPosition() + m_line.Perpendicular() );
73 
74  if( OPT_VECTOR2I intersect = projection.IntersectLines( main ) )
75  aHandle.SetPosition( *intersect );
76 }
VECTOR2I m_line
Vector representing the constraining line.
int main(int argc, char **argv)
static bool intersect(const SEGMENT_WITH_NORMALS &aSeg, const SFVEC2F &aStart, const SFVEC2F &aEnd)
Definition: cpolygon2d.cpp:293
Definition: seg.h:37
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:65
VECTOR2< T > Perpendicular() const
Function Perpendicular computes the perpendicular vector.
Definition: vector2d.h:306
const EDIT_POINT & m_constrainer
Point that imposes the constraint.
virtual void SetPosition(const VECTOR2I &aPosition)
Function SetPosition()
Definition: edit_points.h:97

Member Data Documentation

EDIT_POINT & EDIT_CONSTRAINT< EDIT_POINT >::m_constrained
protectedinherited

Point that is constrained by rules implemented by Apply()

Definition at line 72 of file edit_constraints.h.

Referenced by EC_LINE().

const EDIT_POINT& EC_LINE::m_constrainer
private

Point that imposes the constraint.

Definition at line 170 of file edit_constraints.h.

Referenced by Apply(), and EC_LINE().

VECTOR2I EC_LINE::m_line
private

Vector representing the constraining line.

Definition at line 171 of file edit_constraints.h.

Referenced by Apply(), and EC_LINE().


The documentation for this class was generated from the following files: