Specifies a position in 3D space, used for 3D geometry, cameras and 3D physics.
View code on GitHub
Namespace: DeltaEngine.DatatypesAssembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Vector3D type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | Vector3D(String) | Initializes a new instance of the Vector3D class |
![]() | Vector3D(Vector2D, Single) | Initializes a new instance of the Vector3D class |
![]() | Vector3D(Single, Single, Single) | Initializes a new instance of the Vector3D class |
Methods
Operators
Name | Description | |
---|---|---|
![]() ![]() | Addition | |
![]() ![]() | Division | |
![]() ![]() | Equality | |
![]() ![]() | (Vector2D to Vector3D) | |
![]() ![]() | Inequality | |
![]() ![]() | Multiply(Single, Vector3D) | |
![]() ![]() | Multiply(Vector3D, Vector3D) | |
![]() ![]() | Multiply(Vector3D, Single) | |
![]() ![]() | Subtraction | |
![]() ![]() | UnaryNegation |
Fields
Name | Description | |
---|---|---|
![]() ![]() | MinusOne | |
![]() ![]() | One | |
![]() ![]() | SizeInBytes | |
![]() ![]() | UnitX | |
![]() ![]() | UnitY | |
![]() ![]() | UnitZ | |
![]() ![]() | Zero |
Properties
Name | Description | |
---|---|---|
![]() | Length | |
![]() | LengthSquared | |
![]() | X | |
![]() | Y | |
![]() | Z |
Remarks
Examples
[Test] public void Create() { const float X = 3.51f; const float Y = 0.23f; const float Z = 0.95f; var v = new Vector3D(X, Y, Z); Assert.AreEqual(v.X, X); Assert.AreEqual(v.Y, Y); Assert.AreEqual(v.Z, Z); }
[Test] public void CreateFromVector2D() { var v = new Vector3D(new Vector2D(1, 2)); Assert.AreEqual(1, v.X); Assert.AreEqual(2, v.Y); Assert.AreEqual(0, v.Z); }
[Test] public void CreateFromString() { var v = new Vector3D("2.3, 1.5, 0.9"); Assert.AreEqual(v.X, 2.3f); Assert.AreEqual(v.Y, 1.5f); Assert.AreEqual(v.Z, 0.9f); Assert.Throws<Vector3D.InvalidNumberOfComponents>(() => new Vector3D("2.3")); Assert.Throws<FormatException>(() => new Vector3D("a, b, c")); }
See Also