Vector2
public struct Vector2A 2D vector of two floats. A pointer event from an interactivity zone hands logic one as a position in pixels from the top-left corner of the Circuit Designer viewport, and a shader vec2 uniform is read and written as one. The arithmetic lets logic derive drag deltas and angles (potentiometers, rotary encoders) from successive pointer positions.
Constructors
Section titled “Constructors”Vector2
Section titled “Vector2”public Vector2(float x, float y);Creates a vector from its X and Y components.
Properties you read and set
Section titled “Properties you read and set”public float X { get; set; }The horizontal component. On a pointer position it is pixels from the left edge of the viewport.
public float Y { get; set; }The vertical component. On a pointer position it is pixels from the top edge of the viewport, growing downward.
static
public static Vector2 Zero { get; }The vector (0, 0).
Methods you call
Section titled “Methods you call”Length
Section titled “Length”public float Length();Length (magnitude) of this vector, in the same units as its components.
DistanceTo
Section titled “DistanceTo”public float DistanceTo(Vector2 other);Distance from this position to other, in the same units as the components.
public float Angle();Angle of this vector from the +X axis, in radians (-π to π). On pointer positions, where Y grows downward, the angle increases clockwise on screen.
AngleTo
Section titled “AngleTo”public float AngleTo(Vector2 other);Signed angle in radians (-π to π) that turns this vector’s direction onto the direction of other. Both are taken as directions from (0, 0); on pointer positions a positive result is clockwise on screen.
Equals
Section titled “Equals”override
public override bool Equals(object obj);True when obj is a Vector2 with exactly equal components.
GetHashCode
Section titled “GetHashCode”override
public override int GetHashCode();A hash of the components, so the vector can key a dictionary or a set.
ToString
Section titled “ToString”override
public override string ToString();The vector as text, for example Vector2(3, 4).
Operators
Section titled “Operators”operator +
Section titled “operator +”static
public static Vector2 operator +(Vector2 a, Vector2 b);Adds two vectors component by component.
operator -
Section titled “operator -”static
public static Vector2 operator -(Vector2 a, Vector2 b);Subtracts b from a component by component. The difference of two pointer positions is the drag between them.
operator *
Section titled “operator *”static
public static Vector2 operator *(Vector2 a, float s);Multiplies every component of a by s.
static
public static Vector2 operator *(float s, Vector2 a);Multiplies every component of a by s.
operator /
Section titled “operator /”static
public static Vector2 operator /(Vector2 a, float s);Divides every component of a by s. Dividing by zero gives infinite or NaN components, not an error.
operator ==
Section titled “operator ==”static
public static bool operator ==(Vector2 a, Vector2 b);True when both components are exactly equal. Computed positions rarely match exactly, so compare DistanceTo against a small tolerance instead.
operator !=
Section titled “operator !=”static
public static bool operator !=(Vector2 a, Vector2 b);True when either component differs, compared exactly.
Generated from the CRUMB source, commit fcec660d, 2026-10-29.

