Point3D.Offset(Double, Double, Double) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將 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)
參數
範例
以下範例展示了如何偏移結構 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對應X的 、 Y、 Z 及 值。
請注意,呼叫該 Offset 方法只有在你能直接改變 X、 Y和 Z 屬性時才會有影響。 因為 Point3D 是值型別,如果你用屬性或索引器來參考 Point3D 物件,你會得到物件的副本,而不是物件的參考。 如果你嘗試更改XYZ屬性或索引器引用,編譯器就會出錯。 同樣地,呼叫 Offset 屬性或索引器也不會改變底層物件。 如果你想更改被參考為屬性或索引器的值 Point3D ,請建立一個新的 Point3D,修改其欄位,然後將 back 指派 Point3D 給屬性或索引器。