MCPcopy Create free account
hub / github.com/comaps/comaps / PointAtSegment

Function PointAtSegment

libs/geometry/point2d.hpp:255–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253/// or equal zero it returns p1.
254template <typename T>
255Point<T> PointAtSegment(Point<T> const & p1, Point<T> const & p2, T shiftFromP1)
256{
257 Point<T> p12 = p2 - p1;
258 shiftFromP1 = math::Clamp(shiftFromP1, static_cast<T>(0.0), static_cast<T>(p12.Length()));
259 return p1 + p12.Normalize() * shiftFromP1;
260}
261
262template <class TArchive, class PointT>
263TArchive & operator>>(TArchive & ar, Point<PointT> & pt)

Callers 4

FindPathMethod · 0.85
GetReverseBearingMethod · 0.85
PointAtSegmentMFunction · 0.85
UNIT_TESTFunction · 0.85

Calls 3

ClampFunction · 0.85
LengthMethod · 0.45
NormalizeMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68