Sunday, January 11, 2026

Vector Tools

Desmos Geometry Tool (DGT) natively supports 2 point vector definition, but polar vector capability must be implemented by writing two essential functions. These polar vector notation functions are included in most of my published Desmos solutions, including this Analog Vector Clock

Vpolar

Function Vpolar is the workhorse of VTools. While DGC's native vector(p1p2) function defines a vector using the start and end points as arguments, Vpolar(p1, m, θ) utilizes 3 arguments: start point, signed magnitude and absolute direction. Conveniently, the Vpolar object assigns the calculated vector as a 2 point list, identical to the native vector function!

Usage: Let 
v1 represent an arbitrary vector, so:

v1 = Vpolar((0,0), 1, 2.258)

This draws the unit vector starting at (0,0), with a magnitude of 1, at an angle of 2.258 rad as shown in the image below.  Vector v1 is now defined as a 2 point list, and can be queried for v1.start & v1.end points as required.   

Further, the (x, y) values for each vector point may also be extracted, e.g. v1.start.x, v1.end.y, etc.





Vp2


Functionality of Vpolar is enabled by the contribution of helper function Vp2 , the purpose of which is to calculate the value of the vector's 2nd point, using the same three arguments passed from Vpolar(p1, m, θ) -- i.e. start point, signed magnitude and absolute direction.





No comments:

Post a Comment

Analog Vector Clock

A  simple analog clock  may be simulated using just three Desmos Geometry Tool (DGT) elements and a pair of user‑defined polar vector funct...