Some code for handling coordinates and vectors in VB.Net. Coded in v2003. You need to import System.Math for the code to work.
Last updates: 21 April 2006
Current contents:
Coordinate Systems: Cartesian, Spherical Polar and Cylindrical Polar. Each can be defined with offsets and rotations relative to the global cartesian coordinate system.
Coordinate Transforms: From one local type to another, from any defined system to any other defined system, cartesian rotations (global and local).
The above code does the following:
-Creates a new cartesian coordinate system located at (10,10,0) with respect to the global, but with parallel axes.
-Generates three new coordinates within this system, (0,0,0), (1,0,0) and (0,1,0).
-Defines two new vectors within the system, one running along the x-axis and one along the y-axis.
-Defines a new vector by subtracting the y-axis vector from the x-axis vector. The new vector runs from (0,0,0) to (1,-1,0).
-Returns the endpoint of the new vector.
The picture illustrates how the offset and rotation properties are used: offsets are cartesian with respect to a global system centred at (0,0,0). The Theta rotation direction rotates the x axis onto the y axis, the Phi direction rotates the x axis onto the z axis and the Psi rotation angle rotates the y axis onto the z axis.
The same applies to the theta and phi coordinates in spherical and cylindrical polar coordinates.
There will be further additions to this code as necessary.