Skip to content

Add Vector.Direction node for cardinal direction conversion#83

Merged
johnpierson merged 4 commits intomasterfrom
copilot/add-vector-direction-node
Jan 12, 2026
Merged

Add Vector.Direction node for cardinal direction conversion#83
johnpierson merged 4 commits intomasterfrom
copilot/add-vector-direction-node

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

Implements a Vector.Direction node that converts Dynamo vectors to cardinal directions (N, S, E, W, NE, NW, SE, SW), paralleling the existing Walls.Direction functionality for general-purpose vectors.

Implementation

  • Location: src/RhythmCore/Geometry/Vector.cs
  • Algorithm: Calculates angles to cardinal directions via dot product, applies same thresholds as Walls.Direction (π/4 primary, π/3 intercardinal)
  • Edge cases: Returns empty string for zero/near-zero magnitude vectors
  • Performance: Static readonly cardinal vectors, pre-calculated magnitudes, single magnitude computation per call

Usage

var direction = Rhythm.Geometry.Vector.Direction(myVector);
// Returns: "N", "NE", "E", "SE", "S", "SW", "W", "NW", or ""

Technical Notes

  • Uses SystemMath alias to avoid namespace collision with Rhythm.System
  • Node categorized under "Query" with search tags: vector, direction, cardinal, NSEW
Original prompt

This section details on the original issue you should resolve

<issue_title>Vector.Direction</issue_title>
<issue_description>What is the problem that needs solving?
Node to turn a vector into cardinal direction, NSEW etc.

How would you like to see it solved?
New node based on walls.direction logic

Describe alternatives you've considered
I've done this before with OOTB nodes.

Additional context
image
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 12, 2026 21:15
Co-authored-by: johnpierson <15744724+johnpierson@users.noreply.github.com>
Co-authored-by: johnpierson <15744724+johnpierson@users.noreply.github.com>
…ields and validation

Co-authored-by: johnpierson <15744724+johnpierson@users.noreply.github.com>
@johnpierson johnpierson marked this pull request as ready for review January 12, 2026 21:21
Copilot AI changed the title [WIP] Add node to convert vector to cardinal direction Add Vector.Direction node for cardinal direction conversion Jan 12, 2026
Copilot AI requested a review from johnpierson January 12, 2026 21:22
@johnpierson johnpierson merged commit 24e78d0 into master Jan 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector.Direction

2 participants