所以这是我非常简单的光线追踪器的视口类。
public sealed class ViewPort
{
public readonly Rectangle3D Rectangle;
public readonly int Width;
public readonly int Height;
public Bitmap Image { get; private set; }
public ViewPort(Rectangle3D rec, int width, int height)
{
this.Rectangle = rec;
this.Width = width;
this.Height = height;
this.Image = new Bitmap(this.Width, this.Height);
}
public bool TryRecord(Ray ray)
{
Point3D cross;
if (this.Rectangle.Intersect(ray, out cross))
{
this.Image.SetPixel(cross...,ray.Light);
}
else
{
return false;
}
}
}
好的,现在如何将 3 维点映射到二维图像?非常感谢您的帮助。谢谢你。