22 #ifndef ULTIMA8_MISC_POINT3_H 23 #define ULTIMA8_MISC_POINT3_H 31 Point3() : x(0), y(0), z(0) {}
32 Point3(int32 nx, int32 ny, int32 nz) : x(nx), y(ny), z(nz) {}
34 bool operator==(
const Point3 &rhs)
const {
return equals(rhs); }
35 bool operator!=(
const Point3 &rhs)
const {
return !equals(rhs); }
37 bool equals(
const Point3 &p)
const {
38 return (x == p.x && y == p.y && z == p.z);
41 Point3 operator+(
const Point3 &delta)
const {
return Point3(x + delta.x, y + delta.y, z + delta.z); }
42 Point3 operator-(
const Point3 &delta)
const {
return Point3(x - delta.x, y - delta.y, z - delta.z); }
44 void operator+=(
const Point3 &delta) {
50 void operator-=(
const Point3 &delta) {
56 int maxDistXYZ(
const Point3 &other)
const {
57 int xdiff = abs(x - other.x);
58 int ydiff = abs(y - other.y);
59 int zdiff = abs(z - other.z);
60 return MAX(xdiff,
MAX(ydiff, zdiff));
63 uint32 sqrDist(
const Point3 &other)
const {
64 int xdiff = abs(x - other.x);
65 int ydiff = abs(y - other.y);
66 int zdiff = abs(z - other.z);
67 return uint32(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
70 void set(int32 nx, int32 ny, int32 nz) {
76 void translate(int32 dx, int32 dy, int32 dz) {
FORCEINLINE int32 readSint32LE()
Definition: stream.h:555
Definition: detection.h:27
T MAX(T a, T b)
Definition: util.h:62
FORCEINLINE void writeSint32LE(int32 value)
Definition: stream.h:200