OrthographicCamera
Namespace: Digi21.DigiNG.Cameras
Assembly: Digi21.DigiNG
Camera with orthographic projection: the view has no perspective, and scale does not depend on distance from the camera.
public sealed class OrthographicCamera : Camera
Inherits from Camera.
When an OrthographicCamera is assigned to the DigiNG class's Camera property, the drawing window centers the view on Position and uses only three differences:
| Difference | Use |
|---|---|
Right - Left |
View width, in drawing file units. |
Top - Bottom |
View height, in drawing file units. |
Far - Near |
View depth. |
The drawing window expands the width or height to preserve the window's aspect ratio. The projection depth is twice the largest of the three values, so Near and Far do not clip entities within the view's width and height.
The OrthographicCamera returned by DigiNG.Camera has Left, Right, Top, Bottom, Near and Far relative to Position: Left = -ancho / 2, Right = ancho / 2, and likewise for height and depth. Constructors that take a window instead assign the window's absolute coordinates; because the drawing window uses only the differences, both forms produce the same view.
Constructors
| Constructor | Description |
|---|---|
| OrthographicCamera() | Creates a camera with an empty Name and all other properties set to 0. |
| OrthographicCamera(string name) | Creates a camera with the specified name and all other properties set to 0. |
| OrthographicCamera(IWindow3D window) | Creates a camera encompassing the specified window, without rotations. |
| OrthographicCamera(string name, IWindow3D window) | Creates a camera encompassing the specified window, without rotations and with the specified name. |
| OrthographicCamera(IWindow3D window, float yaw, float pitch, float roll) | Creates a camera encompassing the specified window, with the specified rotations. |
| OrthographicCamera(string name, IWindow3D window, float yaw, float pitch, float roll) | Creates a camera encompassing the specified window, with the specified rotations and name. |
Properties
| Property | Description |
|---|---|
| double Left | Left view boundary. |
| double Right | Right view boundary. |
| double Top | Top view boundary. |
| double Bottom | Bottom view boundary. |
| string Name | Camera name. Inherited from Camera. |
| Point3D Position | View center. Inherited from Camera. |
| float Pitch | Rotation around the X axis, in degrees. Inherited from Camera. |
| float Yaw | Rotation around the Z axis, in degrees. Inherited from Camera. |
| float Roll | Rotation around the Y axis, in degrees. Inherited from Camera. |
| double Near | Near depth boundary. Inherited from Camera. |
| double Far | Far depth boundary. Inherited from Camera. |
The WorldToViewport, ViewportToWorld and ToString methods are inherited from Camera.
Example
This command shows the entire drawing file in top view:
using Digi21.DigiNG.Cameras;
using Digi21.DigiNG.Plugin.Command;
namespace Ejemplos;
[Command(Name = "VISTA_CENITAL_ARCHIVO")]
public class VistaCenitalArchivo : Command
{
public VistaCenitalArchivo()
{
Initialize += (sender, e) =>
{
var archivo = Digi21.DigiNG.DigiNG.DrawingFile;
// A file without entities has no minimum and maximum coordinates.
if (archivo.Valid)
{
// With all three angles at 0, the camera looks toward -Z with north up.
Digi21.DigiNG.DigiNG.Camera = new OrthographicCamera("Archivo completo", archivo);
Digi21.DigiNG.DigiNG.RenderScene();
}
Dispose();
};
}
}