MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / transform

Method transform

shared/UtilsMath.h:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 vec3 getSize() const { return vec3(max_[0] - min_[0], max_[1] - min_[1], max_[2] - min_[2]); }
39 vec3 getCenter() const { return 0.5f * vec3(max_[0] + min_[0], max_[1] + min_[1], max_[2] + min_[2]); }
40 void transform(const glm::mat4& t)
41 {
42 vec3 corners[] = {
43 vec3(min_.x, min_.y, min_.z),
44 vec3(min_.x, max_.y, min_.z),
45 vec3(min_.x, min_.y, max_.z),
46 vec3(min_.x, max_.y, max_.z),
47 vec3(max_.x, min_.y, min_.z),
48 vec3(max_.x, max_.y, min_.z),
49 vec3(max_.x, min_.y, max_.z),
50 vec3(max_.x, max_.y, max_.z),
51 };
52 for (auto& v : corners)
53 v = vec3(t * vec4(v, 1.0f));
54 *this = BoundingBox(corners, 8);
55 }
56 BoundingBox getTransformed(const glm::mat4& t) const
57 {
58 BoundingBox b = *this;

Callers 5

getTransformedMethod · 0.80
MyAppMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 1

BoundingBoxClass · 0.85

Tested by

no test coverage detected