Point3D.Offset(Double, Double, Double) 方法

定義

根據指定的數量轉譯 Point3D 結構。

public:
 void Offset(double offsetX, double offsetY, double offsetZ);
public void Offset (double offsetX, double offsetY, double offsetZ);
member this.Offset : double * double * double -> unit
Public Sub Offset (offsetX As Double, offsetY As Double, offsetZ As Double)

參數

offsetX
Double

這個 X 結構之 Point3D 座標的變更量。

offsetY
Double

這個 Y 結構之 Point3D 座標的變更量。

offsetZ
Double

這個 Z 結構之 Point3D 座標的變更量。

範例

下列範例示範如何位移 Point3D 結構。

// Offsets the X, Y and Z values of a Point3D.

Point3D point1 = new Point3D(10, 5, 1);

point1.Offset(20, 30, 40);
// point1 is equal to (30, 35, 41)

// Note: This operation is equivalent to adding a point 
// to vector with the corresponding X,Y, Z values.

// Displaying Results
syntaxString = "point1.Offset(20, 30, 40);";
resultType = "Point3D";
operationString = "Offsetting a Point3D";
ShowResults(point1.ToString(), syntaxString, resultType, operationString);
' Offsets the X, Y and Z values of a Point3D.

Dim point1 As New Point3D(10, 5, 1)

point1.Offset(20, 30, 40)
' point1 is equal to (30, 35, 41)

' Note: This operation is equivalent to adding a point 
' to vector with the corresponding X,Y, Z values.

' Displaying Results
syntaxString = "point1.Offset(20, 30, 40)"
resultType = "Point3D"
operationString = "Offsetting a Point3D"
ShowResults(point1.ToString(), syntaxString, resultType, operationString)

備註

這項作業相當於將 結構加入 Vector3DPoint3D 具有對應 XYZ 值的 結構。

請注意,如果您可以直接變更 、 YZ 屬性, X 則呼叫 Offset 方法才會有作用。 因為 Point3D 是實值型別,如果您使用屬性或索引子參考 Point3D 物件,您會收到物件的複本,而不是物件的參考。 如果您嘗試變更 XYZ 屬性或索引子參考,就會發生編譯器錯誤。 同樣地,在屬性或索引子上呼叫 Offset 並不會變更基礎物件。 如果您想要變更參考為屬性或索引子之 Point3D 的值,請建立新的 Point3D 、修改其欄位,然後將 指派 Point3D 回屬性或索引子。

適用於