Skip to content

Convert parabola args to from cx to fx.#70

Merged
jmaack24 merged 3 commits intojm-dev-branchfrom
parabola_args_bug
Oct 1, 2025
Merged

Convert parabola args to from cx to fx.#70
jmaack24 merged 3 commits intojm-dev-branchfrom
parabola_args_bug

Conversation

@taylorbrown75
Copy link
Copy Markdown
Collaborator

Legacy soltrace uses cx and cy for parabola arguments. The new structure uses focal lengths x and y.
Modified conversion step. Modified test time for NativeRunner LargePerformanceTest.

@taylorbrown75 taylorbrown75 self-assigned this Oct 1, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR converts parabola surface parameters from legacy "cx, cy" format to the new "fx, fy" focal length format. The conversion applies the formula fx = 1/(2cx) and fy = 1/(2cy) to transform between the two parameter systems.

  • Implemented parameter conversion for parabola surfaces from cx/cy to fx/fy format
  • Extended performance test timeout to accommodate the changes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
coretrace/simulation_data/surface.cpp Added conversion logic from cx/cy to fx/fy parameters for parabola surfaces
google-tests/regression-tests/native_runner_performance_test.cpp Increased performance test timeout from 16 to 40 seconds

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +32 to +34
double fx = 1.0 / (2.0 * cx);
double fy = 1.0 / (2.0 * cy);
retval = make_surface<Parabola>(fx, fy);
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Division by zero will occur if cx or cy is zero. Add validation to check that cx and cy are non-zero before performing the conversion.

Suggested change
double fx = 1.0 / (2.0 * cx);
double fy = 1.0 / (2.0 * cy);
retval = make_surface<Parabola>(fx, fy);
if (cx == 0.0 || cy == 0.0)
retval = nullptr;
else {
double fx = 1.0 / (2.0 * cx);
double fy = 1.0 / (2.0 * cy);
retval = make_surface<Parabola>(fx, fy);
}

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct place to do this is probably to check for finite values in the Parabola constructor. That can be done later. Many of the surfaces and apertures also need similar checks.


std::chrono::duration<double, std::milli> dur = t1 - t0;
EXPECT_TRUE(dur.count() < 16000.0);
EXPECT_TRUE(dur.count() < 40000.0);
Copy link
Copy Markdown
Member

@jmaack24 jmaack24 Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does this take to run on your machine? It passes regularly on GitHub runners and my laptop with the smaller value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted this change (I was previously using debug 😕)

Copy link
Copy Markdown
Member

@jmaack24 jmaack24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taylorbrown75
Copy link
Copy Markdown
Collaborator Author

Copy link
Copy Markdown
Collaborator Author

@taylorbrown75 taylorbrown75 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated unit test results and reverted time.

@jmaack24
Copy link
Copy Markdown
Member

jmaack24 commented Oct 1, 2025

Good work and nice catch!

@jmaack24 jmaack24 merged commit bdfad1e into jm-dev-branch Oct 1, 2025
@taylorbrown75 taylorbrown75 deleted the parabola_args_bug branch May 7, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants