Point3D Point3D Point3D Point3D Struct

定义

表示三维空间中的 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减法Point3D ( Vector3D -) 运算符和静态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. 如果在 XAML 中指定了Point3D , 则应避免使用逗号字符作为小数分隔符, 因为这将与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 属性用法XAML 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)

将三维点的 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).

适用于