Point3D Point3D Point3D Point3D Struct

定義

表示 3-D 空間中的 X、Y 和 Z 座標點。Represents an x-, y-, and z-coordinate point in 3-D space.

public value class Point3D : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Point3DConverter))]
[System.Serializable]
public struct Point3D : IFormattable
type Point3D = struct
    interface IFormattable
Public Structure Point3D
Implements IFormattable
繼承
屬性
實作

範例

這個範例示範如何使用多Point3D載減法Vector3D Point3D (-) 運算子和靜態Subtract方法來減去結構和結構。This example shows how to subtract Point3D structures and Vector3D structures using the overloaded subtraction (-) operator and the Point3D static Subtract method.

下列程式碼說明如何使用Point3D減法方法。The following code illustrates how to use the Point3D subtraction methods. 首先, Point3D會具現化Vector3D結構和結構。First, the Point3D structures and the Vector3D structures are instantiated. 使用多載減法 (-) 運算子來扣除Subtract 結構,然後使用靜態方法來減去它們。Point3DThe Point3D structures are subtracted using the overloaded subtraction (-) operator and then they are subtracted using the static Subtract method. 接下來, Vector3D會使用靜態Subtract方法從第Point3D一個結構中減去結構, 最後Point3D , 會使用多載的減法Vector3D -來減去的結構。) 運算子。Next, the Vector3D structure is subtracted from the first Point3D structure using the static Subtract method, and finally the Point3D structure is subtract from the Vector3D using the overloaded subtraction (-) operator.

// instantiate variables
Point3D point1 = new Point3D();
Point3D point2 = new Point3D(15, 40, 60);
Vector3D vector1 = new Vector3D(20, 30, 40);
Point3D pointResult1 = new Point3D();
Point3D pointResult2 = new Point3D();
Vector3D vectorResult1 = new Vector3D();
Vector3D vectorResult2 = new Vector3D();

// defining x,y,z of point1
point1.X = 10;
point1.Y = 5;
point1.Z = 1;

vectorResult1 = Point3D.Subtract(point1, point2);
// vectorResult1 is equal to (-5, -35, -59)

vectorResult2 = point2 - point1;
// vectorResult2 is equal to (5, 35, 59)

pointResult1 = Point3D.Subtract(point1, vector1);
//  pointResult1 is equal to (-10, -25, -39)

pointResult2 = vector1 - point1;
//  pointResult2 is equal to (10, 25, 39)

備註

在 XAML 中, 的值Point3D之間的分隔符號可以是逗號或空格。In XAML, the delimiter between the values of a Point3D can be either a comma or a space.

某些文化特性可能會使用逗號字元做為小數分隔符號, 而不是句點字元。Some cultures might use the comma character as the decimal delimiter instead of the period character. 不因文化特性而異的 XAML 處理在大部分的 XAML 處理器執行中預設為 en-us, 而且預期句點必須是小數分隔符號。XAML processing for invariant culture defaults to en-US in most XAML processor implementations, and expects the period to be the decimal delimiter. 如果Point3D在 XAML 中指定, 您應該避免使用逗號字元做為小數分隔符號, 因為這會與Point3D屬性值在其元件中的字串類型轉換衝突。You should avoid using the comma character as the decimal delimiter if specifying a Point3D in XAML, because that will clash with the string type conversion of a Point3D attribute value into its components.

XAML Attribute UsageXAML Attribute Usage

<object property="x,y,z"/>  
-or  
<object property="x y z"/>  

XAML 值XAML Values

xx
這個 Point3D 的 X 座標。The x-coordinate of this Point3D.

yy
這個 Point3D 的 Y 座標。The y-coordinate of this Point3D.

zz
這個Point3D的 z 座標。The z-coordinate of this Point3D.

建構函式

Point3D(Double, Double, Double) Point3D(Double, Double, Double) Point3D(Double, Double, Double) Point3D(Double, Double, Double)

初始化 Point3D 結構的新執行個體。Initializes a new instance of the Point3D structure.

屬性

X X X X

取得或設定這個 Point3D 結構的 X 座標。Gets or sets the x-coordinate of this Point3D structure.

Y Y Y Y

取得或設定這個 Point3D 結構的 Y 座標。Gets or sets the y-coordinate of this Point3D structure.

Z Z Z Z

取得或設定這個 Point3D 結構的 Z 座標。Gets or sets the z-coordinate of this Point3D structure.

方法

Add(Point3D, Vector3D) Add(Point3D, Vector3D) Add(Point3D, Vector3D) Add(Point3D, Vector3D)

Point3D 結構加入至 Vector3D,並傳回結果做為 Point3D 結構。Adds a Point3D structure to a Vector3D and returns the result as a Point3D structure.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否為 Point3D 結構,如果是則判斷指定之 XYZObject 屬性是否等於這個 X 結構的 YZPoint3D 屬性。Determines whether the specified object is a Point3D structure and if so, whether the X, Y, and Z properties of the specified Object are equal to the X, Y, and Z properties of this Point3D structure.

Equals(Point3D) Equals(Point3D) Equals(Point3D) Equals(Point3D)

比較兩個 Point3D 結構是否相等。Compares two Point3D structures for equality.

Equals(Point3D, Point3D) Equals(Point3D, Point3D) Equals(Point3D, Point3D) Equals(Point3D, Point3D)

比較兩個 Point3D 結構是否相等。Compares two Point3D structures for equality.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個 Point3D 結構的雜湊程式碼。Returns a hash code for this Point3D structure.

Multiply(Point3D, Matrix3D) Multiply(Point3D, Matrix3D) Multiply(Point3D, Matrix3D) Multiply(Point3D, Matrix3D)

使用指定的 Point3D 結構轉換指定的 Matrix3D 結構。Transforms the specified Point3D structure by the specified Matrix3D structure.

Offset(Double, Double, Double) Offset(Double, Double, Double) Offset(Double, Double, Double) Offset(Double, Double, Double)

根據指定的數量轉譯 Point3D 結構。Translates the Point3D structure by the specified amounts.

Parse(String) Parse(String) Parse(String) Parse(String)

將 3-D 點的 String 表示轉換成對等的 Point3D 結構。Converts a String representation of a 3-D point into the equivalent Point3D structure.

Subtract(Point3D, Point3D) Subtract(Point3D, Point3D) Subtract(Point3D, Point3D) Subtract(Point3D, Point3D)

Point3D 結構減去 Point3D 結構,並傳回 Vector3D 結構的結果。Subtracts a Point3D structure from a Point3D structure and returns the result as a Vector3D structure.

Subtract(Point3D, Vector3D) Subtract(Point3D, Vector3D) Subtract(Point3D, Vector3D) Subtract(Point3D, Vector3D)

Vector3D 結構減去 Point3D 結構,並傳回 Point3D 結構的結果。Subtracts a Vector3D structure from a Point3D structure and returns the result as a Point3D structure.

ToString() ToString() ToString() ToString()

建立這個 String 結構的 Point3D 表示。Creates a String representation of this Point3D structure.

ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider)

建立這個 String 結構的 Point3D 表示。Creates a String representation of this Point3D structure.

運算子

Addition(Point3D, Vector3D) Addition(Point3D, Vector3D) Addition(Point3D, Vector3D) Addition(Point3D, Vector3D)

Point3D 結構加入至 Vector3D,並傳回結果做為 Point3D 結構。Adds a Point3D structure to a Vector3D and returns the result as a Point3D structure.

Equality(Point3D, Point3D) Equality(Point3D, Point3D) Equality(Point3D, Point3D) Equality(Point3D, Point3D)

比較兩個 Point3D 結構是否相等。Compares two Point3D structures for equality.

Explicit(Point3D to Point4D) Explicit(Point3D to Point4D) Explicit(Point3D to Point4D) Explicit(Point3D to Point4D)

Point3D 結構轉換成 Point4D 結構。Converts a Point3D structure into a Point4D structure.

Explicit(Point3D to Vector3D) Explicit(Point3D to Vector3D) Explicit(Point3D to Vector3D) Explicit(Point3D to Vector3D)

Point3D 結構轉換成 Vector3D 結構。Converts a Point3D structure into a Vector3D structure.

Inequality(Point3D, Point3D) Inequality(Point3D, Point3D) Inequality(Point3D, Point3D) Inequality(Point3D, Point3D)

比較兩個 Point3D 結構是否相等。Compares two Point3D structures for inequality.

Multiply(Point3D, Matrix3D) Multiply(Point3D, Matrix3D) Multiply(Point3D, Matrix3D) Multiply(Point3D, Matrix3D)

使用指定的 Point3D 結構轉換指定的 Matrix3D 結構。Transforms the specified Point3D structure by the specified Matrix3D structure.

Subtraction(Point3D, Point3D) Subtraction(Point3D, Point3D) Subtraction(Point3D, Point3D) Subtraction(Point3D, Point3D)

Point3D 結構減去 Point3D 結構,並傳回 Vector3D 結構的結果。Subtracts a Point3D structure from a Point3D structure and returns the result as a Vector3D structure.

Subtraction(Point3D, Vector3D) Subtraction(Point3D, Vector3D) Subtraction(Point3D, Vector3D) Subtraction(Point3D, Vector3D)

Vector3D 結構減去 Point3D 結構,並傳回 Point3D 結構的結果。Subtracts a Vector3D structure from a Point3D structure and returns the result as a Point3D structure.

明確介面實作

IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider)

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. 如需這個成員的說明,請參閱 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

適用於