MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / IsPerpendicular

Function IsPerpendicular

math/geometry/straightlines.go:47–49  ·  view source on GitHub ↗

IsPerpendicular checks if two lines are perpendicular or not.

(l1, l2 *Line)

Source from the content-addressed store, hash-verified

45
46// IsPerpendicular checks if two lines are perpendicular or not.
47func IsPerpendicular(l1, l2 *Line) bool {
48 return Slope(l1)*Slope(l2) == -1
49}
50
51// PointDistance calculates the distance of a given Point from a given line.
52// The slice should contain the coefficiet of x, the coefficient of y and the constant in the respective order.

Callers 1

TestIsPerpendicularFunction · 0.85

Calls 1

SlopeFunction · 0.85

Tested by 1

TestIsPerpendicularFunction · 0.68