candlewick
0.1.0
A renderer
Loading...
Searching...
No Matches
Collision.h
Go to the documentation of this file.
1
#pragma once
2
#include "
math_types.h
"
3
#include <coal/BV/AABB.h>
4
#include <coal/BV/OBB.h>
5
6
namespace
candlewick
{
7
8
using
coal::AABB;
9
using
coal::OBB;
10
11
inline
Mat4f
toTransformationMatrix
(
const
AABB &aabb) {
12
Mat4f
T = Mat4f::Identity();
13
Float3
halfExtents = 0.5f * (aabb.max_ - aabb.min_).cast<float>();
14
T.block<3, 3>(0, 0) = halfExtents.asDiagonal();
15
T.topRightCorner<3, 1>() = aabb.center().cast<
float
>();
16
return
T;
17
}
18
19
inline
Mat4f
toTransformationMatrix
(
const
OBB &obb) {
20
Mat4f
T = Mat4f::Identity();
21
auto
D = obb.extent.asDiagonal();
22
T.block<3, 3>(0, 0) = (obb.axes * D).cast<
float
>();
23
T.topRightCorner<3, 1>() = obb.center().cast<
float
>();
24
return
T;
25
}
26
27
}
// namespace candlewick
math_types.h
candlewick
Definition
Camera.h:8
candlewick::Float3
Eigen::Vector3f Float3
Definition
math_types.h:8
candlewick::toTransformationMatrix
Mat4f toTransformationMatrix(const AABB &aabb)
Definition
Collision.h:11
candlewick::Mat4f
Eigen::Matrix4f Mat4f
Definition
math_types.h:11
src
candlewick
core
Collision.h
Generated by
1.13.2