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

定义

Point4D 结构平移指定量。Translates the Point4D structure by the specified amounts.

public:
 void Offset(double deltaX, double deltaY, double deltaZ, double deltaW);
public void Offset (double deltaX, double deltaY, double deltaZ, double deltaW);
member this.Offset : double * double * double * double -> unit
Public Sub Offset (deltaX As Double, deltaY As Double, deltaZ As Double, deltaW As Double)

参数

deltaX
Double

X 结构的 Point4D 坐标的偏移量。The amount to offset the X coordinate of this Point4D structure.

deltaY
Double

Y 结构的 Point4D 坐标的偏移量。The amount to offset the Y coordinate of this Point4D structure.

deltaZ
Double

Z 结构的 Point4D 坐标的偏移量。The amount to offset the Z coordinate of this Point4D structure.

deltaW
Double

W 结构的 Point4D 坐标的偏移量。The amount to offset the W coordinate of this Point4D structure.

示例

下面的示例演示如何偏移 Point4D 结构。The following example shows how to offset a Point4D structure.

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

Point4D point1 = new Point4D(10, 5, 1, 4);

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

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

Dim point1 As New Point4D(10, 5, 1, 4)

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

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

注解

请注意, Offset 仅当可以 W 直接更改、 X 、和属性时,调用方法才会起作用 Y ZNote that calling the Offset method will only have an effect if you can change the W, X, Y, and Z properties directly. 由于 Point4D 是一个值类型,因此,如果 Point4D 使用属性或索引器引用对象,则会获得对象的副本,而不是对对象的引用。Because Point4D is a value type, if you reference a Point4D object by using a property or indexer, you get a copy of the object, not a reference to the object. 如果尝试对 W X Y 属性或索引器引用更改、、或,则 Z 会发生编译器错误。If you attempt to change W, X, Y, or Z on a property or indexer reference, a compiler error occurs. 同样, Offset 对属性或索引器调用将不会更改基础对象。Similarly, calling Offset on the property or indexer will not change the underlying object. 如果要更改被 Point4D 引用为属性或索引器的的值,请创建新的 Point4D ,修改其字段,然后将 Point4D 返回回属性或索引器。If you want to change the value of a Point4D that is referenced as a property or indexer, create a new Point4D, modify its fields, and then assign the Point4D back to the property or indexer.

适用于