SMIL  1.0.4
Point< T > Class Template Reference

Struct Point. More...

Detailed Description

template<class T = int>
class smil::Point< T >

Struct Point.

#include <DCommon.h>

+ Inheritance diagram for Point< T >:
+ Collaboration diagram for Point< T >:

Public Member Functions

 Point ()
 Contructor - an empty point. More...
 
 Point (const Point &pt)
 Constructor from another point. More...
 
 Point (T _x, T _y, T _z)
 3D Point Constructor More...
 
 Point (T _x, T _y)
 2D Point Constructor More...
 
bool operator== (const Point &p2)
 operator== - comparison More...
 
Point operator- (const Point &p2)
 operator- - subtract two points More...
 
Point operator+ (const Point &p2)
 operator+ - add two points More...
 
void printSelf (string indent="")
 printSelf() - Print point coordinates More...
 

Public Attributes

x
 
y
 
z
 

Constructor & Destructor Documentation

◆ Point() [1/4]

Point ( )
inline

Contructor - an empty point.

All coordinates are set to 0

◆ Point() [2/4]

Point ( const Point< T > &  pt)
inline

Constructor from another point.

Note
Both points shall be of the same data type

◆ Point() [3/4]

Point ( _x,
_y,
_z 
)
inline

3D Point Constructor

Parameters
[in]_x,_y,_z: initial coordinates

◆ Point() [4/4]

Point ( _x,
_y 
)
inline

2D Point Constructor

Parameters
[in]_x,_y: initial coordinates

Member Function Documentation

◆ operator==()

bool operator== ( const Point< T > &  p2)
inline

operator== - comparison

Parameters
[in]p2: point

◆ operator-()

Point operator- ( const Point< T > &  p2)
inline

operator- - subtract two points

Example

import smilPython as sp
# p1 and p2 shall have the same data type
p1 = sp.IntPoint(10, 30, 40)
p2 = sp.IntPoint(40, 30, 10)
p3 = sp.IntPoint(p2 - p1)
p1.printSelf(" P1 : ")
p2.printSelf(" P2 : ")
p3.printSelf(" Difference : ")
p3 = sp.IntPoint(p2 + p1)
p3.printSelf(" Sum : ")

◆ operator+()

Point operator+ ( const Point< T > &  p2)
inline

operator+ - add two points

Example

import smilPython as sp
# p1 and p2 shall have the same data type
p1 = sp.IntPoint(10, 30, 40)
p2 = sp.IntPoint(40, 30, 10)
p3 = sp.IntPoint(p2 - p1)
p1.printSelf(" P1 : ")
p2.printSelf(" P2 : ")
p3.printSelf(" Difference : ")
p3 = sp.IntPoint(p2 + p1)
p3.printSelf(" Sum : ")

◆ printSelf()

void printSelf ( string  indent = "")
inline

printSelf() - Print point coordinates

Parameters
[in]indent: prefix to add to each line

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