Isotropix Forums

Math Operations

Clarisse Scripting related topics

Math Operations

Unread postby briansilva » Wed Oct 02, 2019 9:50 am

Hello! I'm trying to do some simple vector math in Python, and things aren't working quite like I'd expect them to.

python code

gmv1 = ix.api.GMathVec3f(5, 10, 15)
gmv2 = ix.api.GMathVec3f(100, 200, 300)

print gmv1
print gmv2
print gmv1 + 50.0 # works fine
# print gmv1 + gmv2 # throws TypeError: in method 'GMathVec3f___add__', argument 2 of type 'double'
# print gmv1.dot(gmv2) # throws AttributeError: 'GMathVec3f' object has no attribute 'dot'
# print gmv1.cross(gmv2) # throws AttributeError: 'GMathVec3f' object has no attribute 'cross'


Is there a different way to do these in Python, or do I just need to roll my own?
briansilva
 
Posts: 53
Joined: Mon Mar 25, 2019 12:43 pm

Re: Math Operations

Unread postby anemoff » Wed Oct 02, 2019 10:40 am

Hi there,

There seems to be a bug in the generation of the Python API. There are other functions missing too like sub, min, max, clamp, etc.
You'll have to write your own in the meantime.

You can check which ones are available by running this (those without __):

python code

for name in dir(ix.api.GMathVec3f):
print name


Could you please create a bug report ?
Sorry for the inconvenience!
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 306
Joined: Wed Jan 13, 2016 10:10 am

Re: Math Operations

Unread postby briansilva » Wed Oct 02, 2019 12:27 pm

That's alright, thanks for the verification! Bug submitted here:
https://www.isotropix.com/user/bugtracker/538
briansilva
 
Posts: 53
Joined: Mon Mar 25, 2019 12:43 pm

Re: Math Operations

Unread postby anemoff » Wed Oct 02, 2019 12:45 pm

Thanks!
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 306
Joined: Wed Jan 13, 2016 10:10 am


Return to Scripting
cron