Point3D.Offset(Double, Double, Double) Metodo
Definizione
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)
Parametri
- offsetX
- Double
Valore in base al quale modificare la coordinata X della struttura Point3D corrente.The amount to change the X coordinate of this Point3D structure.
- offsetY
- Double
Valore in base al quale modificare la coordinata Y della struttura Point3D corrente.The amount to change the Y coordinate of this Point3D structure.
- offsetZ
- Double
Valore in base al quale modificare la coordinata Z della struttura Point3D corrente.The amount to change the Z coordinate of this Point3D structure.
Esempio
Nell'esempio seguente viene illustrato come eseguire l'offset di una Point3D struttura.The following example shows how to offset a Point3D structure.
// 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)
Commenti
Questa operazione equivale all'aggiunta di una Vector3D struttura a una Point3D struttura con i X valori, Y e corrispondenti Z .This operation is equivalent to adding a Vector3D structure to a Point3D structure with the corresponding X, Y, and Z values.
Si noti che la chiamata al Offset metodo avrà effetto solo se è possibile modificare X direttamente le Y proprietà, e Z .Note that calling the Offset method will only have an effect if you can change the X, Y, and Z properties directly. Poiché Point3D è un tipo di valore, se si fa riferimento a un Point3D oggetto tramite una proprietà o un indicizzatore, si ottiene una copia dell'oggetto, non un riferimento all'oggetto.Because Point3D is a value type, if you reference a Point3D object by using a property or indexer, you get a copy of the object, not a reference to the object. Se si tenta di modificare X , Y o Z in un riferimento a una proprietà o a un indicizzatore, si verifica un errore del compilatore.If you attempt to change X, Y, or Z on a property or indexer reference, a compiler error occurs. Analogamente, Offset la chiamata alla proprietà o all'indicizzatore non comporterà la modifica dell'oggetto sottostante.Similarly, calling Offset on the property or indexer will not change the underlying object. Se si desidera modificare il valore di un oggetto a Point3D cui viene fatto riferimento come una proprietà o un indicizzatore, creare un nuovo oggetto Point3D , modificarne i campi e quindi assegnare Point3D di nuovo alla proprietà o all'indicizzatore.If you want to change the value of a Point3D that is referenced as a property or indexer, create a new Point3D, modify its fields, and then assign the Point3D back to the property or indexer.