Point3D 結構
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示立體空間中的 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利用過載減法(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) | |
| Equals(Object) |
判斷指定物件是否為Point3D結構,若是,則判斷該X物件的 、 Y及Z性質是否Object等於X該Y結構的 、 Z及 Point3D 性質。 |
| Equals(Point3D, Point3D) |
比較兩種 Point3D 平等結構。 |
| Equals(Point3D) |
比較兩種 Point3D 平等結構。 |
| GetHashCode() |
會回傳此 Point3D 結構的雜湊碼。 |
| Multiply(Point3D, Matrix3D) | |
| Offset(Double, Double, Double) |
將 Point3D 結構轉換為指定金額。 |
| Parse(String) | |
| Subtract(Point3D, Point3D) | |
| Subtract(Point3D, Vector3D) | |
| ToString() | |
| ToString(IFormatProvider) |
運算子
明確介面實作
| 名稱 | Description |
|---|---|
| IFormattable.ToString(String, IFormatProvider) |
此成員支援 Windows Presentation Foundation(WPF)基礎架構,並非直接從您的程式碼中使用。 關於此成員的描述,請參見 ToString(String, IFormatProvider)。 |