MCPcopy Create free account
hub / github.com/SFML/SFML / computeDirection

Function computeDirection

src/SFML/Graphics/Shape.cpp:41–48  ·  view source on GitHub ↗

Compute the direction of a segment

Source from the content-addressed store, hash-verified

39{
40// Compute the direction of a segment
41sf::Vector2f computeDirection(sf::Vector2f p1, sf::Vector2f p2)
42{
43 sf::Vector2f direction = p2 - p1;
44 const float length = direction.length();
45 if (length != 0.f)
46 direction /= length;
47 return direction;
48}
49} // namespace
50
51

Callers 1

updateOutlineMethod · 0.85

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected