MCPcopy Index your code
hub / github.com/MapServer/MapServer / point_norm

Function point_norm

maputil.c:1654–1675  ·  view source on GitHub ↗

vector normal */

Source from the content-addressed store, hash-verified

1652
1653/* vector normal */
1654static pointObj point_norm(const pointObj a) {
1655 double lenmul;
1656 pointObj retv;
1657
1658#ifdef USE_POINT_Z_M
1659 if (a.x==0 && a.y==0 && a.z==0 && a.m==0)
1660#else
1661 if (a.x==0 && a.y==0)
1662#endif
1663 return a;
1664
1665 lenmul=1.0/sqrt(point_abs2(a)); /* this seems to be the costly operation */
1666
1667 retv.x = a.x*lenmul;
1668 retv.y = a.y*lenmul;
1669#ifdef USE_POINT_Z_M
1670 retv.z = a.z*lenmul;
1671 retv.m = a.m*lenmul;
1672#endif
1673
1674 return retv;
1675}
1676
1677/* rotate a vector 90 degrees */
1678static pointObj point_rotz90(const pointObj a) {

Callers 1

msOffsetPolylineFunction · 0.85

Calls 1

point_abs2Function · 0.85

Tested by

no test coverage detected