Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions node-graph/nodes/math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,11 +823,10 @@ fn dot_product(

/// Calculates the angle swept between two vectors.
///
/// The value is always positive and ranges from 0° (both vectors point the same direction) to 180° (both vectors point opposite directions).
/// The value ranges from -180° to +180° (or -π to +π radians). Positive values indicate an anticlockwise rotation from A to B, while negative values indicate a clockwise rotation.
#[node_macro::node(category("Math: Vector"))]
fn angle_between(_: impl Ctx, vector_a: DVec2, vector_b: DVec2, radians: bool) -> f64 {
let dot_product = vector_a.normalize_or_zero().dot(vector_b.normalize_or_zero());
let angle = dot_product.acos();
let angle = vector_a.angle_to(vector_b);
if radians { angle } else { angle.to_degrees() }
}

Expand Down
Loading