0
所以這裏是我的視口類爲我非常簡單的光線跟蹤器。三維視口到二維圖像
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;
}
}
}
好吧,那麼現在如何將三維點映射到二維圖像?非常感謝幫助。謝謝。
你想有透視投影公式?或者你想遮蔽2D圖像平面的像素? – phantasmagoria