Repository navigation
node vector math
< Previous: Math | Next: Compare >
Arithmetic on vectors, with the operation chosen on the node: Add, Subtract, Scale, Normalize, Dot and Cross.
Category: Data | Add menu: Data > Numbers > Vector Math
Note
This node used to be called Vector Add. It is the same node with more operations on it, so anything written about Vector Add applies here.
This is the one thing to get straight before the rest makes sense. Throughout Locus, a vector is a segment, a line that runs from its own start to its own end. A bare point is a location, not a displacement, so a point on its own does not say how far or which way.
The node will still take one. A point handed to a vector input is read as the displacement from Base to that point, which is the only reading available. A segment is read as start to end, and Base has nothing to do with it.
An unwired vector input counts as zero. That is what makes Add with a single vector wired read as "move this by that much", the behavior the old Vector Add had.
- Vector 1 (any): a segment, or a point read against Base.
- Vector 2 (any): the same. Ignored by Scale and Normalize, which use Vector 1 alone.
- Scalar (number, editable): the multiplier for Scale, default 2. The other operations ignore it.
- Base (point): where the result is drawn from, and what a bare point input is measured against. Default is the origin.
- Vector (curve): the result as a segment, running from Base to Base plus the result.
- Tip (point): the far end of that segment, on its own.
- Value (number): a number that depends on the operation, below.
Pick one from the pulldown on the node body, the same way Math works. The default is Add.
| Operation | Reads | What it gives back | Value carries |
|---|---|---|---|
| Add | Vector 1, Vector 2 | Vector 1 plus Vector 2 | the length of the result |
| Subtract | Vector 1, Vector 2 | Vector 1 minus Vector 2 | the length of the result |
| Scale | Vector 1, Scalar | Vector 1 times Scalar | the length of the result |
| Normalize | Vector 1 alone | Vector 1 at length 1, same direction | the length of the result, which is 1 |
| Dot | Vector 1, Vector 2 | nothing | the dot product |
| Cross | Vector 1, Vector 2 | nothing | the cross product |
The first four are vector answers, so Vector and Tip carry the result and Value comes along free, which saves reaching for Length.
Dot and Cross are number answers. There is no vector to draw, so Vector and Tip come back empty and Value is the whole result.
Two of them work on one vector. Scale and Normalize read Vector 1 alone and ignore Vector 2 entirely, so leaving it unwired changes nothing about what they give back. Scale is also the only operation that reads Scalar; the other five ignore it. Base is read by all six, because it is what a bare point input gets measured against, and it is where the four vector answers start from.
The same Vector 1 and Vector 2 run through all six, so the diagrams can be read against each other: only the interaction changes. Each one shows the inputs it reads at the top, then what the operation makes of them, drawn from Base.
Normalizing nothing gives nothing. A vector of zero length has no direction to preserve, so Normalize hands back zero rather than dividing by almost nothing and throwing the result off to infinity.
Cross is a signed number, and the sign is the useful part. In two dimensions the cross product is one number: the signed area of the parallelogram the two vectors make. It is positive when Vector 2 turns counterclockwise from Vector 1 and negative when it turns clockwise. That makes it the short answer to "which side of this is that", which is a question that comes up far more often than the area does.
< Previous: Math | Next: Compare >
- Math: the same idea for plain numbers.
- Move: the usual destination for the Vector output.
- Array: Directed: reads its direction inputs as vectors the same way this node does.
- Length: when the length is all you were after.
Found a bug or have feedback? Open an issue | Docs home | Videos | Credits
Getting Started
- Welcome
- How Locus came to be
- Videos
- Community & support
- Installing & launching
- Licensing & activation
- Beta License Agreement
- Core concepts
- Interface tour
- Your first pattern
Modeling - Drawing
- Canvas basics
- Points
- Typing coordinates
- Lines, rays & segments
- Circles & arcs
- Ellipses
- Compass & straightedge
- Rectangles & squares
- Constraining with Shift
Modeling - Editing
- Selecting objects
- Transform tools
- Align & distribute
- Duplicate, detach & ownership
- Regions & booleans
- Cleanup
- Weld & seams
- Style palettes & Re-ink
Annotation
Layers
Modeling Menus
- File
- Edit
- View
-
Draw
- Select
- Point
- Segment
- Line
- Ray
- Circle: Center Point
- Circle: Center Radius
- Circle: Through 3 Points
- Arc: Center, Start, End
- Straightedge
- Compass
- Compass: Radius
- Ellipse: Center + Axes
- Elliptical Arc
- Rectangle: XY-Aligned
- Rectangle: Directed
- Square
- Regular Polygon: Edge
- Regular Polygon: Center, Vertex
- Regular Polygon: Center, Edge Midpoint
- Dimension: Linear
- Dimension: Angle
- Dimension: Radial
- Label
- Construct
- Combine
- Transform
- Select
- Nodes
The Nodes Window
- Basics of visual programming
- How the node graph works
- Sockets & wires
- Adding & connecting nodes
- Sliders & number inputs
- Keeping the node graph tidy
- View menu (Nodes)
- Lists & collections
- Constants & unit conversions
Node Library
- Overview
- Input
-
Primitives
- Point
- Point: Polar
- Segment
- Line
- Ray
- Circle: Center Point
- Circle: Center Radius
- Circle: Apollonius
- Circle Tangent to...
- Circle: 3 Points
- Arc
- Ellipse
- Elliptical Arc
- Rectangle: XY-Aligned
- Rectangle: Directed
- Square
- Regular Polygon: Edge
- Regular Polygon: Center
- Rectangular Grid
- Oblique Grid
- Triangular Grid
- Construct
- Transform
- Image & Fields
- Combine
-
Data
- Measure
- Numbers
- Lists
- Select
- Clean up
- Display
Clusters
Bridging Modeling & Nodes
Patterns & Symmetry
Image-Driven Fields
Saving, Exporting & Files
Preferences & Language
CLI
Reference






