MCPcopy
hub / github.com/opengeos/segment-geospatial / cos

Method cos

samgeo/fer.py:57–65  ·  view source on GitHub ↗
(self, v)

Source from the content-addressed store, hash-verified

55 return math.sqrt(math.pow(self.x, 2) + math.pow(self.y, 2))
56
57 def cos(self, v):
58 dot = self.x * v.x + self.y * v.y
59 cos = dot / (math.sqrt(math.pow(self.x, 2) + math.pow(self.y, 2)) * v.length())
60
61 if cos > 1:
62 cos = 1
63 if cos < -1:
64 cos = -1
65 return 180 / math.pi * math.acos(cos)
66
67 def k(self):
68 k = (self.y2 - self.y1) / (self.x2 - self.x1)

Callers 7

VListDiretFunction · 0.95
_star_ptsMethod · 0.80
CreateCircleFunction · 0.80
SmoothFunction · 0.80
DomainFunction · 0.80
FeatureLineFunction · 0.80
deg2numFunction · 0.80

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected