I've got 3 math operation functions I need to use on a point3 value. I was wondering if someone could shed any light on a way to better write these functions in a more clean and condensed fashion please.
Thank you.
ptA = [10.0, 20.0, 30]
ptB = [50, 50 ,50]
percent = .50
def addPoint3(ptA,ptB):
idA = ptA[0] + ptB[0]
idB = ptA[1] + ptB[1]
idC = ptA[2] + ptB[2]
return [idA,idB,idC]
def subtractPoint3(ptA,ptB):
idA = ptA[0] - ptB[0]
idB = ptA[1] - ptB[1]
idC = ptA[2] - ptB[2]
return [idA,idB,idC]
def percentagePoint3(ptA,percentage):
idA = ptA[0] * percentage
idB = ptA[1] * percentage
idC = ptA[2] * percentage
return [idA,idB,idC]
add = addPoint3(ptA,ptB)
sub = subtractPoint3(ptA,ptB)
per = percentagePoint3(ptA,percent)
print add,sub,per