File size: 2,111 Bytes
e0e88f3 |
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_ComfyUI_ModdedNodes.components.fields as field
from custom_nodes.Derfuu_ComfyUI_ModdedNodes.components.tree import TREE_TRIGONOMETRY
import math
class SinNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"value": field.FLOAT,
"type_": (["RAD", "DEG"],),
"arcSin": ([False, True],)
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "get_value"
CATEGORY = TREE_TRIGONOMETRY
def get_value(self, value, type_="RAD", arcSin=False):
if type_ == "DEG":
value = math.radians(value)
if arcSin == True:
value = math.asin(value)
else:
value = math.sin(value)
return (value,)
class CosNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"value": field.FLOAT,
"type_": (["RAD", "DEG"],),
"arcCos": ([False, True],)
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "get_value"
CATEGORY = TREE_TRIGONOMETRY
def get_value(self, value, type_="RAD", arcCos=False):
if type_ == "DEG":
value = math.radians(value)
if arcCos == True:
value = math.acos(value)
else:
value = math.cos(value)
return (value,)
class tgNode:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"value": field.FLOAT,
"type_": (["RAD", "DEG"],),
"arcTan": ([False, True],)
}
}
RETURN_TYPES = ("FLOAT",)
FUNCTION = "get_value"
CATEGORY = TREE_TRIGONOMETRY
def get_value(self, value, type_="RAD", arcTan=False):
if type_ == "DEG":
value = math.radians(value)
if arcTan == True:
value = math.atan(value)
else:
value = math.tan(value)
return (value,) |