Why does maya return a different value for cos(1) than 3ds Max? I was trying to make a circle shape and became confused about this topic.

Maya returns:

import math
p = math.cos(1.0)
print p
returns: 0.540302305868

3ds Max returns:

p = cos(1.0)
print p
returns: 0.999848

In 3ds Max this returns me a perfect circle. In maya I'm not sure what happens to it...Hopefully it's just something I'm overlooking that's causing this to result in an unexpected behavior.

import maya.cmds as cmds
import math

cmds.file(new=True, f=True)

radius = 10
sides = 8
ang = 360.0 / sides
pts = []


for i in range(0,sides):
    x = radius * math.cos(i * ang )
    y = 0
    z = radius * math.sin(i * ang)
    pt = (x, y, z)
    print i

    pts.append(pt)

cmds.curve(d=1, p=pts )
有帮助吗?

解决方案

cos in 3ds max probably expects degrees. while math.cos expect radians

In [66]: math.cos(1)
Out[66]: 0.5403023058681397

In [67]: math.cos(math.radians(1)) #Converting 1 degree to radians
Out[67]: 0.9998476951563913
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top