Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PolygonClipping: CLIPLINE produces NaN when line to clip is parallel to the maxX of the clip window #10656

Closed
1 of 3 tasks
jmarrec opened this issue Aug 12, 2024 · 0 comments · Fixed by #10657
Closed
1 of 3 tasks
Assignees
Labels
Defect Includes code to repair a defect in EnergyPlus LowComplexityApproved Used for subcontractor defect complexity requests

Comments

@jmarrec
Copy link
Contributor

jmarrec commented Aug 12, 2024

Issue overview

Here is an example:

    Real64 const minX = 2.0;
    Real64 const maxX = 8.0;
    Real64 const minY = 3.0;
    Real64 const maxY = 6.0;

    Real64 x0 = maxX;
    Real64 x1 = maxX;
    Real64 y0 = 4.5;
    Real64 y1 = 1.0;
    bool visible = false;
    bool rev = false;

    EXPECT_NO_THROW(CLIPLINE(x0, x1, y0, y1, maxX, minX, maxY, minY, visible, rev));

    // y1 is NaN now

Graphically, this looks like this:

image

Because dx is 0, This is a divide by zero on that line:

y2 = minY + e / dx;

Details

Some additional details for this issue (if relevant):

Checklist

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Defect file added (list location of defect file here)
  • Ticket added to EnergyPlus Defect Complexity (Github Project)
  • Pull request created (the pull request will have additional tasks related to reviewing changes that fix this defect)
@jmarrec jmarrec added the Defect Includes code to repair a defect in EnergyPlus label Aug 12, 2024
@jmarrec jmarrec self-assigned this Aug 12, 2024
jmarrec added a commit to jmarrec/CppBenchmarks that referenced this issue Aug 12, 2024
Myoldmopar added a commit that referenced this issue Aug 14, 2024
Fix #10656 - PolygonClipping: CLIPLINE produces NaN when line to clip is parallel to the maxX of the clip window
@Myoldmopar Myoldmopar added the LowComplexityApproved Used for subcontractor defect complexity requests label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus LowComplexityApproved Used for subcontractor defect complexity requests
Projects
None yet
2 participants