-
import traceback
from pyrx_imp import Ge
def PyRxCmd_matrix():
try:
m = Ge.Matrix2d.translation(Ge.Vector2d(100.0, 50.0))
v = Ge.Vector2d(1.0, 2.0)
v2 = v.transformBy(m)
print(v2) # (1.00000000000000,2.00000000000000)
except Exception:
traceback.print_exc() I think it should be |
Beta Was this translation helpful? Give feedback.
Answered by
CEXT-Dan
Jul 30, 2024
Replies: 1 comment
-
Vectors don’t have a position, only a direction and magnitude(scale) from pyrx_imp import Ap, Db, Ed, Ge, Gi, Gs, Rx
def transformBy(m):
v = Ge.Vector2d.kXAxis
p = Ge.Point2d(1.0, 1.0)
v.transformBy(m)
p.transformBy(m)
print(v)
print(p)
print("\n....")
def PyRxCmd_doit():
try:
#position
transformBy(Ge.Matrix2d.translation(Ge.Vector2d(100.0, 50.0)))
#rotation
transformBy(Ge.Matrix2d.rotation(0.785398,Ge.Point2d(1.0, 1.0)))
#scale
transformBy(Ge.Matrix2d.scaling(2,Ge.Point2d(1.0, 1.0)))
#rotation around the origin
transformBy(Ge.Matrix2d.rotation(0.785398,Ge.Point2d.kOrigin))
#scale from the orgin
transformBy(Ge.Matrix2d.scaling(2,Ge.Point2d.kOrigin))
except Exception as err:
print(err) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gswifort
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vectors don’t have a position, only a direction and magnitude(scale)
This sample should illustrate the behavior