Files
Derfuu-Derfuu_ComfyUI_Modde…/Nodes/Math/Trigonometry.py
T
Derfuu cc43376402 Updated to last ComfyUI version (on 26.03.23) to use conversion between fields and connection points
- Fixed types issues
- Added:
 - Int2Tuple node
- Deleted due to last ComfyUI update which made them nearly useless now:
 - ConditioningSetAreaEXT (modded)
 - EmptyLatentImage (modded)
- NOT Deleted, but now might be useless (IMHO):
 - LatentComposite (modded)
 - ConditioningSetArea (modded)
- TUPLES moved to their own subfolder in UI
- ALL custom nodes with FLOAT, INT, STRING values now can use their own fields as inputs (use original conversion to points to connect)
- Refactored nearly all code... again
2023-03-26 20:20:41 +03:00

87 lines
2.1 KiB
Python

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": {
"FLOAT": field.FLOAT,
"INPUT_TYPE": (["RAD", "DEG"],),
"arcSin": ([False, True],)
}
}
RETURN_TYPES = ("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": field.FLOAT,
"INPUT_TYPE": (["RAD", "DEG"],),
"arcCos": ([False, True],)
}
}
RETURN_TYPES = ("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": field.FLOAT,
"INPUT_TYPE": (["RAD", "DEG"],),
"arcTan": ([False, True],)
}
}
RETURN_TYPES = ("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,)