# 3D Mathematics
DWScript includes high-performance types for 3D calculations, specifically optimized for graphics and physics applications.
## Vectors
The `TVector` type is a 4-component (X, Y, Z, W) record with overloaded operators, allowing you to perform vector math naturally.
```pascal
var v1 := Vector(1, 0, 0); // X-axis
var v2 := Vector(0, 1, 0); // Y-axis
// Vector Addition
var v3 := v1 + v2;
// Dot Product (Scalar result)
var dot := v1 * v2;
// Cross Product (Vector result)
var cross := v1 ^ v2;
// Normalization
var n := VectorNormalize(v1);
// Conversion to string
PrintLn(VectorToStr(v3));
// OUTPUT
// [1.00 1.00 0.00 0.00]
```
## Available Functions
The `TVector` type supports the following operations:
* **`Vector(x, y, z, w=0)`**: Creates a new vector.
* **`VectorToStr(v)`**: Returns a formatted string representation.
* **`VectorNormalize(v)`**: Returns a unit vector in the same direction.
* **`VectorDotProduct(v1, v2)`**: Alternative to `*` operator.
* **`VectorCrossProduct(v1, v2)`**: Alternative to `^` operator.
* **`VectorAdd(v1, v2)`**, **`VectorSub(v1, v2)`**: Alternatives to `+` and `-`.
:::info
### Related Reference
For a complete list of 3D math operations and the reference documentation:
* **[3D Math API Reference](/ref/math3d)**
:::
3D Mathematics
DWScript includes high-performance types for 3D calculations, specifically optimized for graphics and physics applications.
Vectors
The TVector type is a 4-component (X, Y, Z, W) record with overloaded operators, allowing you to perform vector math naturally.