Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

Point NR::unit_vector ( Point const &  a  ) 

Returns a version of a scaled to be a unit vector (within rounding error).

The current version tries to handle infinite coordinates gracefully, but it's not clear that any callers need that.

Precondition:
a != Point(0, 0).

Neither coordinate is NaN.

Postcondition:
L2(ret) very near 1.0.

Definition at line 48 of file nr-point-fns.cpp.

References NR::Point::normalize().

Referenced by fit_and_split(), and node_request().

{
    Point ret(a);
    ret.normalize();
    return ret;
}


Generated by  Doxygen 1.6.0   Back to index