Skip to content

Vector normalization function #4

@rafaelgisbert

Description

@rafaelgisbert

Hi, the following function:

static Vec2 norm(Vec2 const & v)
{
if(length(v) < 1e-30)
return {0.0f, 0.0f};
}

doesn't return a vector when length(v) >= 1e-30. I suggest adding the following return statement:

static Vec2 norm(Vec2 const & v)
{
if(length(v) < 1e-30)
return {0.0f, 0.0f};

    return v / length(v);
}

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