File size: 2,119 Bytes
37d34c5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
import custom_nodes.Derfuu_Nodes.types as type
from custom_nodes.Derfuu_Nodes.tree import TREE_TRIGONOMETRY
import math
class SinNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"FLOAT": (type.FLOAT,),
"INPUT_TYPE": (["RAD", "DEG"],),
"arcSin": ([False, True],)
}
}
RETURN_TYPES = (type.FLOAT,)
FUNCTION = "get_value"
CATEGORY = TREE_TRIGONOMETRY
def get_value(self, FLOAT, INPUT_TYPE="RAD", arcSin=False):
if INPUT_TYPE == "DEG":
FLOAT = math.radians(FLOAT)
if arcSin == True:
FLOAT = math.asin(FLOAT)
else:
FLOAT = math.sin(FLOAT)
return (FLOAT,)
class CosNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"FLOAT": (type.FLOAT,),
"INPUT_TYPE": (["RAD", "DEG"],),
"arcCos": ([False, True],)
}
}
RETURN_TYPES = (type.FLOAT,)
FUNCTION = "get_value"
CATEGORY = TREE_TRIGONOMETRY
def get_value(self, FLOAT, INPUT_TYPE="RAD", arcCos=False):
if INPUT_TYPE == "DEG":
FLOAT = math.radians(FLOAT)
if arcCos == True:
FLOAT = math.acos(FLOAT)
else:
FLOAT = math.cos(FLOAT)
return (FLOAT,)
class tgNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"FLOAT": (type.FLOAT,),
"INPUT_TYPE": (["RAD", "DEG"],),
"arcTan": ([False, True],)
}
}
RETURN_TYPES = (type.FLOAT,)
FUNCTION = "get_value"
CATEGORY = TREE_TRIGONOMETRY
def get_value(self, FLOAT, INPUT_TYPE="RAD", arcTan=False):
if INPUT_TYPE == "DEG":
FLOAT = math.radians(FLOAT)
if arcTan == True:
FLOAT = math.atan(FLOAT)
else:
FLOAT = math.tan(FLOAT)
return (FLOAT,) |