16 typedef std::int64_t dbIndex;
19 typedef char Dimension;
24 inline bool IsDimensionValid(Dimension dimension)
26 return ((dimension >=
'a' && dimension <=
'z') || (dimension >=
'A' && dimension <=
'Z'));
32 inline void ThrowIfDimensionInvalid(Dimension dimension)
34 if (!imgdoc2::IsDimensionValid(dimension))
36 std::ostringstream ss;
37 ss <<
"The character '" << (isprint(dimension) ? dimension :
'?') <<
"'=0x" << std::setfill(
'0') << std::setw(2) << std::hex << static_cast<int>(dimension) <<
" is not a valid dimension specifier.";
38 throw std::invalid_argument(ss.str());
144 throw std::invalid_argument(
"width and height must be non-negative");
163 if (this->x <= p.
x && (this->x + this->w) >= p.
x && this->y <= p.
y && (this->y + this->h) >= p.
y)
237 if (
w < 0 ||
h < 0 ||
d < 0)
239 throw std::invalid_argument(
"width and height must be non-negative");
262 if (this->x <= p.
x && (this->x + this->w) >= p.
x && this->y <= p.
y && (this->y + this->h) >= p.
y && this->z <= p.
z && (this->z + this->d) >= p.
z)
274 return Point3dT<t>(this->x + this->w / 2, this->y + this->h / 2, this->z + this->d / 2);
305 CuboidF(
float x,
float y,
float z,
float w,
float h,
float d) :
CuboidT<float>(
x,
y,
z,
w,
h,
d) {}
321 CuboidD(
double x,
double y,
double z,
double w,
double h,
double d) :
CuboidT<double>(
x,
y,
z,
w,
h,
d) {}
326 template <
typename t>
351 return Vector3dT(this->x / absVal, this->y / absVal, this->z / absVal);
358 return this->x * this->x + this->y * this->y + this->z * this->
z;
376 vectorA.
y * vectorB.
z - vectorA.
z * vectorB.
y,
377 vectorA.
z * vectorB.
x - vectorA.
x * vectorB.
z,
378 vectorA.
x * vectorB.
y - vectorA.
y * vectorB.
x
388 return vectorA.
x * vectorB.
x + vectorA.
y * vectorB.
y + vectorA.
z * vectorB.
z;
449 typedef Plane_NormalAndDist<float> Plane_NormalAndDistF;
453 typedef Plane_NormalAndDist<double> Plane_NormalAndDistD;
462 const auto r = aabbExtents.
x * fabs(plane.
normal.
x) + aabbExtents.
y * fabs(plane.
normal.
y) + aabbExtents.
z * fabs(plane.
normal.
z);
Structure defining an axis-aligned cuboid in three dimensions with doubles representing the coordinat...
Definition: types.h:310
CuboidD(double x, double y, double z, double w, double h, double d)
Definition: types.h:321
Structure defining an axis-aligned cuboid in three dimensions with floats representing the coordinate...
Definition: types.h:294
CuboidF(float x, float y, float z, float w, float h, float d)
Definition: types.h:305
Point3dT< t > CenterPoint() const
Definition: types.h:272
CuboidT(t x, t y, t z, t w, t h, t d)
Definition: types.h:235
static bool DoIntersect(const imgdoc2::CuboidT< t > &aabb, const imgdoc2::Plane_NormalAndDist< t > &plane)
Definition: types.h:455
t z
The z-coordinate of the edge point of the cuboid.
Definition: types.h:252
bool DoesIntersectWith(const imgdoc2::Plane_NormalAndDist< t > &plane) const
Definition: types.h:286
t x
The x-coordinate of the edge point of the cuboid.
Definition: types.h:250
bool IsPointInside(const Point3dT< t > &p) const
Definition: types.h:260
t w
The width of the cuboid (i.e. the extent in x-direction).
Definition: types.h:253
t y
The y-coordinate of the edge point of the cuboid.
Definition: types.h:251
t h
The height of the cuboid (i.e. the extent in y-direction).
Definition: types.h:254
t d
The depth of the cuboid (i.e. the extent in z-direction).
Definition: types.h:255
CuboidT()
Default constructor. All properties are set to zero.
Definition: types.h:225
PointD b
The second point on the line.
Definition: types.h:213
PointD a
The first point on the line.
Definition: types.h:212
PointF b
The second point on the line.
Definition: types.h:205
PointF a
The first point on the line.
Definition: types.h:204
Plane_NormalAndDist()
Default constructor. All properties are initialized to zero.
Definition: types.h:426
Plane_NormalAndDist(const Vector3dT< T > &n, T d)
Definition: types.h:431
T distance
The distance of the plane to the origin.
Definition: types.h:423
static Plane_NormalAndDist< T > FromThreePoints(Point3dT< T > a, Point3dT< T > b, Point3dT< T > c)
Definition: types.h:439
Vector3dT< T > normal
The normal of the plane.
Definition: types.h:422
Structure defining a point in three dimensions with doubles representing the coordinates.
Definition: types.h:116
Point3dD(double x, double y, double z)
Definition: types.h:123
Structure defining a point in three dimensions with floats representing the coordinates.
Definition: types.h:104
Point3dF(float x, float y, float z)
Definition: types.h:111
Point3dT()
Default constructor which sets all properties to zero.
Definition: types.h:89
t y
The y-coordinate of the point.
Definition: types.h:98
Point3dT(t x, t y, t z)
Definition: types.h:95
t x
The x-coordinate of the point.
Definition: types.h:97
t z
The z-coordinate of the point.
Definition: types.h:99
Structure defining a point in two dimensions with doubles representing the coordinates.
Definition: types.h:73
PointD()
Default constructor which sets all properties to zero.
Definition: types.h:75
PointD(double x, double y)
Definition: types.h:80
Structure defining a point in two dimensions with floats representing the coordinates.
Definition: types.h:61
PointF()
Default constructor which sets all properties to zero.
Definition: types.h:63
PointF(float x, float y)
Definition: types.h:68
PointT()
Default constructor which sets all properties to zero.
Definition: types.h:48
t y
The y-coordinate of the point.
Definition: types.h:56
t x
The x-coordinate of the point.
Definition: types.h:55
PointT(t x, t y)
Definition: types.h:53
Structure defining an axis-aligned rectangle in two dimensions with doubles representing the coordina...
Definition: types.h:188
RectangleD(double x, double y, double w, double h)
Definition: types.h:197
Structure defining an axis-aligned rectangle in two dimensions with floats representing the coordinat...
Definition: types.h:174
RectangleF(float x, float y, float w, float h)
Definition: types.h:183
t w
The width of the rectangle.
Definition: types.h:155
RectangleT(t x, t y, t w, t h)
Definition: types.h:140
t y
The y-coordinate of the edge point of the rectangle.
Definition: types.h:154
t h
The height of the rectangle.
Definition: types.h:156
bool IsPointInside(const PointT< t > &p) const
Definition: types.h:161
t x
The x-coordinate of the edge point of the rectangle.
Definition: types.h:153
RectangleT()
Default constructor which sets all properties to zero.
Definition: types.h:132
Structure defining a vector in three dimensions with doubles representing the coordinates.
Definition: types.h:406
Vector3dD(double x, double y, double z)
Definition: types.h:413
Structure defining a vector in three dimensions with floats representing the coordinates.
Definition: types.h:394
Vector3dF(float x, float y, float z)
Definition: types.h:401
t AbsoluteValueSquared() const
Definition: types.h:356
t x
The component of the vector in x-direction.
Definition: types.h:342
t y
The component of the vector in y-direction.
Definition: types.h:343
t AbsoluteValue() const
Definition: types.h:363
static t Dot(const Vector3dT< t > &vectorA, const Vector3dT< t > &vectorB)
Definition: types.h:386
Vector3dT< t > Normalize() const
Definition: types.h:348
static Vector3dT< t > Cross(const Vector3dT< t > &vectorA, const Vector3dT< t > &vectorB)
Definition: types.h:372
t z
The component of the vector in z-direction.
Definition: types.h:344
Vector3dT()
Default constructor. All properties are set to zero.
Definition: types.h:330
Vector3dT(t x, t y, t z)
Definition: types.h:336
Vector3dT(const Point3dT< t > p)
Definition: types.h:340