/// <summary>
 /// Gets line (in camera space) from point on near plane to corresponding point on far plane.
 /// </summary>
 public static Line3d Unproject(this ICameraProjection self, Ndc2d p)
 {
     return(new Line3d(
                self.UnprojectPointOnNearPlane(p),
                self.UnprojectPointOnFarPlane(p)
                ));
 }
 /// <summary>
 /// Gets point on far plane (in camera space) from point in normalized device coordinates.
 /// </summary>
 public static V3d UnprojectPointOnFarPlane(this ICameraProjection self, Ndc2d p)
 {
     return(self.ProjectionTrafo.Backward.TransformPosProj(new V3d(p.Position, 1.0)));
 }
Esempio n. 3
0
 /// <summary>
 /// PixelPosition from normalized device coordinates.
 /// </summary>
 public PixelPosition(Ndc2d ndc, Box2i renderTargetRegion)
 {
     Position = new V2i(ndc.TextureCoordinate * (V2d)renderTargetRegion.Size);
     Bounds   = renderTargetRegion;
 }
Esempio n. 4
0
 /// <summary>
 /// Gets point on near plane (in camera space) from point in normalized device coordinates.
 /// </summary>
 public static V3d UnprojectPointOnNearPlane(this ICameraProjection self, Ndc2d p)
 => self.ProjectionTrafo.Backward.TransformPosProj(new V3d(p.Position, 0.0));
Esempio n. 5
0
 /// <summary>
 /// PixelPosition from normalized device coordinates.
 /// </summary>
 public PixelPosition(Ndc2d ndc, V2i renderTargetSize)
     : this(ndc, Box2i.FromSize(renderTargetSize))
 {
 }