Logo Search packages:      
Sourcecode: inkscape version File versions

Point Geom::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 121 of file point.cpp.

References Geom::Point::normalize(), and unit_vector().

Referenced by darray_left_tangent(), darray_right_tangent(), fit_and_split(), generate_bezier(), node_request(), unclump_pull(), unclump_push(), unit_vector(), and unitVector().

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


Generated by  Doxygen 1.6.0   Back to index