MCPcopy Create free account
hub / github.com/danieljfarrell/pvtrace / point_to_node

Method point_to_node

pvtrace/scene/node.py:62–79  ·  view source on GitHub ↗

Convert local point into the the other node coordinate system. The `node` must be somewhere in the hierarchy tree. Parameters ---------- point : tuple of float Cartesian point `(x, y, z)` in the local coordinate system. node

(self, point: tuple, node: Node)

Source from the content-addressed store, hash-verified

60 return transform
61
62 def point_to_node(self, point: tuple, node: Node) -> tuple:
63 """ Convert local point into the the other node coordinate system.
64
65 The `node` must be somewhere in the hierarchy tree.
66
67 Parameters
68 ----------
69 point : tuple of float
70 Cartesian point `(x, y, z)` in the local coordinate system.
71 node : Node
72 Node in which the point should be represented.
73 """
74 mat = self.transformation_to(node)
75 homogeneous_pt = np.ones(4)
76 homogeneous_pt[0:3] = point
77 new_pt = np.dot(mat, homogeneous_pt)[0:3]
78 new_pt = tuple(new_pt)
79 return new_pt
80
81 def vector_to_node(self, vector: tuple, node: Node) -> tuple:
82 """ Convert local vector into the the other node coordinate system.

Callers 5

intersectionsMethod · 0.95
toMethod · 0.80
representationMethod · 0.80

Calls 1

transformation_toMethod · 0.95