OrthographicCamera.Width 属性

定义

获取或设置摄像机取景框的宽度(单位为世界单位)。

public:
 property double Width { double get(); void set(double value); };
public double Width { get; set; }
member this.Width : double with get, set
Public Property Width As Double

属性值

Double

摄像机取景框的宽度,单位为世界单位。

示例

以下示例创建并 OrthographicCamera 设置此属性。

//Toggle between camera projections.
public void ToggleCamera(object sender, EventArgs e)
{
    if ((bool)CameraCheck.IsChecked == true)
    {
        OrthographicCamera myOCamera = new OrthographicCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 3);
        myViewport.Camera = myOCamera;
    }
    if ((bool)CameraCheck.IsChecked != true)
    {
        PerspectiveCamera myPCamera = new PerspectiveCamera(new Point3D(0, 0, -3), new Vector3D(0, 0, 1), new Vector3D(0, 1, 0), 50);
        myViewport.Camera = myPCamera;
    }
}
'Toggle between camera projections.
Public Sub ToggleCamera(ByVal sender As Object, ByVal e As EventArgs)
    If CBool(CameraCheck.IsChecked) = True Then
        Dim myOCamera As New OrthographicCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 3)
        myViewport.Camera = myOCamera
    End If
    If CBool(CameraCheck.IsChecked) <> True Then
        Dim myPCamera As New PerspectiveCamera(New Point3D(0, 0, -3), New Vector3D(0, 0, 1), New Vector3D(0, 1, 0), 50)
        myViewport.Camera = myPCamera
    End If
End Sub

注解

OrthographicCamera由于描述的投影不包括透视前列,因此其查看框具有并行的侧边。 因此,可以使用单个值指定查看框的宽度。

下图显示了正向和透视对等相机投影之间的差异。

正投影和透视投影

依赖项属性信息

标识符字段 WidthProperty
元数据属性设置为 true

适用于