다음을 통해 공유


Vector3D.Z 속성

정의

Z 구조체의 Vector3D 구성 요소를 가져오거나 설정합니다.

public:
 property double Z { double get(); void set(double value); };
public double Z { get; set; }
member this.Z : double with get, set
Public Property Z As Double

속성 값

Double

Vector3D 구조체의 Z 구성 요소입니다. 기본값은 0입니다.

예제

다음 예제에서는 두 Vector3D 구조체의 점 곱을 계산하는 방법을 보여줍니다. 또한 구조체가 선언되고 구조체가 선언된 후 구조체에 값을 Vector3D 할당하는 방법도 보여 집니다.

    // Calculates the Dot Product of two Vectors.

    // Declaring vector1 and initializing x,y,z values
    Vector3D vector1 = new Vector3D(20, 30, 40);

    // Declaring vector2 without initializing x,y,z values
    Vector3D vector2 = new Vector3D();

    // A Double to hold the result of the operation
    Double dotProduct;

    // Assigning values to vector2
    vector2.X = 45;
    vector2.Y = 70;
    vector2.Z = 80;

    // Calculating the dot product of vector1 and vector2
    dotProduct = Vector3D.DotProduct(vector1, vector2);

    // vectorResult is equal to (6200)
' Calculates the Dot Product of two Vectors.

' Declaring vector1 and initializing x,y,z values
Dim vector1 As New Vector3D(20, 30, 40)

' Declaring vector2 without initializing x,y,z values
Dim vector2 As New Vector3D()

' A Double to hold the result of the operation
Dim dotProduct As Double

' Assigning values to vector2
vector2.X = 45
vector2.Y = 70
vector2.Z = 80

' Calculating the dot product of vector1 and vector2
dotProduct = Vector3D.DotProduct(vector1, vector2)

' vectorResult is equal to (6200)

적용 대상