On Thu, Dec 22, 2016 at 1:16 PM <[email protected]> wrote: > Hello, > > i am trying to find how much i need to add to a coordinate in order to get > to another coordinate using this equation > > coords1=(2,3,5) > coords2=(4,5,6) > > difference = -1*(coords1-coords2) > > I am trying to do this with the python api though, which is always mental. > I've done the bit in the brackets like this > > (om.MFloatPoint(2,3,5)-om.MFloatVector(4,5,6)) > > but i don't know how to multiply the result by negative 1. Can anyone show > me the api way? >
First, I am not sure why you don't just swap them around and do coords2-coords1, and be done with it? Why the need to scale by -1? om.MFloatPoint(4,5,6) - om.MFloatPoint(2,3,5) But that aside, if you really need to do it the way you have listed, the problem is that you are multiplying the wrong way around: difference = (coords1-coords2) * -1 When you do it starting with -1 you end up accessing the multiplication operators on the int instead of the MFloatPoint. It is the MFloatPoint that knows how to be multiplied by an int value. Justin > > > thanks, > Sam > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/c5976703-c764-452b-9e06-31c0a12f7631%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3C4-FD1tii%2B%3DBmxbj4xeW0oYfgGB8CyHdTicL%2BVZuh-Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
