-
-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more advanced math nodes #1383
Conversation
node-graph/gcore/src/ops.rs
Outdated
// Floor | ||
pub struct FloorParameterNode; | ||
|
||
#[node_macro::node_fn(FloorParameterNode)] | ||
fn floor(input: f32) -> f32 { | ||
input.floor() | ||
} | ||
|
||
// Ceil | ||
pub struct CeilParameterNode; | ||
|
||
#[node_macro::node_fn(CeilParameterNode)] | ||
fn ceil(input: f32) -> f32 { | ||
input.ceil() | ||
} | ||
|
||
// Round | ||
pub struct RoundParameterNode; | ||
|
||
#[node_macro::node_fn(RoundParameterNode)] | ||
fn round(input: f32) -> f32 { | ||
input.round() | ||
} | ||
|
||
// Absolute Value | ||
pub struct AbsoluteParameterNode; | ||
|
||
#[node_macro::node_fn(AbsoluteParameterNode)] | ||
fn abs(input: f32) -> f32 { | ||
input.abs() | ||
} | ||
|
||
// Log | ||
pub struct LogParameterNode<Second> { | ||
second: Second, | ||
} | ||
|
||
#[node_macro::node_fn(LogParameterNode)] | ||
fn ln<U: num_traits::float::Float>(first: U, second: U) -> U { | ||
first.log(second) | ||
} | ||
|
||
// Natural Log | ||
pub struct NaturalLogParameterNode; | ||
|
||
#[node_macro::node_fn(NaturalLogParameterNode)] | ||
fn ln(input: f32) -> f32 { | ||
input.ln() | ||
} | ||
|
||
// Sine | ||
pub struct SineParameterNode; | ||
|
||
#[node_macro::node_fn(SineParameterNode)] | ||
fn ln(input: f32) -> f32 { | ||
input.sin() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The I think none of these nodes should have Parameter in their name as they don't actually take a second argument. (With AddParameter, the parameter is added to the primary input, this is not the case here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that, I just copy-pasted without thinking. Should be fixed now
* Floor * Ceil * Round * Absolute Value * Logarithm * Natural Logarithm * sin * cos * tan
Added a few more mathematical operations as nodes. With this PR, all operations mentioned in #912 should be implemented + some other operations like rounding and the natural logarithm.
Operations Implemented by this PR: