summaryrefslogtreecommitdiffstats
path: root/Vertex3d.h
blob: faad420c44853610ed2dd6c15095ed154583b5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef VERTEX3D_H_
#define VERTEX3D_H_

class Vertex3d {
  private:
    float x, y, z;
    
  public:
    Vertex3d() {x = y = z = 0.0;}
    Vertex3d(float x, float y, float z) {this->x = x; this->y = y; this->z = z;}
    
    float getX() const {return x;}
    void setX(float x) {this->x = x;}
    
    float getY() const {return y;}
    void setY(float y) {this->y = y;}
    
    float getZ() const {return z;}
    void setZ(float z) {this->z = z;}
    
    void setLocation(float x, float y, float z) {this->x = x; this->y = y; this->z = z;}
    
    float distanceSq(const Vertex3d &v) const;
    float distance(const Vertex3d &v) const;
    
    Vertex3d operator+(const Vertex3d &v) const;
    Vertex3d operator-(const Vertex3d &v) const;
    
    Vertex3d& operator+=(const Vertex3d &v);
    Vertex3d& operator-=(const Vertex3d &v);
};

#endif /*VERTEX3D_H_*/