Skip to content

Commit c97cef5

Browse files
committed
Update rerun and simplify code
1 parent abcc22c commit c97cef5

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if(NOT DEFINED CMAKE_CXX_STANDARD)
99
endif()
1010

1111
include(FetchContent)
12-
FetchContent_Declare(rerun_sdk URL https://build.rerun.io/commit/a8bb2f1/rerun_cpp_sdk.zip) # 2023-10-20
12+
FetchContent_Declare(rerun_sdk URL https://build.rerun.io/commit/06dd483/rerun_cpp_sdk.zip) # 2023-10-20
1313
FetchContent_MakeAvailable(rerun_sdk)
1414

1515
find_package(Eigen3 REQUIRED)

src/main.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,12 @@ int main() {
7171
const Eigen::MatrixX3f points3d_matrix = Eigen::MatrixX3f::Random(num_points, 3);
7272
rec.log("world/points_from_matrix", rerun::Points3D(points3d_matrix));
7373

74-
// Posed pinhole camera
75-
float width = 640.0f;
76-
float height = 480.0f;
77-
Eigen::Matrix3f projection_matrix = Eigen::Matrix3f::Identity();
78-
projection_matrix(0, 0) = 500.0f;
79-
projection_matrix(1, 1) = 500.0f;
80-
projection_matrix(0, 2) = (width - 1) / 2.0;
81-
projection_matrix(1, 2) = (height - 1) / 2.0;
74+
// Posed pinhole camera:
8275
rec.log(
8376
"world/camera",
84-
rerun::Pinhole(rerun::components::PinholeProjection(
85-
*reinterpret_cast<float(*)[9]>(projection_matrix.data())
86-
))
87-
.with_resolution(rerun::components::Resolution({width, height}))
77+
rerun::Pinhole::focal_length_and_resolution({500.0, 500.0}, {640.0, 480.0})
8878
);
79+
8980
const Eigen::Vector3f camera_position{0.0, -1.0, 0.0};
9081
Eigen::Matrix3f camera_orientation;
9182
// clang-format off
@@ -97,9 +88,8 @@ int main() {
9788
rec.log(
9889
"world/camera",
9990
rerun::Transform3D(
100-
rerun::datatypes::Vec3D(*reinterpret_cast<const float(*)[3]>(camera_position.data())),
101-
rerun::datatypes::Mat3x3(*reinterpret_cast<const float(*)[9]>(camera_orientation.data())
102-
)
91+
rerun::datatypes::Vec3D(camera_position.data()),
92+
rerun::datatypes::Mat3x3(camera_orientation.data())
10393
)
10494
);
10595

0 commit comments

Comments
 (0)