MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / transform_position_tensor

Function transform_position_tensor

src/visualizer/gui_capabilities.cpp:102–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 }
101
102 void transform_position_tensor(core::Tensor& positions, const glm::mat4& transform) {
103 if (!is_float_nx3(positions))
104 return;
105
106 const auto point_count = static_cast<size_t>(positions.size(0));
107 const auto device = positions.device();
108 const auto transform_tensor =
109 core::Tensor::from_vector(matrix4_tensor_data(transform), core::TensorShape({4, 4}), device);
110 const auto ones = core::Tensor::ones({point_count, 1}, device);
111 const auto transformed = transform_tensor.mm(positions.cat(ones, 1).t()).t();
112 positions = transformed.slice(1, 0, 3).contiguous();
113 }
114
115 void transform_direction_tensor(core::Tensor& directions, const glm::mat3& transform) {
116 if (!is_float_nx3(directions))

Callers 2

bake_mesh_transformFunction · 0.85

Calls 11

is_float_nx3Function · 0.85
from_vectorFunction · 0.85
matrix4_tensor_dataFunction · 0.85
TensorShapeFunction · 0.50
sizeMethod · 0.45
deviceMethod · 0.45
tMethod · 0.45
mmMethod · 0.45
catMethod · 0.45
contiguousMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected