MCPcopy Create free account
hub / github.com/BIMCoderLiang/LNLib / PointToRay

Method PointToRay

src/LNLib/Algorithm/Projection.cpp:15–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include "MathUtils.h"
14
15LNLib::XYZ LNLib::Projection::PointToRay(const XYZ& origin, const XYZ& vector, const XYZ& point)
16{
17 XYZ diff = point - origin;
18 double dot = diff.DotProduct(vector);
19 double lenSqr = vector.DotProduct(vector);
20
21 double t = dot / lenSqr;
22 return origin + t * vector;
23}
24
25bool LNLib::Projection::PointToLine(const XYZ& start, const XYZ& end, const XYZ& point, XYZ& projectPoint)
26{

Callers

nothing calls this directly

Calls 1

DotProductMethod · 0.45

Tested by

no test coverage detected