22 #ifndef ULTIMA8_MISC_POINT3_H 23 #define ULTIMA8_MISC_POINT3_H 25 #include "common/stream.h" 33 Point3() : x(0), y(0), z(0) {}
34 Point3(int32 nx, int32 ny, int32 nz) : x(nx), y(ny), z(nz) {}
36 bool operator==(
const Point3 &rhs)
const {
return equals(rhs); }
37 bool operator!=(
const Point3 &rhs)
const {
return !equals(rhs); }
39 bool equals(
const Point3 &p)
const {
40 return (x == p.x && y == p.y && z == p.z);
43 Point3 operator+(
const Point3 &delta)
const {
return Point3(x + delta.x, y + delta.y, z + delta.z); }
44 Point3 operator-(
const Point3 &delta)
const {
return Point3(x - delta.x, y - delta.y, z - delta.z); }
46 void operator+=(
const Point3 &delta) {
52 void operator-=(
const Point3 &delta) {
58 int maxDistXYZ(
const Point3 &other)
const {
59 int xdiff = abs(x - other.x);
60 int ydiff = abs(y - other.y);
61 int zdiff = abs(z - other.z);
62 return MAX(xdiff,
MAX(ydiff, zdiff));
65 uint32 sqrDist(
const Point3 &other)
const {
66 int xdiff = abs(x - other.x);
67 int ydiff = abs(y - other.y);
68 int zdiff = abs(z - other.z);
69 return uint32(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
72 void set(int32 nx, int32 ny, int32 nz) {
78 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:64
FORCEINLINE void writeSint32LE(int32 value)
Definition: stream.h:200