Idioma

Point3D.Offset(Double, Double, Double) Método

Definição

Traduz a Point3D estrutura pelos valores especificados.

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)

Parâmetros

offsetX
Double

A quantidade a alterar a X coordenada desta Point3D estrutura.

offsetY
Double

A quantidade a alterar a Y coordenada desta Point3D estrutura.

offsetZ
Double

A quantidade a alterar a Z coordenada desta Point3D estrutura.

Exemplos

O exemplo seguinte mostra como deslocar uma Point3D estrutura.

// 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)

Observações

Esta operação é equivalente a adicionar uma Vector3D estrutura a uma Point3D estrutura com os valores correspondentes X, Y, e Z .

Note que chamar o Offset método só terá efeito se puder alterar diretamente as Xpropriedades , Y, e Z . Como Point3D é um tipo de valor, se referenciar um Point3D objeto usando uma propriedade ou indexador, obtém uma cópia do objeto, não uma referência ao objeto. Se tentar alterar X, Y, ou Z numa propriedade ou referência do indexador, ocorre um erro no compilador. De forma semelhante, chamar Offset a propriedade ou o indexador não altera o objeto subjacente. Se quiser alterar o valor de um Point3D que é referenciado como propriedade ou indexador, crie um novo Point3D, modifique os seus campos e depois atribua o Point3D retrocesso à propriedade ou indexador.

Aplica-se a