語言

Point3D 結構

定義

表示立體空間中的 x、y 和 z 座標點。

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

範例

此範例展示了如何Point3D利用過載減法(Vector3D)運算子和-靜態Point3D方法來減去結構和Subtract結構。

以下程式碼說明如何使用 Point3D 減法方法。 首先,Point3DVector3D結構與結構被實例化。 Point3D結構會先用過載-減法()算子減去,然後再用靜態Subtract法減去結構。 接著,Vector3D利用靜態Point3D方法從第一個Subtract結構中減去結構,最後Point3D利用過Vector3D載減法()運算子從結構-中減去結構。

// 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 中,a Point3D 值之間的分隔符可以是逗號或空格。

有些文化可能會用逗號作為小數分隔符,而不是時代字元。 大多數 XAML 處理器實作中,不變文化的 XAML 處理預設為 en-US,且預期週期為十進位分隔符。 如果在 XAML 中指定 a Point3D ,應該避免用逗號作為十進位分隔符,因為這會和字串類型將屬性值轉換 Point3D 成其組成部分的過程產生衝突。

XAML 屬性使用方式

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

XAML 值

x 這個 的 x 座標 Point3D。

y 這個的 y 座標 Point3D。

z 這個 的 z 座標 Point3D。

建構函式

名稱 Description
Point3D(Double, Double, Double)

初始化結構的新實例 Point3D 。

屬性

名稱 Description
X

取得或設定此 Point3D 結構的 x 座標。

Y

取得或設定此 Point3D 結構的 y 座標。

Z

取得或設定此 Point3D 結構的 z 座標。

方法

名稱 Description
Add(Point3D, Vector3D)

在 a Point3D 中加入一個Vector3D結構,並以結構形式回傳結果Point3D。

Equals(Object)

判斷指定物件是否為Point3D結構,若是,則判斷該X物件的 、 Y及Z性質是否Object等於X該Y結構的 、 Z及 Point3D 性質。

Equals(Point3D, Point3D)

比較兩種 Point3D 平等結構。

Equals(Point3D)

比較兩種 Point3D 平等結構。

GetHashCode()

會回傳此 Point3D 結構的雜湊碼。

Multiply(Point3D, Matrix3D)

將指定的 Point3D 結構轉換為指定的 Matrix3D 結構。

Offset(Double, Double, Double)

將 Point3D 結構轉換為指定金額。

Parse(String)

將 String 三維點的表示轉換為等效 Point3D 結構。

Subtract(Point3D, Point3D)

從結構Point3D中減去結構Point3D,並返回結果為結構Vector3D。

Subtract(Point3D, Vector3D)

從結構Vector3D中減去結構Point3D,並返回結果為結構Point3D。

ToString()

能呈現 String 這個 Point3D 結構。

ToString(IFormatProvider)

能呈現 String 這個 Point3D 結構。

運算子

名稱 Description
Addition(Point3D, Vector3D)

在 a Point3D 中加入一個Vector3D結構,並以結構形式回傳結果Point3D。

Equality(Point3D, Point3D)

比較兩種 Point3D 平等結構。

Explicit(Point3D to Point4D)

將結構 Point3D 轉化為結構 Point4D 。

Explicit(Point3D to Vector3D)

將結構 Point3D 轉化為結構 Vector3D 。

Inequality(Point3D, Point3D)

比較兩種 Point3D 不平等結構。

Multiply(Point3D, Matrix3D)

將指定的 Point3D 結構轉換為指定的 Matrix3D 結構。

Subtraction(Point3D, Point3D)

從結構Point3D中減去結構Point3D,並返回結果為結構Vector3D。

Subtraction(Point3D, Vector3D)

從結構Vector3D中減去結構Point3D,並返回結果為結構Point3D。

明確介面實作

名稱 Description
IFormattable.ToString(String, IFormatProvider)

此成員支援 Windows Presentation Foundation(WPF)基礎架構,並非直接從您的程式碼中使用。 關於此成員的描述,請參見 ToString(String, IFormatProvider)。

適用於