SMIL 1.1.2
Loading...
Searching...
No Matches
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.
 
 Point (const Point &pt)
 Constructor from another point.
 
 Point (T _x, T _y, T _z)
 3D Point Constructor
 
 Point (T _x, T _y)
 2D Point Constructor
 
bool operator== (const Point &p2)
 operator== - comparison
 
Point operator- (const Point &p2)
 operator- - subtract two points
 
Point operator+ (const Point &p2)
 operator+ - add two points
 
void printSelf (string indent="")
 printSelf() - Print point coordinates
 

Constructor & Destructor Documentation

◆ Point() [1/4]

template<class T = int>
Point ( )
inline

Contructor - an empty point.

All coordinates are set to 0

◆ Point() [2/4]

template<class T = int>
Point ( const Point< T > &  pt)
inline

Constructor from another point.

Note
Both points shall be of the same data type

◆ Point() [3/4]

template<class T = int>
Point ( _x,
_y,
_z 
)
inline

3D Point Constructor

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

◆ Point() [4/4]

template<class T = int>
Point ( _x,
_y 
)
inline

2D Point Constructor

Parameters
[in]_x,_y: initial coordinates

Member Function Documentation

◆ operator==()

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

operator== - comparison

Parameters
[in]p2: point

◆ operator-()

template<class T = int>
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+()

template<class T = int>
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()

template<class T = int>
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: