Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

ValueErrorException: math domain error

$
0
0

@ivelin.peychev wrote:

Could anyone share a trick to avoid errors caused by python internal rounding?

import rhinoscriptsyntax as rs
import math
listX = []
for i in range(n):
    listX.append(((p2.X - p1.X)/(n-1))*i)
print(listX)

r = p2.X - p1.X
print(r)

pts = []
for k in range(n):
    pts.append(rs.AddPoint(round(listX[k],3),-round((math.sqrt(r**2 - (listX[k]-p1.X)**2)-p2.Y),3)))

GH.ArrangePointsInQuarterCircle.gh (6.5 KB)

Posts: 14

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles