言語

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、およびX値を持つY構造体にZ構造体を追加することと同じです。

Offset メソッドの呼び出しは、XY、およびZプロパティを直接変更できる場合にのみ有効です。 Point3Dは値型であるため、プロパティまたはインデクサーを使用してPoint3D オブジェクトを参照すると、オブジェクトへの参照ではなく、オブジェクトのコピーが取得されます。 プロパティまたはインデクサー参照の XY、または Z を変更しようとすると、コンパイラ エラーが発生します。 同様に、プロパティまたはインデクサーで Offset を呼び出すと、基になるオブジェクトは変更されません。 プロパティまたはインデクサーとして参照される Point3D の値を変更する場合は、新しい Point3Dを作成し、そのフィールドを変更してから、 Point3D をプロパティまたはインデクサーに割り当てます。

適用対象