Skip to content

Commit

Permalink
dealing with chatgpt's betrayal
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Feb 21, 2024
1 parent fd1fce4 commit 5735daf
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/re_types/src/archetypes/pinhole.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/code-examples/all/pinhole_perspective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_pinhole_perspective").spawn()?;

let fov = std::f32::consts::FRAC_PI_4;
let fov = 0.7853982;
let aspect_ratio = 1.7777778;
rec.log(
"world/cam",
Expand Down
2 changes: 1 addition & 1 deletion rerun_cpp/src/rerun/archetypes/pinhole.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rerun_cpp/src/rerun/archetypes/pinhole_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace rerun {
/// Assumes the principal point to be in the middle of the sensor.
static Pinhole from_fov_and_aspect_ratio(float fov_y, float aspect_ratio) {
const float EPSILON = std::numeric_limits<float>::epsilon();
const float focal_length_y = 0.5f / std::max(fov_y * 0.5f, EPSILON);
const float focal_length_y = 0.5f / std::tan(std::max(fov_y * 0.5f, EPSILON));
return from_focal_length_and_resolution(
{focal_length_y, focal_length_y},
{aspect_ratio, 1.0}
Expand Down
4 changes: 3 additions & 1 deletion rerun_py/rerun_sdk/rerun/archetypes/pinhole_ext.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import math
from typing import Any, cast

import numpy.typing as npt
Expand Down Expand Up @@ -84,6 +85,7 @@ def __init__(
Vertical field of view.
aspect_ratio
Aspect ratio.
"""

with catch_and_log_exceptions(context=self.__class__.__name__):
Expand All @@ -96,7 +98,7 @@ def __init__(
if image_from_camera is None:
if fov_y is not None and aspect_ratio is not None:
EPSILON = 1.19209e-07
focal_length = focal_length = 0.5 / max(fov_y * 0.5, EPSILON)
focal_length = focal_length = 0.5 / math.tan(max(fov_y * 0.5, EPSILON))
resolution = [aspect_ratio, 1.0]

if resolution is not None:
Expand Down

0 comments on commit 5735daf

Please sign in to comment.