KiCad PCB EDA Suite
EC_CIRCLE Class Reference

Class EC_CIRCLE. More...

#include <edit_constraints.h>

Inheritance diagram for EC_CIRCLE:
EDIT_CONSTRAINT< EDIT_POINT >

Public Member Functions

 EC_CIRCLE (EDIT_POINT &aConstrained, const EDIT_POINT &aCenter, const EDIT_POINT &aEnd)
 Constructor. More...
 
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_center
 

Point that imposes the constraint (center of the circle).

More...
 
const EDIT_POINTm_end
 

Point that imposes the constraint (decides on the radius of the circle).

More...
 

Detailed Description

Class EC_CIRCLE.

EDIT_CONSTRAINT that imposes a constraint that a point has to lie on a circle.

Definition at line 180 of file edit_constraints.h.

Constructor & Destructor Documentation

EC_CIRCLE::EC_CIRCLE ( EDIT_POINT aConstrained,
const EDIT_POINT aCenter,
const EDIT_POINT aEnd 
)
inline

Constructor.

Parameters
aConstrainedis the point that is put under constrain.
aCenteris the point that is the center of the circle.
aEndis the point that decides on the radius of the circle.

Definition at line 190 of file edit_constraints.h.

190  :
191  EDIT_CONSTRAINT<EDIT_POINT>( aConstrained ), m_center( aCenter ), m_end( aEnd )
192  {}
const EDIT_POINT & m_center
Point that imposes the constraint (center of the circle).
const EDIT_POINT & m_end
Point that imposes the constraint (decides on the radius of the circle).

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_CIRCLE::Apply ( EDIT_POINT aHandle)
overridevirtual

>

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

Implements EDIT_CONSTRAINT< EDIT_POINT >.

Definition at line 79 of file edit_constraints.cpp.

References VECTOR2< T >::Angle(), PNS::angle(), VECTOR2< T >::EuclideanNorm(), EDIT_POINT::GetPosition(), m_center, m_end, VECTOR2< T >::Rotate(), and EDIT_POINT::SetPosition().

80 {
81  VECTOR2I centerToEnd = m_end.GetPosition() - m_center.GetPosition();
82  VECTOR2I centerToPoint = aHandle.GetPosition() - m_center.GetPosition();
83 
84  int radius = centerToEnd.EuclideanNorm();
85  double angle = centerToPoint.Angle();
86 
87  VECTOR2I newLine( radius, 0 );
88  newLine = newLine.Rotate( angle );
89 
90  aHandle.SetPosition( m_center.GetPosition() + newLine );
91 }
const EDIT_POINT & m_center
Point that imposes the constraint (center of the circle).
double Angle() const
Function Angle computes the angle of the vector.
Definition: vector2d.h:309
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:295
const EDIT_POINT & m_end
Point that imposes the constraint (decides on the radius of the circle).
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:65
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
virtual void SetPosition(const VECTOR2I &aPosition)
Function SetPosition()
Definition: edit_points.h:97

Member Data Documentation

const EDIT_POINT& EC_CIRCLE::m_center
private

Point that imposes the constraint (center of the circle).

Definition at line 199 of file edit_constraints.h.

Referenced by Apply().

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::EC_LINE().

const EDIT_POINT& EC_CIRCLE::m_end
private

Point that imposes the constraint (decides on the radius of the circle).

Definition at line 202 of file edit_constraints.h.

Referenced by Apply().


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