TrinityCore
Loading...
Searching...
No Matches
vec3d.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef VEC3D_H
19#define VEC3D_H
20
21class Vec3D
22{
23public:
24 float x, y, z;
25
26 Vec3D(float x0 = 0.0f, float y0 = 0.0f, float z0 = 0.0f) : x(x0), y(y0), z(z0) { }
27
28 Vec3D(Vec3D const& v) = default;
29
30 Vec3D& operator=(Vec3D const& v) = default;
31
32 Vec3D operator+(Vec3D const& v) const
33 {
34 return Vec3D(*this) += v;
35 }
36
37 Vec3D operator-(Vec3D const& v) const
38 {
39 return Vec3D(*this) -= v;
40 }
41
43 {
44 x += v.x;
45 y += v.y;
46 z += v.z;
47 return *this;
48 }
49
51 {
52 x -= v.x;
53 y -= v.y;
54 z -= v.z;
55 return *this;
56 }
57};
58
60{
61public:
64
65 AaBox3D& operator+=(Vec3D const& offset)
66 {
67 min += offset;
68 max += offset;
69 return *this;
70 }
71};
72
74{
75 float X, Y, Z, W;
76};
77
78#endif
Vec3D max
Definition vec3d.h:63
Vec3D min
Definition vec3d.h:62
AaBox3D & operator+=(Vec3D const &offset)
Definition vec3d.h:65
Definition vec3d.h:22
Vec3D(Vec3D const &v)=default
float x
Definition vec3d.h:24
Vec3D operator+(Vec3D const &v) const
Definition vec3d.h:32
Vec3D operator-(Vec3D const &v) const
Definition vec3d.h:37
float y
Definition vec3d.h:24
float z
Definition vec3d.h:24
Vec3D(float x0=0.0f, float y0=0.0f, float z0=0.0f)
Definition vec3d.h:26
Vec3D & operator=(Vec3D const &v)=default
Vec3D & operator-=(Vec3D const &v)
Definition vec3d.h:50
Vec3D & operator+=(Vec3D const &v)
Definition vec3d.h:42
float X
Definition vec3d.h:75
float Z
Definition vec3d.h:75
float Y
Definition vec3d.h:75
float W
Definition vec3d.h:75