MCPcopy Create free account
hub / github.com/pyscript/pyscript / V3

Class V3

core/tests/manual/issue-2302/perlin_py.py:5–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3from multipyjs import new
4
5class V3:
6 def __init__(self, x, y, z):
7 self.x = x
8 self.y = y
9 self.z = z
10
11 def __repr__(self):
12 return f"V3({self.x}, {self.y}, {self.z})"
13
14 def dot2(self, x, y):
15 return self.x * x + self.y * y
16
17 def dot3(self, x, y, z):
18 return self.x * x + self.y * y + self.z * z
19
20 def to_js(self, scale=1.0):
21 return new(THREE.Vector3, self.x * scale, self.y * scale, self.z * scale)
22
23PERM = [0] * 512
24V3_P = [0] * 512 # assigned V3s in seed()

Callers 2

perlin_py.pyFile · 0.85
curl2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected