Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Normalizing a plane with norm = 1 changes its values #23

@jessestricker

Description

@jessestricker

Hi, i am using your library on Windows x64 with MSVC 2022.

When normalizing a plane which already has a eucl. norm of 1, its value changes.
The following test fails if I run it with your other tests in test/test_metric.cpp:

TEST_CASE("normalized-plane-normalization")
{
    point a{-0.5, 2, -0.5};
    point b{+0.5, 2, -0.5};
    point c{+0.5, 2, +0.5};

    // p is already normalized
    plane p = a & b & c;
    CHECK_EQ(p.norm(), 1);
    CHECK_EQ(p.e0(), -2);
    CHECK_EQ(p.e1(), 0);
    CHECK_EQ(p.e2(), 1);
    CHECK_EQ(p.e3(), 0);

    p.normalize();
    // same checks as before
    CHECK_EQ(p.norm(), 1);
    CHECK_EQ(p.e0(), -2);                 // <------- error here, expansion: -4.0f, -2
    CHECK_EQ(p.e1(), 0);
    CHECK_EQ(p.e2(), 1);
    CHECK_EQ(p.e3(), 0);
}

Using the debugger i found out that the value of p after the normalize() call is kln::point{p0_=(-4, 0, 1, 0)}.
Is this intended behaviour? (I am still learning PGA)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions