32#ifndef HERMES_GEOMETRY_TRANSFORM_H
33#define HERMES_GEOMETRY_TRANSFORM_H
35#include <hermes/geometry/bbox.h>
84Transform2 inverse(
const Transform2 &t);
135 r->
x = m[0][0] * x + m[0][1] * y + m[0][2];
136 r->
y = m[1][0] * x + m[1][1] * y + m[1][2];
137 real_t wp = m[2][0] * x + m[2][1] * y + m[2][2];
146 r->
x = m[0][0] * x + m[0][1] * y;
147 r->
y = m[1][0] * x + m[1][1] * y;
154 return vec2(m[0][0] * x + m[0][1] * y, m[1][0] * x + m[1][1] * y);
161 real_t xp = m[0][0] * x + m[0][1] * y + m[0][2];
162 real_t yp = m[1][0] * x + m[1][1] * y + m[1][2];
163 real_t wp = m[2][0] * x + m[2][1] * y + m[2][2];
265 const vec3 &up = {0, 1, 0},
386 ret = make_union(
ret,
M(
point3(b.upper.x, b.lower.y, b.lower.z)));
387 ret = make_union(
ret,
M(
point3(b.lower.x, b.upper.y, b.lower.z)));
388 ret = make_union(
ret,
M(
point3(b.lower.x, b.lower.y, b.upper.z)));
389 ret = make_union(
ret,
M(
point3(b.lower.x, b.upper.y, b.upper.z)));
390 ret = make_union(
ret,
M(
point3(b.upper.x, b.upper.y, b.lower.z)));
391 ret = make_union(
ret,
M(
point3(b.upper.x, b.lower.y, b.upper.z)));
392 ret = make_union(
ret,
M(
point3(b.lower.x, b.upper.y, b.upper.z)));
400 real_t xp =
m[0][0] * x +
m[0][1] * y +
m[0][2] * z +
m[0][3];
401 real_t yp =
m[1][0] * x +
m[1][1] * y +
m[1][2] * z +
m[1][3];
402 real_t zp =
m[2][0] * x +
m[2][1] * y +
m[2][2] * z +
m[2][3];
403 real_t wp =
m[3][0] * x +
m[3][1] * y +
m[3][2] * z +
m[3][3];
413 real_t xp =
m[0][0] * x +
m[0][1] * y +
m[0][2] * z +
m[0][3];
414 real_t yp =
m[1][0] * x +
m[1][1] * y +
m[1][2] * z +
m[1][3];
415 real_t zp =
m[2][0] * x +
m[2][1] * y +
m[2][2] * z +
m[2][3];
416 real_t wp =
m[3][0] * x +
m[3][1] * y +
m[3][2] * z +
m[3][3];
426 r->
x =
m[0][0] * x +
m[0][1] * y +
m[0][2] * z +
m[0][3];
427 r->
y =
m[1][0] * x +
m[1][1] * y +
m[1][2] * z +
m[1][3];
428 r->
z =
m[2][0] * x +
m[2][1] * y +
m[2][2] * z +
m[2][3];
429 real_t wp =
m[3][0] * x +
m[3][1] * y +
m[3][2] * z +
m[3][3];
438 return vec3(
m[0][0] * x +
m[0][1] * y +
m[0][2] * z,
439 m[1][0] * x +
m[1][1] * y +
m[1][2] * z,
440 m[2][0] * x +
m[2][1] * y +
m[2][2] * z);
465 (*this)(r.
o, &
ret->o);
521 r[0] =
m[0][0] * x +
m[0][1] * y +
m[0][2] * z +
m[0][3];
522 r[1] =
m[1][0] * x +
m[1][1] * y +
m[1][2] * z +
m[1][3];
524 r[2] =
m[2][0] * x +
m[2][1] * y +
m[2][2] * z +
m[2][3];
525 real_t wp =
m[3][0] * x +
m[3][1] * y +
m[3][2] * z +
m[3][3];
546 return mat3(
m[0][0],
m[0][1],
m[0][2],
m[1][0],
m[1][1],
547 m[1][2],
m[2][0],
m[2][1],
m[2][2]);
563 for (
int i = 0; i < 4; ++i)
564 for (
int j = 0; j < 4; ++j)
588 for (
int i = 0; i < 3; i++) {
589 for (
int j = 0; j < 3; j++)
590 os << m[i][j] <<
" ";
602 for (
int i = 0; i < 4; i++) {
603 for (
int j = 0; j < 4; j++)
604 os << m[i][j] <<
" ";
Support of bitwise operations for compatible enum classes.
#define HERMES_ENABLE_BITMASK_OPERATORS(x)
Adds bitwise operation support to a given enum class.
Definition bitmask_operators.h:58
static MemoryDumper::RegionLayout memoryDumpLayout()
Gets memory layout.
Definition math_element.h:56
HERMES_DEVICE_CALLABLE bool isIdentity() const
Definition matrix.h:285
T y
1-th component
Definition point.h:140
T x
0-th component
Definition point.h:139
T x
0-th component
Definition point.h:270
T y
1-th component
Definition point.h:271
T z
2-th component
Definition point.h:272
point3 o
ray's origin
Definition ray.h:94
T x
0-th component
Definition vector.h:155
T y
1-th component
Definition vector.h:156
T x
0-th component
Definition vector.h:415
T z
2-th component
Definition vector.h:417
T y
1-th component
Definition vector.h:416
Debug, logging and assertion macros.
float real_t
default floating point type
Definition defs.h:75
#define HERMES_DEVICE_CALLABLE
Specifies that the function can be called from both host and device sides.
Definition defs.h:45
uint32_t u32
32 bit size unsigned integer type
Definition defs.h:88
Geometric normal classes.
static HERMES_DEVICE_CALLABLE std::enable_if_t< std::is_floating_point< T >::value, bool > is_nan(T v)
Checks if number representation is nan
Definition numeric.h:884
Holds 2-dimensional integer index coordinates.
Definition index.h:50
Memory region description.
Definition memory_dump.h:97