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, int aid=0)
 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
 
int id
 
std::vector< Edge * > edge_list
 The edges this point constitutes an upper ending point. More...
 

Detailed Description

Definition at line 45 of file shapes.h.

Constructor & Destructor Documentation

p2t::Point::Point ( )
inline

Default constructor does nothing (for performance).

Definition at line 51 of file shapes.h.

52  {
53  x = 0.0;
54  y = 0.0;
55  id = 0;
56  }
double y
Definition: shapes.h:47
double x
Definition: shapes.h:47
p2t::Point::Point ( double  ax,
double  ay,
int  aid = 0 
)
inline

Construct using coordinates.

Definition at line 62 of file shapes.h.

62 : x(ax), y(ay), id(aid) {}
int id
Definition: shapes.h:48
double y
Definition: shapes.h:47
double x
Definition: shapes.h:47

Member Function Documentation

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

Get the length of this point (the norm).

Definition at line 108 of file shapes.h.

Referenced by Normalize().

109  {
110  return sqrt(x * x + y * y);
111  }
double y
Definition: shapes.h:47
double x
Definition: shapes.h:47
double p2t::Point::Normalize ( )
inline

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

Definition at line 114 of file shapes.h.

References Length().

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

Multiply this point by a scalar.

Definition at line 101 of file shapes.h.

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

Add a point to this point.

Definition at line 87 of file shapes.h.

References x, and y.

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

Negate this point.

Definition at line 79 of file shapes.h.

References set().

80  {
81  Point v;
82  v.set(-x, -y);
83  return v;
84  }
double y
Definition: shapes.h:47
double x
Definition: shapes.h:47
Point()
Default constructor does nothing (for performance).
Definition: shapes.h:51
void p2t::Point::operator-= ( const Point v)
inline

Subtract a point from this point.

Definition at line 94 of file shapes.h.

References x, and y.

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

Set this point to some specified coordinates.

Definition at line 72 of file shapes.h.

Referenced by operator-().

73  {
74  x = x_;
75  y = y_;
76  }
double y
Definition: shapes.h:47
double x
Definition: shapes.h:47
void p2t::Point::set_zero ( )
inline

Set this point to all zeros.

Definition at line 65 of file shapes.h.

66  {
67  x = 0.0;
68  y = 0.0;
69  }
double y
Definition: shapes.h:47
double x
Definition: shapes.h:47

Member Data Documentation

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

The edges this point constitutes an upper ending point.

Definition at line 59 of file shapes.h.

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

int p2t::Point::id

Definition at line 48 of file shapes.h.


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