KiCad PCB EDA Suite
p2t::Point Struct Reference

#include <shapes.h>

Public Member Functions

 Point ()
 Default constructor does nothing (for performance). More...
 
 Point (double ax, double ay)
 Construct using coordinates. More...
 
void set_zero ()
 Set this point to all zeros. More...
 
void set (double x_, double y_)
 Set this point to some specified coordinates. More...
 
Point operator- () const
 Negate this point. More...
 
void operator+= (const Point &v)
 Add a point to this point. More...
 
void operator-= (const Point &v)
 Subtract a point from this point. More...
 
void operator*= (double a)
 Multiply this point by a scalar. More...
 
double Length () const
 Get the length of this point (the norm). More...
 
double Normalize ()
 Convert this point into a unit point. Returns the Length. More...
 

Public Attributes

double x
 
double y
 
std::vector< Edge * > edge_list
 The edges this point constitutes an upper ending point. More...
 

Detailed Description

Definition at line 44 of file shapes.h.

Constructor & Destructor Documentation

p2t::Point::Point ( )
inline

Default constructor does nothing (for performance).

Definition at line 49 of file shapes.h.

50  {
51  x = 0.0;
52  y = 0.0;
53  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
p2t::Point::Point ( double  ax,
double  ay 
)
inline

Construct using coordinates.

Definition at line 59 of file shapes.h.

59 : x( ax ), y( ay ) {}
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46

Member Function Documentation

double p2t::Point::Length ( ) const
inline

Get the length of this point (the norm).

Definition at line 106 of file shapes.h.

Referenced by Normalize().

107  {
108  return sqrt( x * x + y * y );
109  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
double p2t::Point::Normalize ( )
inline

Convert this point into a unit point. Returns the Length.

Definition at line 112 of file shapes.h.

References Length().

113  {
114  double len = Length();
115 
116  x /= len;
117  y /= len;
118  return len;
119  }
double Length() const
Get the length of this point (the norm).
Definition: shapes.h:106
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
void p2t::Point::operator*= ( double  a)
inline

Multiply this point by a scalar.

Definition at line 99 of file shapes.h.

100  {
101  x *= a;
102  y *= a;
103  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
void p2t::Point::operator+= ( const Point v)
inline

Add a point to this point.

Definition at line 85 of file shapes.h.

References x, and y.

86  {
87  x += v.x;
88  y += v.y;
89  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
Point p2t::Point::operator- ( ) const
inline

Negate this point.

Definition at line 76 of file shapes.h.

References set().

77  {
78  Point v;
79 
80  v.set( -x, -y );
81  return v;
82  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
Point()
Default constructor does nothing (for performance).
Definition: shapes.h:49
void p2t::Point::operator-= ( const Point v)
inline

Subtract a point from this point.

Definition at line 92 of file shapes.h.

References x, and y.

93  {
94  x -= v.x;
95  y -= v.y;
96  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
void p2t::Point::set ( double  x_,
double  y_ 
)
inline

Set this point to some specified coordinates.

Definition at line 69 of file shapes.h.

Referenced by operator-().

70  {
71  x = x_;
72  y = y_;
73  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46
void p2t::Point::set_zero ( )
inline

Set this point to all zeros.

Definition at line 62 of file shapes.h.

63  {
64  x = 0.0;
65  y = 0.0;
66  }
double y
Definition: shapes.h:46
double x
Definition: shapes.h:46

Member Data Documentation

std::vector<Edge*> p2t::Point::edge_list

The edges this point constitutes an upper ending point.

Definition at line 56 of file shapes.h.

Referenced by p2t::Edge::Edge().


The documentation for this struct was generated from the following file: